1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

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@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-03-25 09:08:50 +01:00
parent 2f971c7fda
commit 1d5f660ff6
2 changed files with 13 additions and 2 deletions

View File

@ -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)

View File

@ -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);