Commit ef801bc9 authored by Laurent Aimar's avatar Laurent Aimar

Fixed spu_RenderSubpictures prototype.

It now requires source format instead of scaling parameters.
parent 6d7931bf
......@@ -122,7 +122,14 @@ VLC_EXPORT( subpicture_region_t *,__spu_CreateRegion, ( vlc_object_t *, video_fo
#define spu_DestroyRegion(a,b) __spu_DestroyRegion(VLC_OBJECT(a),b)
VLC_EXPORT( void, __spu_DestroyRegion, ( vlc_object_t *, subpicture_region_t * ) );
VLC_EXPORT( subpicture_t *, spu_SortSubpictures, ( spu_t *, mtime_t display_date, bool b_paused, bool b_subtitle_only ) );
VLC_EXPORT( void, spu_RenderSubpictures, ( spu_t *, video_format_t *, picture_t *, subpicture_t *, int, int ) );
/**
* This function renders a list of subpicture_t on the provided picture.
*
* \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 ) );
/** @}*/
......
......@@ -1988,14 +1988,8 @@ static int transcode_video_process( sout_stream_t *p_stream,
/* Overlay subpicture */
if( p_subpic )
{
int i_scale_width, i_scale_height;
video_format_t fmt;
i_scale_width = id->p_encoder->fmt_in.video.i_width * 1000 /
id->p_decoder->fmt_out.video.i_width;
i_scale_height = id->p_encoder->fmt_in.video.i_height * 1000 /
id->p_decoder->fmt_out.video.i_height;
if( p_pic->i_refcount && !filter_chain_GetLength( id->p_f_chain ) )
{
/* We can't modify the picture, we need to duplicate it */
......@@ -2017,8 +2011,8 @@ static int transcode_video_process( sout_stream_t *p_stream,
fmt.i_sar_num = fmt.i_aspect * fmt.i_height / fmt.i_width;
fmt.i_sar_den = VOUT_ASPECT_FACTOR;
spu_RenderSubpictures( p_sys->p_spu, &fmt, p_pic, p_subpic,
i_scale_width, i_scale_height );
spu_RenderSubpictures( p_sys->p_spu, p_pic, &fmt,
p_subpic, &id->p_decoder->fmt_out.video );
}
/* Run user specified filter chain */
......
......@@ -320,21 +320,11 @@ static void vout_UnlockPicture( vout_thread_t *p_vout, picture_t *p_picture )
* before rendering, does the subpicture magic, and tells the video output
* thread which direct buffer needs to be displayed.
*/
picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
subpicture_t *p_subpic )
picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
subpicture_t *p_subpic )
{
int i_scale_width, i_scale_height;
if( p_pic == NULL )
{
/* XXX: subtitles */
return NULL;
}
i_scale_width = p_vout->fmt_out.i_visible_width * 1000 /
p_vout->fmt_in.i_visible_width;
i_scale_height = p_vout->fmt_out.i_visible_height * 1000 /
p_vout->fmt_in.i_visible_height;
if( p_pic->i_type == DIRECT_PICTURE )
{
......@@ -350,9 +340,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
vout_CopyPicture( p_vout, PP_OUTPUTPICTURE[0], p_pic );
spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
PP_OUTPUTPICTURE[0], p_subpic,
i_scale_width, i_scale_height );
spu_RenderSubpictures( p_vout->p_spu,
PP_OUTPUTPICTURE[0], &p_vout->fmt_out,
p_subpic, &p_vout->fmt_in );
vout_UnlockPicture( p_vout, PP_OUTPUTPICTURE[0] );
......@@ -377,9 +367,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
return NULL;
vout_CopyPicture( p_vout, PP_OUTPUTPICTURE[0], p_pic );
spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
PP_OUTPUTPICTURE[0],
p_subpic, i_scale_width, i_scale_height );
spu_RenderSubpictures( p_vout->p_spu,
PP_OUTPUTPICTURE[0], &p_vout->fmt_out,
p_subpic, &p_vout->fmt_in );
vout_UnlockPicture( p_vout, PP_OUTPUTPICTURE[0] );
......@@ -415,9 +405,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
p_vout->p_chroma->pf_video_filter( p_vout->p_chroma, p_pic );
/* Render subpictures on the first direct buffer */
spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
p_tmp_pic, p_subpic,
i_scale_width, i_scale_height );
spu_RenderSubpictures( p_vout->p_spu,
p_tmp_pic, &p_vout->fmt_out,
p_subpic, &p_vout->fmt_in );
if( vout_LockPicture( p_vout, &p_vout->p_picture[0] ) )
return NULL;
......@@ -434,9 +424,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
p_vout->p_chroma->pf_video_filter( p_vout->p_chroma, p_pic );
/* Render subpictures on the first direct buffer */
spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
&p_vout->p_picture[0],
p_subpic, i_scale_width, i_scale_height );
spu_RenderSubpictures( p_vout->p_spu,
&p_vout->p_picture[0], &p_vout->fmt_out,
p_subpic, &p_vout->fmt_in );
}
vout_UnlockPicture( p_vout, &p_vout->p_picture[0] );
......
......@@ -949,17 +949,16 @@ exit:
p_region->fmt = fmt_original;
}
void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt_a,
picture_t *p_pic_dst,
void spu_RenderSubpictures( spu_t *p_spu,
picture_t *p_pic_dst, video_format_t *p_fmt_dst,
subpicture_t *p_subpic_list,
int i_scale_width_orig, int i_scale_height_orig )
const video_format_t *p_fmt_src )
{
video_format_t fmt = *p_fmt_a, *p_fmt = &fmt;
video_format_t *p_fmt = p_fmt_dst;
const mtime_t i_current_date = mdate();
int i_source_video_width;
int i_source_video_height;
subpicture_t *p_subpic;
spu_scale_t scale_size_org;
/* Get lock */
vlc_mutex_lock( &p_spu->subpicture_lock );
......@@ -971,10 +970,8 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt_a,
return;
}
scale_size_org = spu_scale_create( i_scale_width_orig, i_scale_height_orig );
i_source_video_width = p_fmt->i_width * SCALE_UNIT / scale_size_org.w;
i_source_video_height = p_fmt->i_height * SCALE_UNIT / scale_size_org.h;
i_source_video_width = p_fmt_src->i_width;
i_source_video_height = p_fmt_src->i_height;
/* */
for( p_subpic = p_subpic_list;
......
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