History

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.

Andreas Rheinhardt committed 1 year ago

Commit 1d5f6601 parent 2f971c72 files · +13 −2Browse files

Unified · Split

2 files
  1. libavcodec/mpegvideo_dec.c +4 −2
  2. libavcodec/mpegvideodec.h +9 −0
libavcodec/mpegvideo_dec.c+4−2
@@ -80,7 +80,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, · 79 unmodified lines
80{80{
81 MpegEncContext *const s1 = src->priv_data;81 MpegEncContext *const s1 = src->priv_data;
82 MpegEncContext *const s = dst->priv_data;82 MpegEncContext *const s = dst->priv_data;
83 int ret;83 int ret = 0;
84 84
85 if (dst == src)85 if (dst == src)
86 return 0;86 return 0;
@@ -102,6 +102,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, · 15 unmodified lines
102 if (s1->context_initialized) {102 if (s1->context_initialized) {
103 if ((err = ff_mpv_common_init(s)) < 0)103 if ((err = ff_mpv_common_init(s)) < 0)
104 return err;104 return err;
105 ret = 1;
105 }106 }
106 }107 }
107 108
@@ -110,6 +111,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, · 2 unmodified lines
110 s->width = s1->width;111 s->width = s1->width;
111 if ((ret = ff_mpv_common_frame_size_change(s)) < 0)112 if ((ret = ff_mpv_common_frame_size_change(s)) < 0)
112 return ret;113 return ret;
114 ret = 1;
113 }115 }
114 116
115 s->quarter_sample = s1->quarter_sample;117 s->quarter_sample = s1->quarter_sample;
@@ -139,7 +141,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, · 23 unmodified lines
139 memcpy(&s->progressive_sequence, &s1->progressive_sequence,141 memcpy(&s->progressive_sequence, &s1->progressive_sequence,
140 (char *) &s1->first_field + sizeof(s1->first_field) - (char *) &s1->progressive_sequence);142 (char *) &s1->first_field + sizeof(s1->first_field) - (char *) &s1->progressive_sequence);
141 143
142 return 0;144 return ret;
143}145}
144 146
145av_cold int ff_mpv_decode_close(AVCodecContext *avctx)147av_cold int ff_mpv_decode_close(AVCodecContext *avctx)
libavcodec/mpegvideodec.h+9−0
@@ -62,6 +62,15 @@ void ff_mpv_frame_end(MpegEncContext *s); · 61 unmodified lines
62 62
63int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f,63int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f,
64 const MPVPicture *p, int qp_type);64 const MPVPicture *p, int qp_type);
65/**
66 * update_thread_context for mpegvideo-based decoders. It updates
67 * the MPVPictures and generic stream-level parameters. If necessary
68 * (on dimension changes), it also performs reinitialization.
69 *
70 * @retval 1 if a reinitialization happened
71 * @retval 0 on success if no reinitialization happened
72 * @retval "<0" error code
73 */
65int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);74int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
66void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h);75void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h);
67void ff_mpeg_flush(AVCodecContext *avctx);76void ff_mpeg_flush(AVCodecContext *avctx);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t