Mercurial > mplayer.hg
changeset 547:3e46eab9f782
small bugfix in the new optimized head sync code
author | arpi_esp |
---|---|
date | Fri, 20 Apr 2001 16:43:17 +0000 |
parents | 22ed5f5821e2 |
children | c5c2d4e41a4a |
files | demux_mpg.c |
diffstat | 1 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/demux_mpg.c Fri Apr 20 14:32:09 2001 +0000 +++ b/demux_mpg.c Fri Apr 20 16:43:17 2001 +0000 @@ -3,12 +3,17 @@ //#define MAX_PS_PACKETSIZE 2048 #define MAX_PS_PACKETSIZE (224*1024) +static int mpeg_pts_error=0; + static unsigned int read_mpeg_timestamp(stream_t *s,int c){ int d,e; unsigned int pts; d=stream_read_word(s); e=stream_read_word(s); - if( ((c&1)!=1) || ((d&1)!=1) || ((e&1)!=1) ) return 0; // invalid pts + if( ((c&1)!=1) || ((d&1)!=1) || ((e&1)!=1) ){ + ++mpeg_pts_error; + return 0; // invalid pts + } pts=(((c>>1)&7)<<30)|((d>>1)<<15)|(e>>1); if(verbose>=3) printf("{%d}",pts); return pts; @@ -49,6 +54,8 @@ return -2; // invalid packet !!!!!! } + mpeg_pts_error=0; + while(len>0){ // Skip stuFFing bytes c=stream_read_char(demux->stream);--len; if(c!=0xFF)break; @@ -146,6 +153,7 @@ return -1; // invalid packet !!!!!! } } + if(mpeg_pts_error) printf(" {PTS_err:%d} \n",mpeg_pts_error); if(verbose>=3) printf(" => len=%d\n",len); // if(len<=0 || len>MAX_PS_PACKETSIZE) return -1; // Invalid packet size @@ -215,8 +223,10 @@ do{ demux->filepos=stream_tell(demux->stream); head=stream_read_dword(demux->stream); - demux->filepos-=skipped; - while(1){ + if((head&0xFFFFFF00)!=0x100){ + // sync... + demux->filepos-=skipped; + while(1){ int c=stream_read_char(demux->stream); if(c<0) break; //EOF head<<=8; @@ -227,8 +237,9 @@ } head|=c; break; + } + demux->filepos+=skipped; } - demux->filepos+=skipped; if(stream_eof(demux->stream)) break; // sure: head=0x000001XX if(verbose>=4) printf("*** head=0x%X\n",head);