]> git.sesse.net Git - vlc/blobdiff - modules/codec/csri.c
XCB: Factor picture allocation
[vlc] / modules / codec / csri.c
index 61ae9f4cffb98928c131ec4ad9ca84e9f0b8611b..3802f4a3322a7d95d9f0e65125257f1830fa770c 100644 (file)
 static int  Create ( vlc_object_t * );
 static void Destroy( vlc_object_t * );
 
-vlc_module_begin();
-    set_shortname( N_("Subtitles (advanced)"));
-    set_description( N_("Wrapper for subtitle renderers using CSRI/asa") );
-    set_capability( "decoder", 60 );
-    set_category( CAT_INPUT );
-    set_subcategory( SUBCAT_INPUT_SCODEC );
-    set_callbacks( Create, Destroy );
-vlc_module_end();
+vlc_module_begin ()
+    set_shortname( N_("Subtitles (advanced)"))
+    set_description( N_("Wrapper for subtitle renderers using CSRI/asa") )
+    set_capability( "decoder", 60 )
+    set_category( CAT_INPUT )
+    set_subcategory( SUBCAT_INPUT_SCODEC )
+    set_callbacks( Create, Destroy )
+vlc_module_end ()
 
 /*****************************************************************************
  * Local prototypes
@@ -120,10 +120,9 @@ static int Create( vlc_object_t *p_this )
 
     p_dec->pf_decode_sub = DecodeBlock;
 
-    p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
+    p_dec->p_sys = p_sys = calloc( 1, sizeof( decoder_sys_t ) );
     if( !p_sys )
         return VLC_ENOMEM;
-    memset( &p_sys->fmt_cached, 0, sizeof( p_sys->fmt_cached ) );
 
     p_sys->p_stream_ext = p_stream_ext;
     p_sys->pf_push_packet = p_stream_ext->push_packet;
@@ -131,6 +130,9 @@ static int Create( vlc_object_t *p_this )
                                                    p_dec->fmt_in.p_extra,
                                                    p_dec->fmt_in.p_extra ? strnlen( p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra ) : 0,
                                                    NULL);
+    p_dec->fmt_out.i_cat = SPU_ES;
+    p_dec->fmt_out.i_codec = VLC_FOURCC('R','G','B','A');
+
     return VLC_SUCCESS;
 }
 
@@ -174,7 +176,7 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         return NULL;
     }
 
-    p_spu = p_dec->pf_spu_buffer_new( p_dec );
+    p_spu = decoder_NewSubpicture( p_dec );
     if( !p_spu )
     {
         msg_Warn( p_dec, "can't get spu buffer" );
@@ -185,7 +187,7 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     p_spu->p_sys = malloc( sizeof( subpicture_sys_t ));
     if( !p_spu->p_sys )
     {
-        p_dec->pf_spu_buffer_del( p_dec, p_spu );
+        decoder_DeleteSubpicture( p_dec, p_spu );
         block_Release( p_block );
         return NULL;
     }
@@ -196,7 +198,7 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     if( !p_spu->p_sys->p_subs_data )
     {
         free( p_spu->p_sys );
-        p_dec->pf_spu_buffer_del( p_dec, p_spu );
+        decoder_DeleteSubpicture( p_dec, p_spu );
         block_Release( p_block );
         return NULL;
     }