[vlc-devel] [PATCH] Replacing time and format variables in scene-prefix

Jane Smith engineeringismagic at gmail.com
Sat Apr 30 20:21:22 CEST 2011


Scene-prefix says in the wiki documentation that it will replace time and
other format variables, but it doesn't.  This simple change should allow
that.
---
 modules/video_filter/scene.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/modules/video_filter/scene.c b/modules/video_filter/scene.c
index 8674993..e84d4d1 100644
--- a/modules/video_filter/scene.c
+++ b/modules/video_filter/scene.c
@@ -267,6 +267,7 @@ static void SavePicture( filter_t *p_filter, picture_t
*p_pic )
 {
     filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys;
     video_format_t fmt_in, fmt_out;
+    char *psz_prefix = NULL;
     char *psz_filename = NULL;
     char *psz_temp = NULL;
     int i_ret;
@@ -282,16 +283,21 @@ static void SavePicture( filter_t *p_filter, picture_t
*p_pic )
     fmt_out.i_chroma = p_sys->i_format;

     /*
+     * Replace prefix with str_format variables
+     */
+    psz_prefix = str_format( p_filter, p_sys->psz_prefix );
+
+    /*
      * Save the snapshot to a temporary file and
      * switch it to the real name afterwards.
      */
     if( p_sys->b_replace )
         i_ret = asprintf( &psz_filename, "%s" DIR_SEP "%s.%s",
-                          p_sys->psz_path, p_sys->psz_prefix,
+                          p_sys->psz_path, psz_prefix,
                           p_sys->psz_format );
     else
         i_ret = asprintf( &psz_filename, "%s" DIR_SEP "%s%05d.%s",
-                          p_sys->psz_path, p_sys->psz_prefix,
+                          p_sys->psz_path, psz_prefix,
                           p_sys->i_frames, p_sys->psz_format );

     if( i_ret == -1 )
@@ -333,4 +339,5 @@ static void SavePicture( filter_t *p_filter, picture_t
*p_pic )
 error:
     free( psz_temp );
     free( psz_filename );
+    free( psz_prefix );
 }
-- 
1.6.3.3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110430/5e731556/attachment.html>


More information about the vlc-devel mailing list