]> git.sesse.net Git - vlc/blobdiff - modules/demux/ogg.c
ASF: help stupid compiler
[vlc] / modules / demux / ogg.c
index ea04ae7890ca971726065f4fc618b75ac9324e6d..e659b9cb00841d35a42f10dadc910fc9ad626273 100644 (file)
@@ -500,7 +500,7 @@ static void Ogg_UpdatePCR( logical_stream_t *p_stream,
               ( iframe << p_stream->i_granule_shift );
 
             p_stream->i_pcr = ( iframe + pframe - p_stream->i_keyframe_offset )
-             * INT64_C(1000000) / p_stream->f_rate;
+              * INT64_C(1000000) / p_stream->f_rate;
         }
         else if( p_stream->fmt.i_codec == VLC_CODEC_DIRAC )
         {
@@ -628,6 +628,7 @@ static void Ogg_DecodePacket( demux_t *p_demux,
             }
             else
             {
+#warning Memory leak
                 p_stream->i_headers = 0;
                 p_stream->p_headers = NULL;
                 free( p_org );
@@ -977,12 +978,12 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                 }
                 /* Check for Dirac header */
                 else if( ( oggpacket.bytes >= 5 &&
-                          ! memcmp( oggpacket.packet, "BBCD\x00", 5 ) ) ||
-                        ( oggpacket.bytes >= 9 &&
-                          ! memcmp( oggpacket.packet, "KW-DIRAC\x00", 9 ) ) )
-               {
-                   if( Ogg_ReadDiracHeader( p_stream, &oggpacket ) )
-                       msg_Dbg( p_demux, "found dirac header" );
+                           ! memcmp( oggpacket.packet, "BBCD\x00", 5 ) ) ||
+                         ( oggpacket.bytes >= 9 &&
+                           ! memcmp( oggpacket.packet, "KW-DIRAC\x00", 9 ) ) )
+                {
+                    if( Ogg_ReadDiracHeader( p_stream, &oggpacket ) )
+                        msg_Dbg( p_demux, "found dirac header" );
                     else
                     {
                         msg_Warn( p_demux, "found dirac header isn't decodable" );
@@ -1139,7 +1140,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                     }
                 }
                 else if( (*oggpacket.packet & PACKET_TYPE_BITS ) == PACKET_TYPE_HEADER &&
-                         oggpacket.bytes >= 56+1 )
+                         oggpacket.bytes >= 44+1 )
                 {
                     stream_header_t tmp;
                     stream_header_t *st = &tmp;
@@ -1154,7 +1155,8 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                     st->bits_per_sample = GetWLE( &oggpacket.packet[1+40] ); // (padding 2)
 
                     /* Check for video header (new format) */
-                    if( !strncmp( st->streamtype, "video", 5 ) )
+                    if( !strncmp( st->streamtype, "video", 5 ) &&
+                        oggpacket.bytes >= 52+1 )
                     {
                         st->sh.video.width = GetDWLE( &oggpacket.packet[1+44] );
                         st->sh.video.height = GetDWLE( &oggpacket.packet[1+48] );
@@ -1187,7 +1189,8 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                                  p_stream->fmt.video.i_bits_per_pixel );
                     }
                     /* Check for audio header (new format) */
-                    else if( !strncmp( st->streamtype, "audio", 5 ) )
+                    else if( !strncmp( st->streamtype, "audio", 5 ) &&
+                             oggpacket.bytes >= 56+1 )
                     {
                         char p_buffer[5];
                         int i_extra_size;
@@ -1834,7 +1837,7 @@ static void Ogg_ReadAnnodexHeader( vlc_object_t *p_this,
 
             p_stream->b_force_backup = 1;
         }
-        else if( !strncmp(content_type_string, "audio/x-speex", 14) )
+        else if( !strncmp(content_type_string, "audio/x-speex", 13) )
         {
             p_stream->fmt.i_cat = AUDIO_ES;
             p_stream->fmt.i_codec = VLC_CODEC_SPEEX;
@@ -1848,14 +1851,14 @@ static void Ogg_ReadAnnodexHeader( vlc_object_t *p_this,
 
             p_stream->b_force_backup = 1;
         }
-        else if( !strncmp(content_type_string, "video/x-xvid", 14) )
+        else if( !strncmp(content_type_string, "video/x-xvid", 12) )
         {
             p_stream->fmt.i_cat = VIDEO_ES;
             p_stream->fmt.i_codec = VLC_FOURCC( 'x','v','i','d' );
 
             p_stream->b_force_backup = 1;
         }
-        else if( !strncmp(content_type_string, "video/mpeg", 14) )
+        else if( !strncmp(content_type_string, "video/mpeg", 10) )
         {
             /* n.b. MPEG streams are unsupported right now */
             p_stream->fmt.i_cat = VIDEO_ES;