[vlc-devel] commit: Render subtitles (without osd) before taking a snapshot (close #378 ). (Laurent Aimar )

git version control git at videolan.org
Sat Sep 13 13:23:14 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Sep 13 11:22:55 2008 +0200| [60f3b3b650fc7af1f8b3360c776422198da0f156] | committer: 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).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=60f3b3b650fc7af1f8b3360c776422198da0f156
---

 modules/stream_out/transcode.c      |    4 ++--
 src/video_output/video_output.c     |   17 ++++++++++++-----
 src/video_output/vout_intf.c        |    2 +-
 src/video_output/vout_subpictures.c |    5 +++--
 4 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c
index d889dc1..2e67558 100644
--- a/modules/stream_out/transcode.c
+++ b/modules/stream_out/transcode.c
@@ -1981,7 +1981,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
         if( p_sys->p_spu )
         {
             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 */
         }
 
@@ -2525,7 +2525,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 );
+        p_subpic = spu_SortSubpictures( p_sys->p_spu, in->i_dts, false, false );
     }
     else
     {
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 157db2f..17c21b0 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -960,11 +960,11 @@ static void* RunThread( vlc_object_t *p_this )
             p_filtered_picture = filter_chain_VideoFilter( p_vout->p_vf2_chain,
                                                            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;
-            vout_Snapshot( p_vout, p_filtered_picture );
-        }
 
         /*
          * Check for subpictures to display
@@ -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_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 )
                 vlc_object_release( p_input );
         }
@@ -985,6 +986,12 @@ static void* RunThread( vlc_object_t *p_this )
         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
          */
         if( p_filtered_picture != NULL && p_directbuffer != NULL && p_vout->pf_render )
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 332c834..2d48bb7 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -574,7 +574,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
 
     /* */
     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 )
     {
         fmt_in.i_sar_num =
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 487dcef..2abc176 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -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.
  *****************************************************************************/
 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;
     subpicture_t *p_subpic = NULL;
@@ -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++ )
         {
             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;
             }




More information about the vlc-devel mailing list