]> git.sesse.net Git - vlc/blobdiff - modules/demux/real.c
Qt4: Tell the window manager to keep the fullscreen controller window on top.
[vlc] / modules / demux / real.c
index 720528dc810d2235d9637223a95dfa07b97c7fba..3ba0a8653b29ec0031e77d557d79c603cc77be2a 100644 (file)
@@ -251,11 +251,8 @@ static void Close( vlc_object_t *p_this )
             if( tk->p_subpackets[ j ] )
                 block_Release( tk->p_subpackets[ j ] );
         }
-        if( tk->i_subpackets )
-        {
-            free( tk->p_subpackets );
-            free( tk->p_subpackets_timecode );
-        }
+        free( tk->p_subpackets );
+        free( tk->p_subpackets_timecode );
         if( tk->p_sipr_packet )
             block_Release( tk->p_sipr_packet );
         free( tk );
@@ -636,6 +633,11 @@ static void DemuxAudioMethod1( demux_t *p_demux, real_track_t *tk, mtime_t i_pts
 
         for( int i = 0; i < i_num; i++ )
         {
+            int i_index = tk->i_subpacket_h * i +
+                          ((tk->i_subpacket_h + 1) / 2) * (y&1) + (y>>1);
+            if( i_index >= tk->i_subpackets )
+                return;
+
             block_t *p_block = block_New( p_demux, tk->i_subpacket_size );
             if( !p_block )
                 return;
@@ -648,9 +650,6 @@ static void DemuxAudioMethod1( demux_t *p_demux, real_track_t *tk, mtime_t i_pts
 
             p_buf += tk->i_subpacket_size;
 
-            int i_index = tk->i_subpacket_h * i +
-                          ((tk->i_subpacket_h + 1) / 2) * (y&1) + (y>>1);
-
             if( tk->p_subpackets[i_index] != NULL )
             {
                 msg_Dbg(p_demux, "p_subpackets[ %d ] not null!",  i_index );
@@ -670,14 +669,16 @@ static void DemuxAudioMethod1( demux_t *p_demux, real_track_t *tk, mtime_t i_pts
 
         for( int i = 0; i < tk->i_subpacket_h / 2; i++ )
         {
+            int i_index = (i * 2 * tk->i_frame_size / tk->i_coded_frame_size) + y;
+            if( i_index >= tk->i_subpackets )
+                return;
+
             block_t *p_block = block_New( p_demux, tk->i_coded_frame_size);
             if( !p_block )
                 return;
             if( &p_buf[tk->i_coded_frame_size] > &p_sys->buffer[p_sys->i_buffer] )
                 return;
 
-            int i_index = (i * 2 * tk->i_frame_size / tk->i_coded_frame_size) + y;
-
             memcpy( p_block->p_buffer, p_buf, tk->i_coded_frame_size );
             p_block->i_dts =
             p_block->i_pts = i_index == 0 ? i_pts : VLC_TS_INVALID;
@@ -1481,7 +1482,10 @@ static int CodecAudioParse( demux_t *p_demux, int i_tk_id, const uint8_t *p_data
         i_frame_size = R16( &p_data, &i_data );
         i_subpacket_size = R16( &p_data, &i_data );
         if( !i_frame_size || !i_coded_frame_size )
+        {
+            es_format_Clean( &fmt );
             return VLC_EGENERIC;
+        }
 
         RVoid( &p_data, &i_data, 2 + (i_version == 5 ? 6 : 0 ) );
 
@@ -1536,6 +1540,11 @@ static int CodecAudioParse( demux_t *p_demux, int i_tk_id, const uint8_t *p_data
         break;
 
     case VLC_FOURCC('2','8','_','8'):
+        if( i_coded_frame_size <= 0 )
+        {
+            es_format_Clean( &fmt );
+            return VLC_EGENERIC;
+        }
         fmt.i_codec = VLC_CODEC_RA_288;
         fmt.audio.i_blockalign = i_coded_frame_size;
         break;
@@ -1568,7 +1577,11 @@ static int CodecAudioParse( demux_t *p_demux, int i_tk_id, const uint8_t *p_data
     case VLC_FOURCC( 's','i','p','r' ):
         fmt.i_codec = VLC_CODEC_SIPR;
         if( i_flavor > 3 )
+        {
+            msg_Dbg( p_demux, "    - unsupported sipr flavorc=%i", i_flavor );
+            es_format_Clean( &fmt );
             return VLC_EGENERIC;
+        }
 
         i_subpacket_size = i_subpacket_size_sipr[i_flavor];
         // The libavcodec sipr decoder requires stream bitrate
@@ -1607,13 +1620,11 @@ static int CodecAudioParse( demux_t *p_demux, int i_tk_id, const uint8_t *p_data
         break;
 
     case VLC_FOURCC('r','a','l','f'):
-        msg_Dbg( p_demux, "    - audio codec not supported=%4.4s",
-                 (char*)&fmt.i_codec );
-        break;
-
     default:
         msg_Dbg( p_demux, "    - unknown audio codec=%4.4s",
-                 (char*)&fmt.i_codec );
+                (char*)&fmt.i_codec );
+        es_format_Clean( &fmt );
+        return VLC_EGENERIC;
         break;
     }
     msg_Dbg( p_demux, "    - extra data=%d", fmt.i_extra );