From c4f35e50483d9a019cf8b665bb60a836071b96e0 Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Wed, 24 Sep 2008 23:42:06 +0200 Subject: [PATCH] Fixed SSA subtitles pause. I have modified spu_RenderSubpictures to take a b_paused argument. The calls to pf_pre_render/pf_update_regions could have been moved to spu_SortSubpicture and might have been cleaner BUT the way used keeps all time consumming tasks inside spu_RenderSubpictures. --- include/vlc_osd.h | 2 +- include/vlc_vout.h | 2 +- modules/stream_out/transcode.c | 2 +- src/video_output/video_output.c | 9 +++++---- src/video_output/vout_pictures.c | 10 +++++----- src/video_output/vout_subpictures.c | 6 +++--- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/include/vlc_osd.h b/include/vlc_osd.h index a385390541..cb78626c3d 100644 --- a/include/vlc_osd.h +++ b/include/vlc_osd.h @@ -120,7 +120,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 *, const 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, bool b_paused ) ); /** @}*/ diff --git a/include/vlc_vout.h b/include/vlc_vout.h index d5409b8969..584942fc33 100644 --- a/include/vlc_vout.h +++ b/include/vlc_vout.h @@ -703,7 +703,7 @@ VLC_EXPORT( void, vout_PlacePicture, ( vout_thread_t *, unsigned in /* DO NOT use vout_RenderPicture unless you are in src/video_ouput */ picture_t * vout_RenderPicture ( vout_thread_t *, picture_t *, - subpicture_t * ); + subpicture_t *, bool b_paused ); /* DO NOT use vout_CountPictureAvailable unless your are in src/input/dec.c (no exception) */ int vout_CountPictureAvailable( vout_thread_t * ); diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c index c00374bd14..7d1f7e260b 100644 --- a/modules/stream_out/transcode.c +++ b/modules/stream_out/transcode.c @@ -2012,7 +2012,7 @@ static int transcode_video_process( sout_stream_t *p_stream, fmt.i_sar_den = VOUT_ASPECT_FACTOR; spu_RenderSubpictures( p_sys->p_spu, p_pic, &fmt, - p_subpic, &id->p_decoder->fmt_out.video ); + p_subpic, &id->p_decoder->fmt_out.video, false ); } /* Run user specified filter chain */ diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index e845d6882f..0da340638f 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -970,21 +970,22 @@ static void* RunThread( vlc_object_t *p_this ) /* * Check for subpictures to display */ + bool b_paused = false; if( display_date > 0 ) { p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT ); - p_subpic = spu_SortSubpictures( p_vout->p_spu, display_date, - p_input ? var_GetInteger( p_input, "state" ) == PAUSE_S : false, - b_snapshot ); + b_paused = p_input && var_GetInteger( p_input, "state" ) == PAUSE_S; if( p_input ) vlc_object_release( p_input ); + + p_subpic = spu_SortSubpictures( p_vout->p_spu, display_date, b_paused, b_snapshot ); } /* * Perform rendering */ i_displayed++; - p_directbuffer = vout_RenderPicture( p_vout, p_filtered_picture, p_subpic ); + p_directbuffer = vout_RenderPicture( p_vout, p_filtered_picture, p_subpic, b_paused ); /* * Take a snapshot if requested diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c index 4373579a40..f1b4d8797e 100644 --- a/src/video_output/vout_pictures.c +++ b/src/video_output/vout_pictures.c @@ -321,7 +321,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 ) + subpicture_t *p_subpic, bool b_paused ) { if( p_pic == NULL ) return NULL; @@ -342,7 +342,7 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, spu_RenderSubpictures( p_vout->p_spu, PP_OUTPUTPICTURE[0], &p_vout->fmt_out, - p_subpic, &p_vout->fmt_in ); + p_subpic, &p_vout->fmt_in, b_paused ); vout_UnlockPicture( p_vout, PP_OUTPUTPICTURE[0] ); @@ -369,7 +369,7 @@ 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 ); + p_subpic, &p_vout->fmt_in, b_paused ); vout_UnlockPicture( p_vout, PP_OUTPUTPICTURE[0] ); @@ -407,7 +407,7 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *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 ); + p_subpic, &p_vout->fmt_in, b_paused ); if( vout_LockPicture( p_vout, &p_vout->p_picture[0] ) ) return NULL; @@ -426,7 +426,7 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *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 ); + p_subpic, &p_vout->fmt_in, b_paused ); } vout_UnlockPicture( p_vout, &p_vout->p_picture[0] ); diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c index f4b2ad544f..c497198db7 100644 --- a/src/video_output/vout_subpictures.c +++ b/src/video_output/vout_subpictures.c @@ -363,7 +363,7 @@ void spu_DisplaySubpicture( spu_t *p_spu, subpicture_t *p_subpic ) void spu_RenderSubpictures( spu_t *p_spu, picture_t *p_pic_dst, const video_format_t *p_fmt_dst, subpicture_t *p_subpic_list, - const video_format_t *p_fmt_src ) + const video_format_t *p_fmt_src, bool b_paused ) { spu_private_t *p_sys = p_spu->p; @@ -389,10 +389,10 @@ void spu_RenderSubpictures( spu_t *p_spu, p_subpic = p_subpic->p_next ) { /* */ - if( p_subpic->pf_pre_render ) + if( !b_paused && p_subpic->pf_pre_render ) p_subpic->pf_pre_render( p_spu, p_subpic, p_fmt_dst ); - if( p_subpic->pf_update_regions ) + if( !b_paused && p_subpic->pf_update_regions ) { video_format_t fmt_org = *p_fmt_dst; fmt_org.i_width = -- 2.39.2