[FFmpeg-cvslog] avcodec/wmv2dec: Parse extradata during init

Andreas Rheinhardt git at videolan.org
Mon Oct 9 19:01:48 EEST 2023


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Fri Oct  6 22:33:51 2023 +0200| [cae30c5ed234f2c5524ab2af673ebf5738739a39] | committer: Andreas Rheinhardt

avcodec/wmv2dec: Parse extradata during init

And stop setting picture_number which was only done to not parse
extradata multiple times.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cae30c5ed234f2c5524ab2af673ebf5738739a39
---

 libavcodec/wmv2dec.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 469b2c4b2b..934bf56b1a 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -203,12 +203,8 @@ static int decode_ext_header(WMV2DecContext *w)
 
 int ff_wmv2_decode_picture_header(MpegEncContext *s)
 {
-    WMV2DecContext *const w = (WMV2DecContext *) s;
     int code;
 
-    if (s->picture_number == 0)
-        decode_ext_header(w);
-
     s->pict_type = get_bits1(&s->gb) + 1;
     if (s->pict_type == AV_PICTURE_TYPE_I) {
         code = get_bits(&s->gb, 7);
@@ -333,7 +329,6 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
     }
     s->esc3_level_length = 0;
     s->esc3_run_length   = 0;
-    s->picture_number++; // FIXME ?
 
     if (w->j_type) {
         ff_intrax8_decode_picture(&w->x8, &s->current_picture,
@@ -578,6 +573,8 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
 
     ff_wmv2_common_init(s);
 
+    decode_ext_header(w);
+
     return ff_intrax8_common_init(avctx, &w->x8,
                                   w->s.block, w->s.block_last_index,
                                   w->s.mb_width, w->s.mb_height);



More information about the ffmpeg-cvslog mailing list