diff options
author | Janne Grunau <janne-ffmpeg@jannau.net> | 2010-05-24 12:32:13 +0000 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at> | 2010-05-24 12:32:13 +0000 |
commit | 612dc0238aa2583905aba35601a0160d0f841dd8 (patch) | |
tree | 0111507aa736f651ee1a109398ae1b04115def15 | |
parent | d3d87481772fdf4e56b4ab788635b0a1b16e2784 (diff) | |
download | ffmpeg-612dc0238aa2583905aba35601a0160d0f841dd8.tar.gz |
Skip pes payload during probing to avoid start code emulation.
Patch by Janne Grunau, janne-ffmpeg jannau net
Originally committed as revision 23286 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/mpeg.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 4224a04b37..4d1db258d7 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -60,16 +60,20 @@ static int mpegps_probe(AVProbeData *p) for(i=0; i<p->buf_size; i++){ code = (code<<8) + p->buf[i]; if ((code & 0xffffff00) == 0x100) { + int len= p->buf[i+1] << 8 | p->buf[i+2]; int pes= check_pes(p->buf+i, p->buf+p->buf_size); if(code == SYSTEM_HEADER_START_CODE) sys++; - else if(code == PRIVATE_STREAM_1) priv1++; else if(code == PACK_START_CODE) pspack++; else if((code & 0xf0) == VIDEO_ID && pes) vid++; - else if((code & 0xe0) == AUDIO_ID && pes) audio++; + // skip pes payload to avoid start code emulation for private + // and audio streams + else if((code & 0xe0) == AUDIO_ID && pes) {audio++; i+=len;} + else if(code == PRIVATE_STREAM_1 && pes) {priv1++; i+=len;} else if((code & 0xf0) == VIDEO_ID && !pes) invalid++; else if((code & 0xe0) == AUDIO_ID && !pes) invalid++; + else if(code == PRIVATE_STREAM_1 && !pes) invalid++; } } |