Mercurial > mplayer.hg
comparison libmpdemux/demux_ty.c @ 24478:43c9c72b8c54
Simplify demux_ty_FindESHeader
author | reimar |
---|---|
date | Fri, 14 Sep 2007 19:53:09 +0000 |
parents | 8c9d86adb28e |
children | 6fb4555fba27 |
comparison
equal
deleted
inserted
replaced
24477:8c9d86adb28e | 24478:43c9c72b8c54 |
---|---|
357 tivo->firstVideoPTS = pts; | 357 tivo->firstVideoPTS = pts; |
358 if ( type == TY_A && tivo->firstAudioPTS == MP_NOPTS_VALUE ) | 358 if ( type == TY_A && tivo->firstAudioPTS == MP_NOPTS_VALUE ) |
359 tivo->firstAudioPTS = pts; | 359 tivo->firstAudioPTS = pts; |
360 } | 360 } |
361 | 361 |
362 static int demux_ty_FindESHeader( unsigned char *header, int headerSize, | 362 static int demux_ty_FindESHeader( unsigned char *header, |
363 unsigned char *buffer, int bufferSize, int *esOffset1 ) | 363 unsigned char *buffer, int bufferSize ) |
364 { | 364 { |
365 int count; | 365 int count; |
366 | |
367 *esOffset1 = -1; | |
368 for( count = 0 ; count < bufferSize ; count++ ) | 366 for( count = 0 ; count < bufferSize ; count++ ) |
369 { | 367 { |
370 if ( buffer[ count + 0 ] == header[ 0 ] && | 368 if ( buffer[ count + 0 ] == header[ 0 ] && |
371 buffer[ count + 1 ] == header[ 1 ] && | 369 buffer[ count + 1 ] == header[ 1 ] && |
372 buffer[ count + 2 ] == header[ 2 ] && | 370 buffer[ count + 2 ] == header[ 2 ] && |
373 buffer[ count + 3 ] == header[ 3 ] ) | 371 buffer[ count + 3 ] == header[ 3 ] ) |
374 { | 372 return count; |
375 *esOffset1 = count; | |
376 return 1; | |
377 } | |
378 } | 373 } |
379 return -1; | 374 return -1; |
380 } | 375 } |
381 | 376 |
382 static void demux_ty_FindESPacket( unsigned char *header, int headerSize, | 377 static void demux_ty_FindESPacket( unsigned char *header, int headerSize, |
650 { | 645 { |
651 printf( "%2.2x ", chunk[ offset + count ] ); | 646 printf( "%2.2x ", chunk[ offset + count ] ); |
652 } | 647 } |
653 printf( "\n" ); | 648 printf( "\n" ); |
654 #endif | 649 #endif |
655 demux_ty_FindESHeader( ty_VideoPacket, 4, &chunk[ offset ], | 650 esOffset1 = demux_ty_FindESHeader( ty_VideoPacket, &chunk[ offset ], |
656 size, &esOffset1 ); | 651 size); |
657 if ( esOffset1 != -1 ) | 652 if ( esOffset1 != -1 ) |
658 tivo->lastVideoPTS = get_ty_pts( | 653 tivo->lastVideoPTS = get_ty_pts( |
659 &chunk[ offset + esOffset1 + 9 ] ); | 654 &chunk[ offset + esOffset1 + 9 ] ); |
660 | 655 |
661 // Do NOT Pass the PES Header onto the MPEG2 Decode | 656 // Do NOT Pass the PES Header onto the MPEG2 Decode |
743 // ================================================ | 738 // ================================================ |
744 if ( nybbleType == 0x03 || nybbleType == 0x09 ) | 739 if ( nybbleType == 0x03 || nybbleType == 0x09 ) |
745 { | 740 { |
746 int esOffset1, esOffset2; | 741 int esOffset1, esOffset2; |
747 if ( nybbleType == 0x03 ) | 742 if ( nybbleType == 0x03 ) |
748 demux_ty_FindESHeader( ty_MPEGAudioPacket, 4, &chunk[ offset ], | 743 esOffset1 = demux_ty_FindESHeader( ty_MPEGAudioPacket, &chunk[ offset ], |
749 size, &esOffset1 ); | 744 size); |
750 | 745 |
751 // SA PES Header, No Audio Data | 746 // SA PES Header, No Audio Data |
752 // ================================================ | 747 // ================================================ |
753 if ( nybbleType == 0x03 && esOffset1 == 0 && size == 16 ) | 748 if ( nybbleType == 0x03 && esOffset1 == 0 && size == 16 ) |
754 { | 749 { |