Commit 8152480b authored by Laurent Aimar's avatar Laurent Aimar

Clean up pf_pre_render prototype (btw, this function seems useless).

Change pf_update_regions scheme by not destroying regions before calling
it(codec using them may now avoid redrawing not changed subs).
parent 856ba664
...@@ -351,9 +351,9 @@ struct subpicture_t ...@@ -351,9 +351,9 @@ struct subpicture_t
video_format_t *, picture_t * ); video_format_t *, picture_t * );
void ( *pf_destroy_region ) ( vlc_object_t *, subpicture_region_t * ); void ( *pf_destroy_region ) ( vlc_object_t *, subpicture_region_t * );
void ( *pf_pre_render ) ( video_format_t *, spu_t *, subpicture_t *, mtime_t ); void ( *pf_pre_render ) ( video_format_t *, spu_t *, subpicture_t * );
subpicture_region_t * ( *pf_update_regions ) ( video_format_t *, spu_t *, void ( *pf_update_regions ) ( video_format_t *, spu_t *,
subpicture_t *, mtime_t ); subpicture_t *, mtime_t );
/** Private data - the subtitle plugin might want to put stuff here to /** Private data - the subtitle plugin might want to put stuff here to
* keep track of the subpicture */ * keep track of the subpicture */
......
...@@ -62,9 +62,9 @@ vlc_module_end(); ...@@ -62,9 +62,9 @@ vlc_module_end();
*****************************************************************************/ *****************************************************************************/
static subpicture_t *DecodeBlock( decoder_t *, block_t ** ); static subpicture_t *DecodeBlock( decoder_t *, block_t ** );
static void DestroySubpicture( subpicture_t * ); static void DestroySubpicture( subpicture_t * );
static void PreRender( video_format_t *, spu_t *, subpicture_t *, mtime_t ); static void PreRender( video_format_t *, spu_t *, subpicture_t * );
static subpicture_region_t *UpdateRegions( video_format_t *, spu_t *, static void UpdateRegions( video_format_t *, spu_t *,
subpicture_t *, mtime_t ); subpicture_t *, mtime_t );
/***************************************************************************** /*****************************************************************************
* decoder_sys_t: decoder data * decoder_sys_t: decoder data
...@@ -235,14 +235,14 @@ static void DestroySubpicture( subpicture_t *p_subpic ) ...@@ -235,14 +235,14 @@ static void DestroySubpicture( subpicture_t *p_subpic )
} }
static void PreRender( video_format_t *p_fmt, spu_t *p_spu, static void PreRender( video_format_t *p_fmt, spu_t *p_spu,
subpicture_t *p_subpic, mtime_t ts ) subpicture_t *p_subpic )
{ {
decoder_t *p_dec = p_subpic->p_sys->p_dec; decoder_t *p_dec = p_subpic->p_sys->p_dec;
p_dec->p_sys->p_spu_final = p_subpic; p_dec->p_sys->p_spu_final = p_subpic;
} }
static subpicture_region_t *UpdateRegions( video_format_t *p_fmt, spu_t *p_spu, static void UpdateRegions( video_format_t *p_fmt, spu_t *p_spu,
subpicture_t *p_subpic, mtime_t ts ) subpicture_t *p_subpic, mtime_t ts )
{ {
decoder_t *p_dec = p_subpic->p_sys->p_dec; decoder_t *p_dec = p_subpic->p_sys->p_dec;
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
...@@ -250,8 +250,18 @@ static subpicture_region_t *UpdateRegions( video_format_t *p_fmt, spu_t *p_spu, ...@@ -250,8 +250,18 @@ static subpicture_region_t *UpdateRegions( video_format_t *p_fmt, spu_t *p_spu,
subpicture_region_t *p_spu_region; subpicture_region_t *p_spu_region;
video_format_t fmt; video_format_t fmt;
/* TODO maybe checking if we really need redrawing */
while( p_subpic->p_region )
{
subpicture_region_t *p_region = p_subpic->p_region;
p_subpic->p_region = p_region->p_next;
spu_DestroyRegion( p_spu, p_region );
}
p_subpic->p_region = NULL;
/* FIXME check why this is needed */
if( p_subpic != p_sys->p_spu_final ) if( p_subpic != p_sys->p_spu_final )
return NULL; return;
#if 0 #if 0
msg_Warn( p_dec, "---- fmt: %dx%d %dx%d chroma=%4.4s", msg_Warn( p_dec, "---- fmt: %dx%d %dx%d chroma=%4.4s",
...@@ -288,7 +298,7 @@ static subpicture_region_t *UpdateRegions( video_format_t *p_fmt, spu_t *p_spu, ...@@ -288,7 +298,7 @@ static subpicture_region_t *UpdateRegions( video_format_t *p_fmt, spu_t *p_spu,
p_subpic->i_original_picture_height = fmt.i_height; p_subpic->i_original_picture_height = fmt.i_height;
p_subpic->i_original_picture_width = fmt.i_width; p_subpic->i_original_picture_width = fmt.i_width;
p_spu_region = p_subpic->pf_create_region( VLC_OBJECT(p_dec), &fmt ); p_spu_region = p_subpic->p_region = p_subpic->pf_create_region( VLC_OBJECT(p_dec), &fmt );
if( p_spu_region ) if( p_spu_region )
{ {
...@@ -306,6 +316,5 @@ static subpicture_region_t *UpdateRegions( video_format_t *p_fmt, spu_t *p_spu, ...@@ -306,6 +316,5 @@ static subpicture_region_t *UpdateRegions( video_format_t *p_fmt, spu_t *p_spu,
csri_frame.strides[0] = p_spu_region->picture.Y_PITCH; csri_frame.strides[0] = p_spu_region->picture.Y_PITCH;
csri_render( p_sys->p_instance, &csri_frame, ts * 0.000001 ); csri_render( p_sys->p_instance, &csri_frame, ts * 0.000001 );
} }
return p_spu_region;
} }
...@@ -959,9 +959,7 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, ...@@ -959,9 +959,7 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
p_subpic_v = p_subpic_v->p_next ) p_subpic_v = p_subpic_v->p_next )
{ {
if( p_subpic_v->pf_pre_render ) if( p_subpic_v->pf_pre_render )
{ p_subpic_v->pf_pre_render( p_fmt, p_spu, p_subpic_v );
p_subpic_v->pf_pre_render( p_fmt, p_spu, p_subpic_v, mdate() );
}
} }
if( i_scale_width_orig <= 0 ) if( i_scale_width_orig <= 0 )
...@@ -998,13 +996,6 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, ...@@ -998,13 +996,6 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
if( p_subpic->pf_update_regions ) if( p_subpic->pf_update_regions )
{ {
while( p_subpic->p_region )
{
subpicture_region_t *p_region = p_subpic->p_region;
p_subpic->p_region = p_region->p_next;
spu_DestroyRegion( p_spu, p_region );
}
/* TODO do not reverse the scaling that was done before calling /* TODO do not reverse the scaling that was done before calling
* spu_RenderSubpictures, just pass it along (or do it inside * spu_RenderSubpictures, just pass it along (or do it inside
* spu_RenderSubpictures) */ * spu_RenderSubpictures) */
...@@ -1014,7 +1005,7 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, ...@@ -1014,7 +1005,7 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
fmt_org.i_height = fmt_org.i_height =
fmt_org.i_visible_height = i_source_video_height; fmt_org.i_visible_height = i_source_video_height;
p_subpic->p_region = p_subpic->pf_update_regions( &fmt_org, p_spu, p_subpic, mdate() ); p_subpic->pf_update_regions( &fmt_org, p_spu, p_subpic, mdate() );
} }
/* */ /* */
......
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