set PKT_FLAG_KEY for Theora and OGM streams

Originally committed as revision 11002 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Måns Rullgård 17 years ago
parent 6865337f7b
commit e1a794b272
  1. 3
      libavformat/oggdec.c
  2. 1
      libavformat/oggdec.h
  3. 3
      libavformat/oggparseogm.c
  4. 3
      libavformat/oggparsetheora.c

@ -377,6 +377,7 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize)
} }
if (os->header > -1 && os->seq > os->header){ if (os->header > -1 && os->seq > os->header){
os->pflags = 0;
if (os->codec && os->codec->packet) if (os->codec && os->codec->packet)
os->codec->packet (s, idx); os->codec->packet (s, idx);
if (str) if (str)
@ -525,6 +526,8 @@ ogg_read_packet (AVFormatContext * s, AVPacket * pkt)
os->lastgp = -1; os->lastgp = -1;
} }
pkt->flags = os->pflags;
return psize; return psize;
} }

@ -42,6 +42,7 @@ typedef struct ogg_stream {
unsigned int bufpos; unsigned int bufpos;
unsigned int pstart; unsigned int pstart;
unsigned int psize; unsigned int psize;
unsigned int pflags;
uint32_t serial; uint32_t serial;
uint32_t seq; uint32_t seq;
uint64_t granule, lastgp; uint64_t granule, lastgp;

@ -134,6 +134,9 @@ ogm_packet(AVFormatContext *s, int idx)
uint8_t *p = os->buf + os->pstart; uint8_t *p = os->buf + os->pstart;
int lb; int lb;
if(*p & 8)
os->pflags |= PKT_FLAG_KEY;
lb = ((*p & 2) << 1) | ((*p >> 6) & 3); lb = ((*p & 2) << 1) | ((*p >> 6) & 3);
os->pstart += lb + 1; os->pstart += lb + 1;
os->psize -= lb + 1; os->psize -= lb + 1;

@ -124,6 +124,9 @@ theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp)
uint64_t iframe = gp >> thp->gpshift; uint64_t iframe = gp >> thp->gpshift;
uint64_t pframe = gp & thp->gpmask; uint64_t pframe = gp & thp->gpmask;
if(!pframe)
os->pflags |= PKT_FLAG_KEY;
return iframe + pframe; return iframe + pframe;
} }

Loading…
Cancel
Save