[FFmpeg-devel] [PATCH 17/23] fftools/ffmpeg_enc: stop using OutputStream.initialized
Anton Khirnov
anton at khirnov.net
Wed May 31 17:54:47 EEST 2023
It is set by the muxing code, which will not be synchronized with
encoding code after upcoming threading changes. Use an encoder-private
variable instead.
---
fftools/ffmpeg_enc.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index cd2faccf4e..1515ca971f 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -62,6 +62,8 @@ struct Encoder {
// number of packets received from the encoder
uint64_t packets_encoded;
+
+ int opened;
};
static uint64_t dup_warning = 1000;
@@ -187,7 +189,7 @@ int enc_open(OutputStream *ost, AVFrame *frame)
OutputFile *of = output_files[ost->file_index];
int ret;
- if (ost->initialized)
+ if (e->opened)
return 0;
set_encoder_id(output_files[ost->file_index], ost);
@@ -362,6 +364,8 @@ int enc_open(OutputStream *ost, AVFrame *frame)
return ret;
}
+ e->opened = 1;
+
if (ost->sq_idx_encode >= 0) {
e->sq_frame = av_frame_alloc();
if (!e->sq_frame)
@@ -1123,6 +1127,7 @@ void enc_flush(void)
}
for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) {
+ Encoder *e = ost->enc;
AVCodecContext *enc = ost->enc_ctx;
OutputFile *of = output_files[ost->file_index];
@@ -1131,7 +1136,7 @@ void enc_flush(void)
// Try to enable encoding with no input frames.
// Maybe we should just let encoding fail instead.
- if (!ost->initialized) {
+ if (!e->opened) {
FilterGraph *fg = ost->filter->graph;
av_log(ost, AV_LOG_WARNING,
--
2.40.1
More information about the ffmpeg-devel
mailing list