[FFmpeg-cvslog] mpeg12: fix logic that prevents extradata from being parsed twice.

Michael Niedermayer git at videolan.org
Fri May 11 18:47:26 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri May 11 18:37:41 2012 +0200| [de1824e970d448a84bedce4936c301c322baa714] | committer: Michael Niedermayer

mpeg12: fix logic that prevents extradata from being parsed twice.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/mpeg12.c |    3 ++-
 libavcodec/mpeg12.h |    1 +
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 30456e9..c7118a5 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -2286,12 +2286,13 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
 
     s->slice_count = 0;
 
-    if (avctx->extradata && !avctx->frame_number) {
+    if (avctx->extradata && !s->parsed_extra) {
         int ret = decode_chunks(avctx, picture, data_size, avctx->extradata, avctx->extradata_size);
         if(*data_size) {
             av_log(avctx, AV_LOG_ERROR, "picture in extradata\n");
             *data_size = 0;
         }
+        s->parsed_extra = 1;
         if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
             return ret;
     }
diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h
index 9a9cc85..c8cec48 100644
--- a/libavcodec/mpeg12.h
+++ b/libavcodec/mpeg12.h
@@ -42,6 +42,7 @@ typedef struct Mpeg1Context {
     AVRational frame_rate_ext;       ///< MPEG-2 specific framerate modificator
     int sync;                        ///< Did we reach a sync point like a GOP/SEQ/KEYFrame?
     int tmpgexs;
+    int parsed_extra;
 } Mpeg1Context;
 
 extern uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];



More information about the ffmpeg-cvslog mailing list