]> git.sesse.net Git - ffmpeg/commitdiff
set PKT_FLAG_KEY for Theora and OGM streams
authorMåns Rullgård <mans@mansr.com>
Sun, 11 Nov 2007 21:56:18 +0000 (21:56 +0000)
committerMåns Rullgård <mans@mansr.com>
Sun, 11 Nov 2007 21:56:18 +0000 (21:56 +0000)
Originally committed as revision 11002 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/oggdec.c
libavformat/oggdec.h
libavformat/oggparseogm.c
libavformat/oggparsetheora.c

index 03377d9cfaecb7464901cebab1e7e667b51f64d5..211208dd25d96638126a0237e2377dc41b0b3653 100644 (file)
@@ -377,6 +377,7 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize)
     }
 
     if (os->header > -1 && os->seq > os->header){
+        os->pflags = 0;
         if (os->codec && os->codec->packet)
             os->codec->packet (s, idx);
         if (str)
@@ -525,6 +526,8 @@ ogg_read_packet (AVFormatContext * s, AVPacket * pkt)
         os->lastgp = -1;
     }
 
+    pkt->flags = os->pflags;
+
     return psize;
 }
 
index da79c0a6e8fe7788dcc206d782a84ec2dd318e22..964c044f6530f98effbe2bc45a8dbb3a63b357cd 100644 (file)
@@ -42,6 +42,7 @@ typedef struct ogg_stream {
     unsigned int bufpos;
     unsigned int pstart;
     unsigned int psize;
+    unsigned int pflags;
     uint32_t serial;
     uint32_t seq;
     uint64_t granule, lastgp;
index edafd652899356c3a36b8ee93a309acf72047683..bbf9cb8c8dbdcf1235960a485a8def4a339c4261 100644 (file)
@@ -134,6 +134,9 @@ ogm_packet(AVFormatContext *s, int idx)
     uint8_t *p = os->buf + os->pstart;
     int lb;
 
+    if(*p & 8)
+        os->pflags |= PKT_FLAG_KEY;
+
     lb = ((*p & 2) << 1) | ((*p >> 6) & 3);
     os->pstart += lb + 1;
     os->psize -= lb + 1;
index 617d1ded514b883b628945068c147dbbe989ffad..b976dcb70148bb698523fb109f7ce3fc75c6d08a 100644 (file)
@@ -124,6 +124,9 @@ theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp)
     uint64_t iframe = gp >> thp->gpshift;
     uint64_t pframe = gp & thp->gpmask;
 
+    if(!pframe)
+        os->pflags |= PKT_FLAG_KEY;
+
     return iframe + pframe;
 }