Mercurial > libavformat.hg
changeset 6049:bd81aaf36a9a libavformat
Skip pes payload during probing to avoid start code emulation.
Patch by Janne Grunau, janne-ffmpeg jannau net
author | cehoyos |
---|---|
date | Mon, 24 May 2010 12:32:13 +0000 |
parents | e507a21a9566 |
children | 8a4763913ae0 |
files | mpeg.c |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mpeg.c Mon May 24 08:58:19 2010 +0000 +++ b/mpeg.c Mon May 24 12:32:13 2010 +0000 @@ -60,16 +60,20 @@ 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++; } }