[FFmpeg-cvslog] avcodec/mpegvideo_dec: Notify users of reinit
Andreas Rheinhardt
git at videolan.org
Fri May 16 03:14:43 EEST 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Mar 25 09:08:50 2025 +0100| [1d5f660ff662d340ee120734c8ea2423857902b2] | committer: Andreas Rheinhardt
avcodec/mpegvideo_dec: Notify users of reinit
Namely of reinititialization performed by
ff_mpeg_update_thread_context(), so that they can simply
update their own dimension-based buffers accordingly.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1d5f660ff662d340ee120734c8ea2423857902b2
---
libavcodec/mpegvideo_dec.c | 6 ++++--
libavcodec/mpegvideodec.h | 9 +++++++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 4019b4f0da..75c765218c 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -80,7 +80,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
{
MpegEncContext *const s1 = src->priv_data;
MpegEncContext *const s = dst->priv_data;
- int ret;
+ int ret = 0;
if (dst == src)
return 0;
@@ -102,6 +102,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
if (s1->context_initialized) {
if ((err = ff_mpv_common_init(s)) < 0)
return err;
+ ret = 1;
}
}
@@ -110,6 +111,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
s->width = s1->width;
if ((ret = ff_mpv_common_frame_size_change(s)) < 0)
return ret;
+ ret = 1;
}
s->quarter_sample = s1->quarter_sample;
@@ -139,7 +141,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
memcpy(&s->progressive_sequence, &s1->progressive_sequence,
(char *) &s1->first_field + sizeof(s1->first_field) - (char *) &s1->progressive_sequence);
- return 0;
+ return ret;
}
av_cold int ff_mpv_decode_close(AVCodecContext *avctx)
diff --git a/libavcodec/mpegvideodec.h b/libavcodec/mpegvideodec.h
index 6100364715..bc4bc90590 100644
--- a/libavcodec/mpegvideodec.h
+++ b/libavcodec/mpegvideodec.h
@@ -62,6 +62,15 @@ void ff_mpv_frame_end(MpegEncContext *s);
int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f,
const MPVPicture *p, int qp_type);
+/**
+ * update_thread_context for mpegvideo-based decoders. It updates
+ * the MPVPictures and generic stream-level parameters. If necessary
+ * (on dimension changes), it also performs reinitialization.
+ *
+ * @retval 1 if a reinitialization happened
+ * @retval 0 on success if no reinitialization happened
+ * @retval "<0" error code
+ */
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h);
void ff_mpeg_flush(AVCodecContext *avctx);
More information about the ffmpeg-cvslog
mailing list