mpeg12: move closed_gop from MpegEncContext to Mpeg1Context
authorAnton Khirnov <anton@khirnov.net>
Wed, 19 Oct 2011 07:28:45 +0000 (09:28 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sun, 23 Oct 2011 12:15:56 +0000 (14:15 +0200)
It's MPEG-1/2 specific.

libavcodec/mpeg12.c
libavcodec/mpeg12.h
libavcodec/mpegvideo.c
libavcodec/mpegvideo.h

index 63b6066..6fb175e 100644 (file)
@@ -2111,7 +2111,7 @@ static void mpeg_decode_gop(AVCodecContext *avctx,
     time_code_seconds  = get_bits(&s->gb, 6);
     time_code_pictures = get_bits(&s->gb, 6);
 
     time_code_seconds  = get_bits(&s->gb, 6);
     time_code_pictures = get_bits(&s->gb, 6);
 
-    s->closed_gop = get_bits1(&s->gb);
+    s1->closed_gop = get_bits1(&s->gb);
     /*broken_link indicate that after editing the
       reference frames of the first B-Frames after GOP I-Frame
       are missing (open gop)*/
     /*broken_link indicate that after editing the
       reference frames of the first B-Frames after GOP I-Frame
       are missing (open gop)*/
@@ -2120,7 +2120,7 @@ static void mpeg_decode_gop(AVCodecContext *avctx,
     if (s->avctx->debug & FF_DEBUG_PICT_INFO)
         av_log(s->avctx, AV_LOG_DEBUG, "GOP (%2d:%02d:%02d.[%02d]) closed_gop=%d broken_link=%d\n",
                time_code_hours, time_code_minutes, time_code_seconds,
     if (s->avctx->debug & FF_DEBUG_PICT_INFO)
         av_log(s->avctx, AV_LOG_DEBUG, "GOP (%2d:%02d:%02d.[%02d]) closed_gop=%d broken_link=%d\n",
                time_code_hours, time_code_minutes, time_code_seconds,
-               time_code_pictures, s->closed_gop, broken_link);
+               time_code_pictures, s1->closed_gop, broken_link);
 }
 /**
  * Find the end of the current frame in the bitstream.
 }
 /**
  * Find the end of the current frame in the bitstream.
@@ -2383,7 +2383,7 @@ static int decode_chunks(AVCodecContext *avctx,
                 if (s2->last_picture_ptr == NULL) {
                 /* Skip B-frames if we do not have reference frames and gop is not closed */
                     if (s2->pict_type == AV_PICTURE_TYPE_B) {
                 if (s2->last_picture_ptr == NULL) {
                 /* Skip B-frames if we do not have reference frames and gop is not closed */
                     if (s2->pict_type == AV_PICTURE_TYPE_B) {
-                        if (!s2->closed_gop)
+                        if (!s->closed_gop)
                             break;
                     }
                 }
                             break;
                     }
                 }
@@ -2467,6 +2467,7 @@ static void flush(AVCodecContext *avctx)
     Mpeg1Context *s = avctx->priv_data;
 
     s->sync=0;
     Mpeg1Context *s = avctx->priv_data;
 
     s->sync=0;
+    s->closed_gop = 0;
 
     ff_mpeg_flush(avctx);
 }
 
     ff_mpeg_flush(avctx);
 }
index 2a2049f..209bf05 100644 (file)
@@ -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 full_pel[2];
     AVRational frame_rate_ext;       ///< MPEG-2 specific framerate modificator
     int sync;                        ///< Did we reach a sync point like a GOP/SEQ/KEYFrame?
     int full_pel[2];
+    int closed_gop;                  ///< GOP is closed
 } Mpeg1Context;
 
 extern uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
 } Mpeg1Context;
 
 extern uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
index c1cd1f7..effc9b7 100644 (file)
@@ -2404,7 +2404,6 @@ void ff_mpeg_flush(AVCodecContext *avctx){
     s->current_picture_ptr = s->last_picture_ptr = s->next_picture_ptr = NULL;
 
     s->mb_x= s->mb_y= 0;
     s->current_picture_ptr = s->last_picture_ptr = s->next_picture_ptr = NULL;
 
     s->mb_x= s->mb_y= 0;
-    s->closed_gop= 0;
 
     s->parse_context.state= -1;
     s->parse_context.frame_start_found= 0;
 
     s->parse_context.state= -1;
     s->parse_context.frame_start_found= 0;
index 0af5d8d..b69519a 100644 (file)
@@ -329,7 +329,6 @@ typedef struct MpegEncContext {
     int *lambda_table;
     int adaptive_quant;         ///< use adaptive quantization
     int dquant;                 ///< qscale difference to prev qscale
     int *lambda_table;
     int adaptive_quant;         ///< use adaptive quantization
     int dquant;                 ///< qscale difference to prev qscale
-    int closed_gop;             ///< MPEG1/2 GOP is closed
     int pict_type;              ///< AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
     int last_pict_type; //FIXME removes
     int last_non_b_pict_type;   ///< used for mpeg4 gmc b-frames & ratecontrol
     int pict_type;              ///< AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
     int last_pict_type; //FIXME removes
     int last_non_b_pict_type;   ///< used for mpeg4 gmc b-frames & ratecontrol