Merge commit 'abda15a990527557c20848f6ca2f82eb85e76dc9'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 9 Jul 2014 19:29:21 +0000 (21:29 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 9 Jul 2014 19:30:45 +0000 (21:30 +0200)
* commit 'abda15a990527557c20848f6ca2f82eb85e76dc9':
  cdg: set the keyframe flag on the first packet

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/cdg.c

@@@ -59,21 -64,20 +64,27 @@@ static int read_packet(AVFormatContext 
          av_free_packet(pkt);
      }
  
+     if (!priv->got_first_packet) {
+         pkt->flags |= AV_PKT_FLAG_KEY;
+         priv->got_first_packet = 1;
+     }
      pkt->stream_index = 0;
 +    pkt->dts=
 +    pkt->pts= pkt->pos / CDG_PACKET_SIZE;
 +
 +    if(ret>5 && (pkt->data[0]&0x3F) == 9 && (pkt->data[1]&0x3F)==1 && !(pkt->data[2+2+1] & 0x0F)){
 +        pkt->flags = AV_PKT_FLAG_KEY;
 +    }
      return ret;
  }
  
  AVInputFormat ff_cdg_demuxer = {
      .name           = "cdg",
      .long_name      = NULL_IF_CONFIG_SMALL("CD Graphics"),
+     .priv_data_size = sizeof(CDGContext),
      .read_header    = read_header,
      .read_packet    = read_packet,
 +    .flags          = AVFMT_GENERIC_INDEX,
      .extensions     = "cdg",
  };