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
8080 {
8181 MpegEncContext *const s1 = src->priv_data;
8282 MpegEncContext *const s = dst->priv_data;
83− int ret;
83+ int ret = 0;
8484
8585 if (dst == src)
8686 return 0;
@@ -102,6 +102,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, · 15 unmodified lines
102102 if (s1->context_initialized) {
103103 if ((err = ff_mpv_common_init(s)) < 0)
104104 return err;
105+ ret = 1;
105106 }
106107 }
107108
@@ -110,6 +111,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, · 2 unmodified lines
110111 s->width = s1->width;
111112 if ((ret = ff_mpv_common_frame_size_change(s)) < 0)
112113 return ret;
114+ ret = 1;
113115 }
114116
115117 s->quarter_sample = s1->quarter_sample;
@@ -139,7 +141,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, · 23 unmodified lines
139141 memcpy(&s->progressive_sequence, &s1->progressive_sequence,
140142 (char *) &s1->first_field + sizeof(s1->first_field) - (char *) &s1->progressive_sequence);
141143
142− return 0;
144+ return ret;
143145 }
144146
145147 av_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
6262
6363 int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f,
6464 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+ */
6574 int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
6675 void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h);
6776 void 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