Commit 6d7931bf authored by Laurent Aimar's avatar Laurent Aimar

Clean up subpicture code.

parent 8fa5e87a
...@@ -67,12 +67,6 @@ struct filter_owner_sys_t ...@@ -67,12 +67,6 @@ struct filter_owner_sys_t
int i_channel; int i_channel;
}; };
enum {
SCALE_DEFAULT,
SCALE_TEXT,
SCALE_SIZE
};
#define SCALE_UNIT (1000) #define SCALE_UNIT (1000)
/* */ /* */
...@@ -1342,15 +1336,17 @@ static void sub_del_buffer( filter_t *p_filter, subpicture_t *p_subpic ) ...@@ -1342,15 +1336,17 @@ static void sub_del_buffer( filter_t *p_filter, subpicture_t *p_subpic )
static subpicture_t *spu_new_buffer( filter_t *p_filter ) static subpicture_t *spu_new_buffer( filter_t *p_filter )
{ {
(void)p_filter; subpicture_t *p_subpic = calloc( 1, sizeof(subpicture_t) );
subpicture_t *p_subpic = (subpicture_t *)malloc(sizeof(subpicture_t)); if( !p_subpic )
if( !p_subpic ) return NULL; return NULL;
memset( p_subpic, 0, sizeof(subpicture_t) );
p_subpic->b_absolute = true; p_subpic->b_absolute = true;
p_subpic->i_alpha = 0xFF;
p_subpic->pf_create_region = __spu_CreateRegion; p_subpic->pf_create_region = __spu_CreateRegion;
p_subpic->pf_destroy_region = __spu_DestroyRegion; p_subpic->pf_destroy_region = __spu_DestroyRegion;
VLC_UNUSED(p_filter);
return p_subpic; return p_subpic;
} }
...@@ -1368,41 +1364,27 @@ static void spu_del_buffer( filter_t *p_filter, subpicture_t *p_subpic ) ...@@ -1368,41 +1364,27 @@ static void spu_del_buffer( filter_t *p_filter, subpicture_t *p_subpic )
static picture_t *spu_new_video_buffer( filter_t *p_filter ) static picture_t *spu_new_video_buffer( filter_t *p_filter )
{ {
picture_t *p_picture = malloc( sizeof(picture_t) ); const video_format_t *p_fmt = &p_filter->fmt_out.video;
if( !p_picture ) return NULL;
if( vout_AllocatePicture( p_filter, p_picture,
p_filter->fmt_out.video.i_chroma,
p_filter->fmt_out.video.i_width,
p_filter->fmt_out.video.i_height,
p_filter->fmt_out.video.i_aspect )
!= VLC_SUCCESS )
{
free( p_picture );
return NULL;
}
p_picture->pf_release = RegionPictureRelease;
return p_picture; VLC_UNUSED(p_filter);
return picture_New( p_fmt->i_chroma,
p_fmt->i_width, p_fmt->i_height, p_fmt->i_aspect );
} }
static void spu_del_video_buffer( filter_t *p_filter, picture_t *p_pic ) static void spu_del_video_buffer( filter_t *p_filter, picture_t *p_picture )
{ {
(void)p_filter; VLC_UNUSED(p_filter);
if( p_pic ) picture_Release( p_picture );
{
free( p_pic->p_data_orig );
free( p_pic );
}
} }
static int SubFilterCallback( vlc_object_t *p_object, char const *psz_var, static int SubFilterCallback( vlc_object_t *p_object, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *p_data ) vlc_value_t oldval, vlc_value_t newval, void *p_data )
{ {
spu_t *p_spu = p_data;
VLC_UNUSED(p_object); VLC_UNUSED(oldval); VLC_UNUSED(p_object); VLC_UNUSED(oldval);
VLC_UNUSED(newval); VLC_UNUSED(psz_var); VLC_UNUSED(newval); VLC_UNUSED(psz_var);
spu_t *p_spu = (spu_t *)p_data;
vlc_mutex_lock( &p_spu->subpicture_lock ); vlc_mutex_lock( &p_spu->subpicture_lock );
filter_chain_Reset( p_spu->p_chain, NULL, NULL ); filter_chain_Reset( p_spu->p_chain, NULL, NULL );
spu_ParseChain( p_spu ); spu_ParseChain( p_spu );
...@@ -1412,14 +1394,15 @@ static int SubFilterCallback( vlc_object_t *p_object, char const *psz_var, ...@@ -1412,14 +1394,15 @@ static int SubFilterCallback( vlc_object_t *p_object, char const *psz_var,
static int SubFilterAllocationInit( filter_t *p_filter, void *p_data ) static int SubFilterAllocationInit( filter_t *p_filter, void *p_data )
{ {
spu_t *p_spu = (spu_t *)p_data; spu_t *p_spu = p_data;
filter_owner_sys_t *p_sys = malloc( sizeof(filter_owner_sys_t) );
if( !p_sys )
return VLC_EGENERIC;
p_filter->pf_sub_buffer_new = sub_new_buffer; p_filter->pf_sub_buffer_new = sub_new_buffer;
p_filter->pf_sub_buffer_del = sub_del_buffer; p_filter->pf_sub_buffer_del = sub_del_buffer;
filter_owner_sys_t *p_sys = malloc( sizeof(filter_owner_sys_t) );
if( !p_sys ) return VLC_EGENERIC;
p_filter->p_owner = p_sys; p_filter->p_owner = p_sys;
spu_Control( p_spu, SPU_CHANNEL_REGISTER, &p_sys->i_channel ); spu_Control( p_spu, SPU_CHANNEL_REGISTER, &p_sys->i_channel );
p_sys->p_spu = p_spu; p_sys->p_spu = p_spu;
...@@ -1430,6 +1413,7 @@ static int SubFilterAllocationInit( filter_t *p_filter, void *p_data ) ...@@ -1430,6 +1413,7 @@ static int SubFilterAllocationInit( filter_t *p_filter, void *p_data )
static void SubFilterAllocationClean( filter_t *p_filter ) static void SubFilterAllocationClean( filter_t *p_filter )
{ {
filter_owner_sys_t *p_sys = p_filter->p_owner; filter_owner_sys_t *p_sys = p_filter->p_owner;
SpuClearChannel( p_sys->p_spu, p_sys->i_channel, true ); SpuClearChannel( p_sys->p_spu, p_sys->i_channel, true );
free( p_filter->p_owner ); free( p_filter->p_owner );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment