Commit 60f3b3b6 authored by Laurent Aimar's avatar Laurent Aimar

Render subtitles (without osd) before taking a snapshot (close #378).

One side effect is that the snapshot is now taken using the picture that
will be displayed (chroma and resize filter applied).
parent 8def9bf2
...@@ -1981,7 +1981,7 @@ static int transcode_video_process( sout_stream_t *p_stream, ...@@ -1981,7 +1981,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
if( p_sys->p_spu ) if( p_sys->p_spu )
{ {
p_subpic = spu_SortSubpictures( p_sys->p_spu, p_pic->date, p_subpic = spu_SortSubpictures( p_sys->p_spu, p_pic->date,
false /* Fixme: check if stream is paused */ ); false /* Fixme: check if stream is paused */, false );
/* TODO: get another pic */ /* TODO: get another pic */
} }
...@@ -2525,7 +2525,7 @@ static int transcode_osd_process( sout_stream_t *p_stream, ...@@ -2525,7 +2525,7 @@ static int transcode_osd_process( sout_stream_t *p_stream,
/* Check if we have a subpicture to send */ /* Check if we have a subpicture to send */
if( p_sys->p_spu && in->i_dts > 0) if( p_sys->p_spu && in->i_dts > 0)
{ {
p_subpic = spu_SortSubpictures( p_sys->p_spu, in->i_dts, false ); p_subpic = spu_SortSubpictures( p_sys->p_spu, in->i_dts, false, false );
} }
else else
{ {
......
...@@ -960,11 +960,11 @@ static void* RunThread( vlc_object_t *p_this ) ...@@ -960,11 +960,11 @@ static void* RunThread( vlc_object_t *p_this )
p_filtered_picture = filter_chain_VideoFilter( p_vout->p_vf2_chain, p_filtered_picture = filter_chain_VideoFilter( p_vout->p_vf2_chain,
p_picture ); p_picture );
if( p_filtered_picture && p_vout->b_snapshot ) /* FIXME it is a bit ugly that b_snapshot is not locked but I do not
{ * know which lock to use (here and in the snapshot callback) */
const bool b_snapshot = p_vout->b_snapshot;
if( b_snapshot )
p_vout->b_snapshot = false; p_vout->b_snapshot = false;
vout_Snapshot( p_vout, p_filtered_picture );
}
/* /*
* Check for subpictures to display * Check for subpictures to display
...@@ -973,7 +973,8 @@ static void* RunThread( vlc_object_t *p_this ) ...@@ -973,7 +973,8 @@ static void* RunThread( vlc_object_t *p_this )
{ {
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT ); p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT );
p_subpic = spu_SortSubpictures( p_vout->p_spu, display_date, p_subpic = spu_SortSubpictures( p_vout->p_spu, display_date,
p_input ? var_GetBool( p_input, "state" ) == PAUSE_S : false ); p_input ? var_GetBool( p_input, "state" ) == PAUSE_S : false,
b_snapshot );
if( p_input ) if( p_input )
vlc_object_release( p_input ); vlc_object_release( p_input );
} }
...@@ -984,6 +985,12 @@ static void* RunThread( vlc_object_t *p_this ) ...@@ -984,6 +985,12 @@ static void* RunThread( vlc_object_t *p_this )
i_displayed++; i_displayed++;
p_directbuffer = vout_RenderPicture( p_vout, p_filtered_picture, p_subpic ); p_directbuffer = vout_RenderPicture( p_vout, p_filtered_picture, p_subpic );
/*
* Take a snapshot if requested
*/
if( p_directbuffer && b_snapshot )
vout_Snapshot( p_vout, p_directbuffer );
/* /*
* Call the plugin-specific rendering method if there is one * Call the plugin-specific rendering method if there is one
*/ */
......
...@@ -574,7 +574,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -574,7 +574,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
/* */ /* */
memset( &fmt_in, 0, sizeof(video_format_t) ); memset( &fmt_in, 0, sizeof(video_format_t) );
fmt_in = p_vout->fmt_in; fmt_in = p_vout->fmt_out;
if( fmt_in.i_sar_num <= 0 || fmt_in.i_sar_den <= 0 ) if( fmt_in.i_sar_num <= 0 || fmt_in.i_sar_den <= 0 )
{ {
fmt_in.i_sar_num = fmt_in.i_sar_num =
......
...@@ -1187,7 +1187,7 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, ...@@ -1187,7 +1187,7 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
* more difficult to guess if a subpicture has to be rendered or not. * more difficult to guess if a subpicture has to be rendered or not.
*****************************************************************************/ *****************************************************************************/
subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t display_date, subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t display_date,
bool b_paused ) bool b_paused, bool b_subtitle_only )
{ {
int i_index, i_channel; int i_index, i_channel;
subpicture_t *p_subpic = NULL; subpicture_t *p_subpic = NULL;
...@@ -1207,7 +1207,8 @@ subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t display_date, ...@@ -1207,7 +1207,8 @@ subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t display_date,
for( i_index = 0; i_index < VOUT_MAX_SUBPICTURES; i_index++ ) for( i_index = 0; i_index < VOUT_MAX_SUBPICTURES; i_index++ )
{ {
if( p_spu->p_subpicture[i_index].i_channel != i_channel || if( p_spu->p_subpicture[i_index].i_channel != i_channel ||
p_spu->p_subpicture[i_index].i_status != READY_SUBPICTURE ) p_spu->p_subpicture[i_index].i_status != READY_SUBPICTURE ||
( b_subtitle_only && !p_spu->p_subpicture[i_index].b_subtitle ) )
{ {
continue; continue;
} }
......
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