changeset 2298:3a8e557a8226 libavcodec

support strictly enforcing gop size
author michael
date Fri, 15 Oct 2004 02:37:04 +0000
parents 41b5a7bd9a96
children eb0c851db536
files avcodec.h mpegvideo.c
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/avcodec.h	Thu Oct 14 12:24:16 2004 +0000
+++ b/avcodec.h	Fri Oct 15 02:37:04 2004 +0000
@@ -296,6 +296,7 @@
 #define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< will reserve space for SVCD scan offset user data
 #define CODEC_FLAG_CLOSED_GOP     0x80000000
 #define CODEC_FLAG2_FAST          0x00000001 ///< allow non spec compliant speedup tricks
+#define CODEC_FLAG2_STRICT_GOP    0x00000002 ///< strictly enforce GOP size
 
 /* Unsupported options :
  * 		Syntax Arithmetic coding (SAC)
--- a/mpegvideo.c	Thu Oct 14 12:24:16 2004 +0000
+++ b/mpegvideo.c	Fri Oct 15 02:37:04 2004 +0000
@@ -2064,9 +2064,13 @@
             }
 
             if(s->picture_in_gop_number + b_frames >= s->gop_size){
+              if((s->flags2 & CODEC_FLAG2_STRICT_GOP) && s->gop_size > s->picture_in_gop_number){
+                    b_frames= s->gop_size - s->picture_in_gop_number - 1;
+              }else{
                 if(s->flags & CODEC_FLAG_CLOSED_GOP)
                     b_frames=0;
                 s->input_picture[b_frames]->pict_type= I_TYPE;
+              }
             }
             
             if(   (s->flags & CODEC_FLAG_CLOSED_GOP)