Namely of reinititialization performed by ff_mpeg_update_thread_context(), so that they can simply update their own dimension-based buffers accordingly.
Unified · Split
| @@ -80,7 +80,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, · 79 unmodified lines | ||
| 80 | 80 | { |
| 81 | 81 | MpegEncContext *const s1 = src->priv_data; |
| 82 | 82 | MpegEncContext *const s = dst->priv_data; |
| 83 | − int ret; | |
| 83 | + int ret = 0; | |
| 84 | 84 | |
| 85 | 85 | if (dst == src) |
| 86 | 86 | return 0; |
| @@ -102,6 +102,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, · 15 unmodified lines | ||
| 102 | 102 | if (s1->context_initialized) { |
| 103 | 103 | if ((err = ff_mpv_common_init(s)) < 0) |
| 104 | 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 | 111 | s->width = s1->width; |
| 111 | 112 | if ((ret = ff_mpv_common_frame_size_change(s)) < 0) |
| 112 | 113 | return ret; |
| 114 | + ret = 1; | |
| 113 | 115 | } |
| 114 | 116 | |
| 115 | 117 | s->quarter_sample = s1->quarter_sample; |
| @@ -139,7 +141,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, · 23 unmodified lines | ||
| 139 | 141 | memcpy(&s->progressive_sequence, &s1->progressive_sequence, |
| 140 | 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 | |
| 145 | 147 | av_cold int ff_mpv_decode_close(AVCodecContext *avctx) |
| @@ -62,6 +62,15 @@ void ff_mpv_frame_end(MpegEncContext *s); · 61 unmodified lines | ||
| 62 | 62 | |
| 63 | 63 | int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f, |
| 64 | 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 | + */ | |
| 65 | 74 | int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src); |
| 66 | 75 | void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h); |
| 67 | 76 | void ff_mpeg_flush(AVCodecContext *avctx); |