[FFmpeg-cvslog] fftools/ffmpeg_enc: stop using OutputStream.initialized
Anton Khirnov
git at videolan.org
Mon Jun 5 17:31:21 EEST 2023
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat May 27 23:26:12 2023 +0200| [c803b36b8f5c8fa73ab2e77490d284d906d4c44b] | committer: Anton Khirnov
fftools/ffmpeg_enc: stop using OutputStream.initialized
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.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c803b36b8f5c8fa73ab2e77490d284d906d4c44b
---
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,
More information about the ffmpeg-cvslog
mailing list