changeset 1262:8da1b141e83a libavformat

set correct first gop closed value
author bcoudurier
date Mon, 21 Aug 2006 15:49:08 +0000
parents e03e8ce942e8
children cf88f6719743
files gxfenc.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gxfenc.c	Mon Aug 21 15:14:36 2006 +0000
+++ b/gxfenc.c	Mon Aug 21 15:49:08 2006 +0000
@@ -181,7 +181,7 @@
     size = snprintf(buffer, 1024, "Ver 1\nBr %.6f\nIpg 1\nPpi %d\nBpiop %d\n"
                     "Pix 0\nCf %d\nCg %d\nSl 7\nnl16 %d\nVi 1\nf1 1\n",
                     (float)ctx->codec->bit_rate, ctx->p_per_gop, ctx->b_per_gop,
-                    ctx->codec->pix_fmt == PIX_FMT_YUV422P ? 2 : 1, ctx->first_gop_closed,
+                    ctx->codec->pix_fmt == PIX_FMT_YUV422P ? 2 : 1, ctx->first_gop_closed == 1,
                     ctx->codec->height / 16);
     put_byte(pb, 0x4F);
     put_byte(pb, size + 1);
@@ -418,7 +418,7 @@
         put_le32(pb, 2);
     else
         put_le32(pb, 1); /* default to 420 */
-    put_le32(pb, stream->first_gop_closed); /* closed = 1, open = 0, unknown = 255 */
+    put_le32(pb, stream->first_gop_closed == 1); /* closed = 1, open = 0, unknown = 255 */
     put_le32(pb, 3); /* top = 1, bottom = 2, frame = 3, unknown = 0 */
     put_le32(pb, 1); /* I picture per GOP */
     put_le32(pb, stream->p_per_gop);
@@ -625,6 +625,7 @@
             sc->fields = 2; /* interlaced */
             switch (sc->codec->codec_id) {
             case CODEC_ID_MPEG2VIDEO:
+                sc->first_gop_closed = -1;
                 sc->track_type = 4;
                 gxf->mpeg_tracks++;
                 gxf->flags |= 0x00008000;
@@ -692,7 +693,7 @@
     int i;
     for(i=0; i<size-4 && c!=0x100; i++){
         c = (c<<8) + buf[i];
-        if(c == 0x1B8) /* GOP start code */
+        if(c == 0x1B8 && sc->first_gop_closed == -1) /* GOP start code */
             sc->first_gop_closed= (buf[i+4]>>6)&1;
     }
     return (buf[i+1]>>3)&7;