Commit 894f901f authored by Laurent Aimar's avatar Laurent Aimar

Used const for video_format_t when possible.

I have updated spu_RenderSubpictures and subpicture_region_t->pf_pre_render/pf_update_regions.
parent ef801bc9
...@@ -129,7 +129,7 @@ VLC_EXPORT( subpicture_t *, spu_SortSubpictures, ( spu_t *, mtime_t display_date ...@@ -129,7 +129,7 @@ VLC_EXPORT( subpicture_t *, spu_SortSubpictures, ( spu_t *, mtime_t display_date
* \param p_fmt_dst is the format of the destination picture. * \param p_fmt_dst is the format of the destination picture.
* \param p_fmt_src is the format of the original(source) video. * \param p_fmt_src is the format of the original(source) video.
*/ */
VLC_EXPORT( void, spu_RenderSubpictures, ( spu_t *, picture_t *, video_format_t *p_fmt_dst, subpicture_t *p_list, const video_format_t *p_fmt_src ) ); VLC_EXPORT( void, spu_RenderSubpictures, ( spu_t *, picture_t *, const video_format_t *p_fmt_dst, subpicture_t *p_list, const video_format_t *p_fmt_src ) );
/** @}*/ /** @}*/
......
...@@ -370,9 +370,9 @@ struct subpicture_t ...@@ -370,9 +370,9 @@ struct subpicture_t
video_format_t * ); video_format_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 * ); void (*pf_pre_render) ( spu_t *, subpicture_t *, const video_format_t * );
void ( *pf_update_regions ) ( video_format_t *, spu_t *, void (*pf_update_regions)( spu_t *,
subpicture_t *, mtime_t ); subpicture_t *, const video_format_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 * ); static void PreRender( spu_t *, subpicture_t *, const video_format_t * );
static void UpdateRegions( video_format_t *, spu_t *, static void UpdateRegions( spu_t *, subpicture_t *,
subpicture_t *, mtime_t ); const video_format_t *, mtime_t );
/***************************************************************************** /*****************************************************************************
* decoder_sys_t: decoder data * decoder_sys_t: decoder data
...@@ -231,15 +231,17 @@ static void DestroySubpicture( subpicture_t *p_subpic ) ...@@ -231,15 +231,17 @@ static void DestroySubpicture( subpicture_t *p_subpic )
free( p_subpic->p_sys ); free( p_subpic->p_sys );
} }
static void PreRender( video_format_t *p_fmt, spu_t *p_spu, static void PreRender( spu_t *p_spu, subpicture_t *p_subpic,
subpicture_t *p_subpic ) const video_format_t *p_fmt )
{ {
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;
VLC_UNUSED(p_fmt);
VLC_UNUSED(p_spu);
} }
static void UpdateRegions( video_format_t *p_fmt, spu_t *p_spu, static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
subpicture_t *p_subpic, mtime_t ts ) const video_format_t *p_fmt, 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;
......
...@@ -63,9 +63,9 @@ vlc_module_end(); ...@@ -63,9 +63,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 * ); static void PreRender( spu_t *, subpicture_t *, const video_format_t * );
static void UpdateRegions( video_format_t *, spu_t *, static void UpdateRegions( spu_t *,
subpicture_t *, mtime_t ); subpicture_t *, const video_format_t *, mtime_t );
/* Yes libass sux with threads */ /* Yes libass sux with threads */
typedef struct typedef struct
...@@ -308,8 +308,8 @@ static void DestroySubpicture( subpicture_t *p_subpic ) ...@@ -308,8 +308,8 @@ static void DestroySubpicture( subpicture_t *p_subpic )
free( p_subpic->p_sys ); free( p_subpic->p_sys );
} }
static void PreRender( video_format_t *p_fmt, spu_t *p_spu, static void PreRender( spu_t *p_spu, subpicture_t *p_subpic,
subpicture_t *p_subpic ) const video_format_t *p_fmt )
{ {
decoder_sys_t *p_dec_sys = p_subpic->p_sys->p_dec_sys; decoder_sys_t *p_dec_sys = p_subpic->p_sys->p_dec_sys;
...@@ -318,8 +318,8 @@ static void PreRender( video_format_t *p_fmt, spu_t *p_spu, ...@@ -318,8 +318,8 @@ static void PreRender( video_format_t *p_fmt, spu_t *p_spu,
VLC_UNUSED(p_spu); VLC_UNUSED(p_spu);
} }
static void UpdateRegions( video_format_t *p_fmt, spu_t *p_spu, static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
subpicture_t *p_subpic, mtime_t i_ts ) const video_format_t *p_fmt, mtime_t i_ts )
{ {
decoder_sys_t *p_sys = p_subpic->p_sys->p_dec_sys; decoder_sys_t *p_sys = p_subpic->p_sys->p_dec_sys;
ass_handle_t *p_ass = p_sys->p_ass; ass_handle_t *p_ass = p_sys->p_ass;
......
...@@ -950,14 +950,14 @@ exit: ...@@ -950,14 +950,14 @@ exit:
} }
void spu_RenderSubpictures( spu_t *p_spu, void spu_RenderSubpictures( spu_t *p_spu,
picture_t *p_pic_dst, video_format_t *p_fmt_dst, picture_t *p_pic_dst, const video_format_t *p_fmt_dst,
subpicture_t *p_subpic_list, subpicture_t *p_subpic_list,
const video_format_t *p_fmt_src ) const video_format_t *p_fmt_src )
{ {
video_format_t *p_fmt = p_fmt_dst; const int i_source_video_width = p_fmt_src->i_width;
const int i_source_video_height = p_fmt_src->i_height;
const mtime_t i_current_date = mdate(); const mtime_t i_current_date = mdate();
int i_source_video_width;
int i_source_video_height;
subpicture_t *p_subpic; subpicture_t *p_subpic;
/* Get lock */ /* Get lock */
...@@ -970,8 +970,6 @@ void spu_RenderSubpictures( spu_t *p_spu, ...@@ -970,8 +970,6 @@ void spu_RenderSubpictures( spu_t *p_spu,
return; return;
} }
i_source_video_width = p_fmt_src->i_width;
i_source_video_height = p_fmt_src->i_height;
/* */ /* */
for( p_subpic = p_subpic_list; for( p_subpic = p_subpic_list;
...@@ -980,26 +978,23 @@ void spu_RenderSubpictures( spu_t *p_spu, ...@@ -980,26 +978,23 @@ void spu_RenderSubpictures( spu_t *p_spu,
{ {
/* */ /* */
if( p_subpic->pf_pre_render ) if( p_subpic->pf_pre_render )
p_subpic->pf_pre_render( p_fmt, p_spu, p_subpic ); p_subpic->pf_pre_render( p_spu, p_subpic, p_fmt_dst );
if( p_subpic->pf_update_regions ) if( p_subpic->pf_update_regions )
{ {
/* TODO do not reverse the scaling that was done before calling video_format_t fmt_org = *p_fmt_dst;
* spu_RenderSubpictures, just pass it along (or do it inside
* spu_RenderSubpictures) */
video_format_t fmt_org = *p_fmt;
fmt_org.i_width = fmt_org.i_width =
fmt_org.i_visible_width = i_source_video_width; fmt_org.i_visible_width = i_source_video_width;
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->pf_update_regions( &fmt_org, p_spu, p_subpic, i_current_date ); p_subpic->pf_update_regions( p_spu, p_subpic, &fmt_org, i_current_date );
} }
} }
/* Create the blending module */ /* Create the blending module */
if( !p_spu->p_blend ) if( !p_spu->p_blend )
SpuRenderCreateBlend( p_spu, p_fmt->i_chroma, p_fmt->i_aspect ); SpuRenderCreateBlend( p_spu, p_fmt_dst->i_chroma, p_fmt_dst->i_aspect );
/* */ /* */
for( p_subpic = p_subpic_list; ; p_subpic = p_subpic->p_next ) for( p_subpic = p_subpic_list; ; p_subpic = p_subpic->p_next )
...@@ -1039,9 +1034,9 @@ void spu_RenderSubpictures( spu_t *p_spu, ...@@ -1039,9 +1034,9 @@ void spu_RenderSubpictures( spu_t *p_spu,
spu_scale_t scale = spu_scale_createq( i_source_video_width, i_render_width, spu_scale_t scale = spu_scale_createq( i_source_video_width, i_render_width,
i_source_video_height, i_render_height ); i_source_video_height, i_render_height );
/* Update scaling from source size to display size(p_fmt) */ /* Update scaling from source size to display size(p_fmt_dst) */
scale.w = scale.w * p_fmt->i_width / i_source_video_width; scale.w = scale.w * p_fmt_dst->i_width / i_source_video_width;
scale.h = scale.h * p_fmt->i_height / i_source_video_height; scale.h = scale.h * p_fmt_dst->i_height / i_source_video_height;
/* Set default subpicture aspect ratio /* Set default subpicture aspect ratio
* FIXME if we only handle 1 aspect ratio per picture, why is it set per * FIXME if we only handle 1 aspect ratio per picture, why is it set per
...@@ -1056,19 +1051,19 @@ void spu_RenderSubpictures( spu_t *p_spu, ...@@ -1056,19 +1051,19 @@ void spu_RenderSubpictures( spu_t *p_spu,
} }
else else
{ {
p_region->fmt.i_sar_den = p_fmt->i_sar_den; p_region->fmt.i_sar_den = p_fmt_dst->i_sar_den;
p_region->fmt.i_sar_num = p_fmt->i_sar_num; p_region->fmt.i_sar_num = p_fmt_dst->i_sar_num;
} }
} }
/* Take care of the aspect ratio */ /* Take care of the aspect ratio */
if( p_region->fmt.i_sar_num * p_fmt->i_sar_den != if( p_region->fmt.i_sar_num * p_fmt_dst->i_sar_den !=
p_region->fmt.i_sar_den * p_fmt->i_sar_num ) p_region->fmt.i_sar_den * p_fmt_dst->i_sar_num )
{ {
/* FIXME FIXME what about region->i_x/i_y ? */ /* FIXME FIXME what about region->i_x/i_y ? */
scale.w = scale.w * scale.w = scale.w *
(int64_t)p_region->fmt.i_sar_num * p_fmt->i_sar_den / (int64_t)p_region->fmt.i_sar_num * p_fmt_dst->i_sar_den /
p_region->fmt.i_sar_den / p_fmt->i_sar_num; p_region->fmt.i_sar_den / p_fmt_dst->i_sar_num;
} }
/* Render all regions */ /* Render all regions */
...@@ -1080,7 +1075,7 @@ void spu_RenderSubpictures( spu_t *p_spu, ...@@ -1080,7 +1075,7 @@ void spu_RenderSubpictures( spu_t *p_spu,
/* */ /* */
SpuRenderRegion( p_spu, p_pic_dst, p_subpic, p_region, SpuRenderRegion( p_spu, p_pic_dst, p_subpic, p_region,
scale, p_fmt ); scale, p_fmt_dst );
} }
} }
......
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