]> git.sesse.net Git - vlc/blobdiff - modules/packetizer/vc1.c
Use var_Inherit* instead of var_CreateGet*.
[vlc] / modules / packetizer / vc1.c
index 7cbc47dc6abb459f3f12c8a437aafc3438cc349a..e3c7daa0942c3386418136f193a0d046715f5d85 100644 (file)
 # include "config.h"
 #endif
 
-#include <assert.h>
-
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
 #include <vlc_block.h>
-#include <vlc_memory.h>
 
 #include <vlc_bits.h>
 #include <vlc_block_helper.h>
@@ -141,11 +138,12 @@ static int Open( vlc_object_t *p_this )
     /* Create the output format */
     es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
     p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
-    assert( p_sys );
+    if( unlikely( !p_sys ) )
+        return VLC_ENOMEM;
 
     packetizer_Init( &p_sys->packetizer,
                      p_vc1_startcode, sizeof(p_vc1_startcode),
-                     NULL, 0,
+                     NULL, 0, 4,
                      PacketizeReset, PacketizeParse, PacketizeValidate, p_dec );
 
     p_sys->b_sequence_header = false;
@@ -313,8 +311,7 @@ static void BuildExtraData( decoder_t *p_dec )
     if( p_es->i_extra != i_extra )
     {
         p_es->i_extra = i_extra;
-        p_es->p_extra = realloc_or_free( p_es->p_extra, p_es->i_extra );
-        assert( p_es->p_extra );
+        p_es->p_extra = xrealloc( p_es->p_extra, p_es->i_extra );
     }
     memcpy( p_es->p_extra,
             p_sys->sh.p_sh->p_buffer, p_sys->sh.p_sh->i_buffer );
@@ -495,7 +492,8 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_used_ts, block_t *p_frag )
                 const int i_display_width  = bs_read( &s, 14 )+1;
                 const int i_display_height = bs_read( &s, 14 )+1;
 
-                p_es->video.i_aspect = VOUT_ASPECT_FACTOR * i_display_width / i_display_height;
+                p_es->video.i_sar_num = i_display_width  * p_es->video.i_height;
+                p_es->video.i_sar_den = i_display_height * p_es->video.i_width;
 
                 if( !p_sys->b_sequence_header )
                     msg_Dbg( p_dec, "display size %dx%d", i_display_width, i_display_height );