changeset 24478:43c9c72b8c54

Simplify demux_ty_FindESHeader
author reimar
date Fri, 14 Sep 2007 19:53:09 +0000
parents 8c9d86adb28e
children 6fb4555fba27
files libmpdemux/demux_ty.c
diffstat 1 files changed, 7 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_ty.c	Fri Sep 14 19:46:54 2007 +0000
+++ b/libmpdemux/demux_ty.c	Fri Sep 14 19:53:09 2007 +0000
@@ -359,22 +359,17 @@
 			tivo->firstAudioPTS = pts;
 }
 
-static int demux_ty_FindESHeader( unsigned char *header, int headerSize, 
-   unsigned char *buffer, int bufferSize, int *esOffset1 )
+static int demux_ty_FindESHeader( unsigned char *header,
+   unsigned char *buffer, int bufferSize )
 {
    int count;
-
-   *esOffset1 = -1;
    for( count = 0 ; count < bufferSize ; count++ )
    {
       if ( buffer[ count + 0 ] == header[ 0 ] &&
            buffer[ count + 1 ] == header[ 1 ] &&
            buffer[ count + 2 ] == header[ 2 ] &&
            buffer[ count + 3 ] == header[ 3 ] )
-      {
-         *esOffset1 = count;
-         return 1;
-      }
+         return count;
    }
    return -1;
 }
@@ -652,8 +647,8 @@
             }
             printf( "\n" );
 #endif
-            demux_ty_FindESHeader( ty_VideoPacket, 4, &chunk[ offset ], 
-               size, &esOffset1 );
+            esOffset1 = demux_ty_FindESHeader( ty_VideoPacket, &chunk[ offset ], 
+               size);
             if ( esOffset1 != -1 )
                tivo->lastVideoPTS = get_ty_pts( 
                   &chunk[ offset + esOffset1 + 9 ] );
@@ -745,8 +740,8 @@
             {
                int esOffset1, esOffset2;
                if ( nybbleType == 0x03 )
-               demux_ty_FindESHeader( ty_MPEGAudioPacket, 4, &chunk[ offset ], 
-                  size, &esOffset1 );
+               esOffset1 = demux_ty_FindESHeader( ty_MPEGAudioPacket, &chunk[ offset ], 
+                  size);
 
                // SA PES Header, No Audio Data
                // ================================================