Commit db947ef2 authored by cehoyos's avatar cehoyos

Skip pes payload during probing to avoid start code emulation.

Patch by Janne Grunau, janne-ffmpeg jannau net 


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23286 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 0be67408
...@@ -60,16 +60,20 @@ static int mpegps_probe(AVProbeData *p) ...@@ -60,16 +60,20 @@ static int mpegps_probe(AVProbeData *p)
for(i=0; i<p->buf_size; i++){ for(i=0; i<p->buf_size; i++){
code = (code<<8) + p->buf[i]; code = (code<<8) + p->buf[i];
if ((code & 0xffffff00) == 0x100) { 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); int pes= check_pes(p->buf+i, p->buf+p->buf_size);
if(code == SYSTEM_HEADER_START_CODE) sys++; if(code == SYSTEM_HEADER_START_CODE) sys++;
else if(code == PRIVATE_STREAM_1) priv1++;
else if(code == PACK_START_CODE) pspack++; else if(code == PACK_START_CODE) pspack++;
else if((code & 0xf0) == VIDEO_ID && pes) vid++; 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 & 0xf0) == VIDEO_ID && !pes) invalid++;
else if((code & 0xe0) == AUDIO_ID && !pes) invalid++; else if((code & 0xe0) == AUDIO_ID && !pes) invalid++;
else if(code == PRIVATE_STREAM_1 && !pes) invalid++;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment