Commit a8daa86c authored by Laurent Aimar's avatar Laurent Aimar

Fixed various issue with SPU.

It is a manual backport of:
- [9b8c543c] Subtitles accuracy
- [9c462ffb] Ephemere destruction
- [fabf2399] Fixes for previous commits

It does not changes existing functions, but add 2 new ones.
parent bbf70d05
......@@ -113,6 +113,7 @@ VLC_EXPORT( void, spu_DisplaySubpicture, ( spu_t *, subpicture_t * ) );
* The returned list can only be used by spu_RenderSubpictures.
*/
VLC_EXPORT( subpicture_t *, spu_SortSubpictures, ( spu_t *, mtime_t display_date, bool b_paused, bool b_subtitle_only ) );
VLC_EXPORT( subpicture_t *, spu_SortSubpicturesNew, ( spu_t *, mtime_t render_subtitle_date, bool b_subtitle_only ) );
/**
* This function renders a list of subpicture_t on the provided picture.
......@@ -121,6 +122,7 @@ VLC_EXPORT( subpicture_t *, spu_SortSubpictures, ( spu_t *, mtime_t display_date
* \param p_fmt_src is the format of the original(source) video.
*/
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, bool b_paused ) );
VLC_EXPORT( void, spu_RenderSubpicturesNew, ( spu_t *, picture_t *, const video_format_t *p_fmt_dst, subpicture_t *p_list, const video_format_t *p_fmt_src, mtime_t render_subtitle_date ) );
/** @}*/
......
......@@ -1945,8 +1945,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
/* Check if we have a subpicture to overlay */
if( p_sys->p_spu )
{
p_subpic = spu_SortSubpictures( p_sys->p_spu, p_pic->date,
false /* Fixme: check if stream is paused */, false );
p_subpic = spu_SortSubpicturesNew( p_sys->p_spu, p_pic->date, false );
/* TODO: get another pic */
}
......@@ -1976,8 +1975,9 @@ 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, p_pic, &fmt,
p_subpic, &id->p_decoder->fmt_out.video, false );
/* FIXME the mdate() seems highly suspicious */
spu_RenderSubpicturesNew( p_sys->p_spu, p_pic, &fmt,
p_subpic, &id->p_decoder->fmt_out.video, mdate() );
}
/* Run user specified filter chain */
......@@ -2475,7 +2475,7 @@ static int transcode_osd_process( sout_stream_t *p_stream,
/* Check if we have a subpicture to send */
if( p_sys->p_spu && in->i_dts > 0)
{
p_subpic = spu_SortSubpictures( p_sys->p_spu, in->i_dts, false, false );
p_subpic = spu_SortSubpicturesNew( p_sys->p_spu, in->i_dts, false );
}
else
{
......
......@@ -182,7 +182,7 @@ libvlc_la_LIBADD = `$(VLC_CONFIG) -libs libvlc` \
libvlccore.la ../compat/libcompat.la
libvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags libvlc`
libvlc_la_LDFLAGS = $(AM_LDFLAGS) `$(VLC_CONFIG) --ldflags libvlc` \
-version-info 4:1:2 \
-version-info 5:0:3 \
-export-symbols $(srcdir)/libvlc.sym
libvlc_la_DEPENDENCIES = libvlc.sym libvlccore.la
if HAVE_WIN32
......
......@@ -350,7 +350,9 @@ spu_Destroy
spu_DisplaySubpicture
spu_Init
spu_RenderSubpictures
spu_RenderSubpicturesNew
spu_SortSubpictures
spu_SortSubpicturesNew
__stats_TimerClean
__stats_TimerDump
__stats_TimersCleanAll
......
......@@ -1183,17 +1183,24 @@ static void* RunThread( void *p_this )
/*
* Check for subpictures to display
*/
subpicture_t *p_subpic = NULL;
if( display_date > 0 )
p_subpic = spu_SortSubpictures( p_vout->p_spu, display_date,
p_vout->p->b_paused, b_snapshot );
mtime_t spu_render_time;
if( p_vout->p->b_paused )
spu_render_time = p_vout->p->i_pause_date;
else if( p_picture )
spu_render_time = p_picture->date > 1 ? p_picture->date : mdate();
else
spu_render_time = 0;
subpicture_t *p_subpic = spu_SortSubpicturesNew( p_vout->p_spu,
spu_render_time,
b_snapshot );
/*
* Perform rendering
*/
p_vout->p->i_picture_displayed++;
p_directbuffer = vout_RenderPicture( p_vout, p_filtered_picture,
p_subpic, p_vout->p->b_paused );
p_directbuffer = vout_RenderPicture( p_vout,
p_filtered_picture, p_subpic,
spu_render_time );
/*
* Take a snapshot if requested
......
......@@ -107,7 +107,8 @@ struct vout_thread_sys_t
/* DO NOT use vout_RenderPicture unless you are in src/video_ouput */
picture_t *vout_RenderPicture( vout_thread_t *, picture_t *,
subpicture_t *, bool b_paused );
subpicture_t *,
mtime_t render_date );
/* DO NOT use vout_UsePictureLocked unless you are in src/video_ouput
*
......
......@@ -333,7 +333,7 @@ static void vout_UnlockPicture( vout_thread_t *p_vout, picture_t *p_picture )
* 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, bool b_paused )
subpicture_t *p_subpic, mtime_t render_date )
{
if( p_pic == NULL )
return NULL;
......@@ -352,9 +352,9 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
picture_Copy( PP_OUTPUTPICTURE[0], p_pic );
spu_RenderSubpictures( p_vout->p_spu,
PP_OUTPUTPICTURE[0], &p_vout->fmt_out,
p_subpic, &p_vout->fmt_in, b_paused );
spu_RenderSubpicturesNew( p_vout->p_spu,
PP_OUTPUTPICTURE[0], &p_vout->fmt_out,
p_subpic, &p_vout->fmt_in, render_date );
vout_UnlockPicture( p_vout, PP_OUTPUTPICTURE[0] );
......@@ -379,9 +379,9 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
return NULL;
picture_Copy( PP_OUTPUTPICTURE[0], p_pic );
spu_RenderSubpictures( p_vout->p_spu,
PP_OUTPUTPICTURE[0], &p_vout->fmt_out,
p_subpic, &p_vout->fmt_in, b_paused );
spu_RenderSubpicturesNew( p_vout->p_spu,
PP_OUTPUTPICTURE[0], &p_vout->fmt_out,
p_subpic, &p_vout->fmt_in, render_date );
vout_UnlockPicture( p_vout, PP_OUTPUTPICTURE[0] );
......@@ -417,9 +417,9 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
p_vout->p->p_chroma->pf_video_filter( p_vout->p->p_chroma, p_pic );
/* Render subpictures on the first direct buffer */
spu_RenderSubpictures( p_vout->p_spu,
p_tmp_pic, &p_vout->fmt_out,
p_subpic, &p_vout->fmt_in, b_paused );
spu_RenderSubpicturesNew( p_vout->p_spu,
p_tmp_pic, &p_vout->fmt_out,
p_subpic, &p_vout->fmt_in, render_date );
if( vout_LockPicture( p_vout, &p_vout->p_picture[0] ) )
return NULL;
......@@ -436,9 +436,9 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
p_vout->p->p_chroma->pf_video_filter( p_vout->p->p_chroma, p_pic );
/* Render subpictures on the first direct buffer */
spu_RenderSubpictures( p_vout->p_spu,
&p_vout->p_picture[0], &p_vout->fmt_out,
p_subpic, &p_vout->fmt_in, b_paused );
spu_RenderSubpicturesNew( p_vout->p_spu,
&p_vout->p_picture[0], &p_vout->fmt_out,
p_subpic, &p_vout->fmt_in, render_date );
}
vout_UnlockPicture( p_vout, &p_vout->p_picture[0] );
......
This diff is collapsed.
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