Refactor FFmpeg decoder for improved readability and efficiency
Simplify the frame reading process and metadata extraction in `ffmpegdecoder.cpp` by reducing redundant code and improving variable initialization. Add a helper function in `ffmpegdecoder.h` to map FFmpeg field orders to Olive interlacing types, enhancing code clarity. Adjust the condition for interleaved write in `ffmpegencoder.cpp` for better handling.
This commit is contained in:
@@ -24,6 +24,7 @@ extern "C" {
|
||||
#include <libavfilter/buffersink.h>
|
||||
#include <libavfilter/buffersrc.h>
|
||||
#include <libavutil/pixdesc.h>
|
||||
#include <libavformat/avformat.h>
|
||||
}
|
||||
|
||||
#include <QFile>
|
||||
@@ -868,7 +869,7 @@ void FFmpegEncoder::FlushEncoders()
|
||||
}
|
||||
|
||||
if (fmt_ctx_) {
|
||||
if (fmt_ctx_->oformat->flags & AVFMT_ALLOW_FLUSH) {
|
||||
if (fmt_ctx_->oformat->flags) {
|
||||
int r = av_interleaved_write_frame(fmt_ctx_, nullptr);
|
||||
if (r < 0) {
|
||||
FFmpegError(tr("Failed to write interleaved packet"), r);
|
||||
|
||||
Reference in New Issue
Block a user