From 894f901f69d1c8f51f3079ec02f0bbc86aba2bee Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Wed, 17 Sep 2008 00:01:11 +0200 Subject: [PATCH] Used const for video_format_t when possible. I have updated spu_RenderSubpictures and subpicture_region_t->pf_pre_render/pf_update_regions. --- include/vlc_osd.h | 2 +- include/vlc_vout.h | 6 ++--- modules/codec/csri.c | 16 ++++++----- modules/codec/libass.c | 14 +++++----- src/video_output/vout_subpictures.c | 41 +++++++++++++---------------- 5 files changed, 38 insertions(+), 41 deletions(-) diff --git a/include/vlc_osd.h b/include/vlc_osd.h index d704272066..54625ff559 100644 --- a/include/vlc_osd.h +++ b/include/vlc_osd.h @@ -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_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 ) ); /** @}*/ diff --git a/include/vlc_vout.h b/include/vlc_vout.h index 657f0aca97..5d39e1b554 100644 --- a/include/vlc_vout.h +++ b/include/vlc_vout.h @@ -370,9 +370,9 @@ struct subpicture_t video_format_t * ); void ( *pf_destroy_region ) ( vlc_object_t *, subpicture_region_t * ); - void ( *pf_pre_render ) ( video_format_t *, spu_t *, subpicture_t * ); - void ( *pf_update_regions ) ( video_format_t *, spu_t *, - subpicture_t *, mtime_t ); + void (*pf_pre_render) ( spu_t *, subpicture_t *, const video_format_t * ); + void (*pf_update_regions)( spu_t *, + subpicture_t *, const video_format_t *, mtime_t ); /** Private data - the subtitle plugin might want to put stuff here to * keep track of the subpicture */ diff --git a/modules/codec/csri.c b/modules/codec/csri.c index 3086d6d45e..6bc21f0068 100644 --- a/modules/codec/csri.c +++ b/modules/codec/csri.c @@ -62,9 +62,9 @@ vlc_module_end(); *****************************************************************************/ static subpicture_t *DecodeBlock( decoder_t *, block_t ** ); static void DestroySubpicture( subpicture_t * ); -static void PreRender( video_format_t *, spu_t *, subpicture_t * ); -static void UpdateRegions( video_format_t *, spu_t *, - subpicture_t *, mtime_t ); +static void PreRender( spu_t *, subpicture_t *, const video_format_t * ); +static void UpdateRegions( spu_t *, subpicture_t *, + const video_format_t *, mtime_t ); /***************************************************************************** * decoder_sys_t: decoder data @@ -231,15 +231,17 @@ static void DestroySubpicture( subpicture_t *p_subpic ) free( p_subpic->p_sys ); } -static void PreRender( video_format_t *p_fmt, spu_t *p_spu, - subpicture_t *p_subpic ) +static void PreRender( spu_t *p_spu, subpicture_t *p_subpic, + const video_format_t *p_fmt ) { decoder_t *p_dec = p_subpic->p_sys->p_dec; 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, - subpicture_t *p_subpic, mtime_t ts ) +static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic, + const video_format_t *p_fmt, mtime_t ts ) { decoder_t *p_dec = p_subpic->p_sys->p_dec; decoder_sys_t *p_sys = p_dec->p_sys; diff --git a/modules/codec/libass.c b/modules/codec/libass.c index 9b3ae70cef..74b5e10061 100644 --- a/modules/codec/libass.c +++ b/modules/codec/libass.c @@ -63,9 +63,9 @@ vlc_module_end(); *****************************************************************************/ static subpicture_t *DecodeBlock( decoder_t *, block_t ** ); static void DestroySubpicture( subpicture_t * ); -static void PreRender( video_format_t *, spu_t *, subpicture_t * ); -static void UpdateRegions( video_format_t *, spu_t *, - subpicture_t *, mtime_t ); +static void PreRender( spu_t *, subpicture_t *, const video_format_t * ); +static void UpdateRegions( spu_t *, + subpicture_t *, const video_format_t *, mtime_t ); /* Yes libass sux with threads */ typedef struct @@ -308,8 +308,8 @@ static void DestroySubpicture( subpicture_t *p_subpic ) free( p_subpic->p_sys ); } -static void PreRender( video_format_t *p_fmt, spu_t *p_spu, - subpicture_t *p_subpic ) +static void PreRender( spu_t *p_spu, subpicture_t *p_subpic, + const video_format_t *p_fmt ) { 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, VLC_UNUSED(p_spu); } -static void UpdateRegions( video_format_t *p_fmt, spu_t *p_spu, - subpicture_t *p_subpic, mtime_t i_ts ) +static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic, + const video_format_t *p_fmt, mtime_t i_ts ) { decoder_sys_t *p_sys = p_subpic->p_sys->p_dec_sys; ass_handle_t *p_ass = p_sys->p_ass; diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c index 5cff7dfb26..1add8d0d75 100644 --- a/src/video_output/vout_subpictures.c +++ b/src/video_output/vout_subpictures.c @@ -950,14 +950,14 @@ exit: } 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, 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(); - int i_source_video_width; - int i_source_video_height; + subpicture_t *p_subpic; /* Get lock */ @@ -970,8 +970,6 @@ void spu_RenderSubpictures( spu_t *p_spu, 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; @@ -980,26 +978,23 @@ void spu_RenderSubpictures( spu_t *p_spu, { /* */ 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 ) { - /* TODO do not reverse the scaling that was done before calling - * spu_RenderSubpictures, just pass it along (or do it inside - * spu_RenderSubpictures) */ - video_format_t fmt_org = *p_fmt; + video_format_t fmt_org = *p_fmt_dst; fmt_org.i_width = fmt_org.i_visible_width = i_source_video_width; fmt_org.i_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 */ 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 ) @@ -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, i_source_video_height, i_render_height ); - /* Update scaling from source size to display size(p_fmt) */ - scale.w = scale.w * p_fmt->i_width / i_source_video_width; - scale.h = scale.h * p_fmt->i_height / i_source_video_height; + /* Update scaling from source size to display size(p_fmt_dst) */ + scale.w = scale.w * p_fmt_dst->i_width / i_source_video_width; + scale.h = scale.h * p_fmt_dst->i_height / i_source_video_height; /* Set default subpicture aspect ratio * 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, } else { - p_region->fmt.i_sar_den = p_fmt->i_sar_den; - p_region->fmt.i_sar_num = p_fmt->i_sar_num; + p_region->fmt.i_sar_den = p_fmt_dst->i_sar_den; + p_region->fmt.i_sar_num = p_fmt_dst->i_sar_num; } } /* Take care of the aspect ratio */ - if( p_region->fmt.i_sar_num * p_fmt->i_sar_den != - p_region->fmt.i_sar_den * p_fmt->i_sar_num ) + if( p_region->fmt.i_sar_num * p_fmt_dst->i_sar_den != + p_region->fmt.i_sar_den * p_fmt_dst->i_sar_num ) { /* FIXME FIXME what about region->i_x/i_y ? */ scale.w = scale.w * - (int64_t)p_region->fmt.i_sar_num * p_fmt->i_sar_den / - p_region->fmt.i_sar_den / p_fmt->i_sar_num; + (int64_t)p_region->fmt.i_sar_num * p_fmt_dst->i_sar_den / + p_region->fmt.i_sar_den / p_fmt_dst->i_sar_num; } /* Render all regions */ @@ -1080,7 +1075,7 @@ void spu_RenderSubpictures( spu_t *p_spu, /* */ SpuRenderRegion( p_spu, p_pic_dst, p_subpic, p_region, - scale, p_fmt ); + scale, p_fmt_dst ); } } -- 2.39.2