]> git.sesse.net Git - vlc/blobdiff - modules/demux/nuv.c
MKV: fix metadata, by reading the spec
[vlc] / modules / demux / nuv.c
index 40b5aa0b1118dc2da698979d3f85d6f5fa274245..6a852b340184c934091cdf1bf6a7c35183d3748c 100644 (file)
@@ -208,7 +208,6 @@ static int Open( vlc_object_t * p_this )
     demux_sys_t *p_sys;
     const uint8_t *p_peek;
     frame_header_t fh;
-    bool  b_extended;
 
     /* Check id */
     if( stream_Peek( p_demux->s, &p_peek, 12 ) != 12 ||
@@ -270,8 +269,6 @@ static int Open( vlc_object_t * p_this )
         goto error;
     if( p_peek[0] == 'X' )
     {
-        b_extended = true;
-
         if( FrameHeaderLoad( p_demux, &fh ) )
             goto error;
         if( fh.i_length != 512 )
@@ -290,11 +287,9 @@ static int Open( vlc_object_t * p_this )
     }
     else
     {
-        b_extended = false;
-
         /* XXX: for now only file with extended chunk are supported
          * why: because else we need to have support for rtjpeg+stupid nuv shit */
-        msg_Err( p_demux, "incomplete NUV support (upload samples)" );
+        msg_Err( p_demux, "VLC doesn't support NUV without extended chunks (please upload samples)" );
         goto error;
     }
 
@@ -423,6 +418,8 @@ static int Demux( demux_t *p_demux )
         {
             /* for rtjpeg data, the header is also needed */
             p_data = block_Realloc( p_data, NUV_FH_SIZE, fh.i_length );
+            if( unlikely(!p_data) )
+                abort();
             memcpy( p_data->p_buffer, p_sys->fh_buffer, NUV_FH_SIZE );
         }
         /* 0,1,2,3 -> rtjpeg, >=4 mpeg4 */
@@ -772,8 +769,8 @@ static int SeekTableLoad( demux_t *p_demux, demux_sys_t *p_sys )
     const int32_t i_seek_elements = fh.i_length / 12;
 
     /* Get keyframe adjust offsets */
-    int32_t i_kfa_elements;
-    uint8_t *p_kfa_table;
+    int32_t i_kfa_elements = 0;
+    uint8_t *p_kfa_table = NULL;
 
     if( p_sys->exh.i_keyframe_adjust_offset > 0 )
     {
@@ -809,16 +806,7 @@ static int SeekTableLoad( demux_t *p_demux, demux_sys_t *p_sys )
 
             i_kfa_elements = fh.i_length / 8;
         }
-        else
-        {
-            i_kfa_elements = 0;
-        }
     }
-    else
-    {
-        i_kfa_elements = 0;
-    }
-
 
     if( i_kfa_elements > 0 )
         msg_Warn( p_demux, "untested keyframe adjust support, upload samples" );