[vlc-commits] Use str_format_time() instead of str_format() in outputs

Rémi Denis-Courmont git at videolan.org
Tue Aug 21 20:32:26 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug 21 21:18:17 2012 +0300| [b55ddc8fa43e6798f4ae9bc724758734d6b43310] | committer: Rémi Denis-Courmont

Use str_format_time() instead of str_format() in outputs

There are several issues with str_format() and str_format_meta():
 - the current playlist item is used rather than the actual input,
 - the playlist gets activated for nothing,
 - they assume the output does not outlive to the input (item).

This mostly reverts commit cccd51a5b8026f20830aeec3473efa24553013c3.

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

 modules/access_output/file.c     |    2 +-
 modules/access_output/livehttp.c |   12 ++++++------
 modules/video_filter/marq.c      |    2 +-
 src/video_output/snapshot.c      |    4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/modules/access_output/file.c b/modules/access_output/file.c
index 3ee0e8c..9774685 100644
--- a/modules/access_output/file.c
+++ b/modules/access_output/file.c
@@ -152,7 +152,7 @@ static int Open( vlc_object_t *p_this )
 #endif
     else
     {
-        char *psz_tmp = str_format( p_access, p_access->psz_path );
+        char *psz_tmp = str_format_time( p_access->psz_path );
         path_sanitize( psz_tmp );
 
         fd = vlc_open( psz_tmp, O_RDWR | O_CREAT | O_LARGEFILE |
diff --git a/modules/access_output/livehttp.c b/modules/access_output/livehttp.c
index 63c56b1..bca522b 100644
--- a/modules/access_output/livehttp.c
+++ b/modules/access_output/livehttp.c
@@ -173,7 +173,7 @@ static int Open( vlc_object_t *p_this )
     if ( psz_idx )
     {
         char *psz_tmp;
-        psz_tmp = str_format( p_access, psz_idx );
+        psz_tmp = str_format_time( psz_idx );
         free( psz_idx );
         if ( !psz_tmp )
         {
@@ -203,12 +203,12 @@ static int Open( vlc_object_t *p_this )
 /*****************************************************************************
  * formatSegmentPath: create segment path name based on seg #
  *****************************************************************************/
-static char *formatSegmentPath( sout_access_out_t *p_access, char *psz_path, uint32_t i_seg, bool b_sanitize )
+static char *formatSegmentPath( char *psz_path, uint32_t i_seg, bool b_sanitize )
 {
     char *psz_result;
     char *psz_firstNumSign;
 
-    if ( ! ( psz_result  = str_format( p_access, psz_path ) ) )
+    if ( ! ( psz_result  = str_format_time( psz_path ) ) )
         return NULL;
 
     psz_firstNumSign = psz_result + strcspn( psz_result, SEG_NUMBER_PLACEHOLDER );
@@ -272,7 +272,7 @@ static int updateIndexAndDel( sout_access_out_t *p_access, sout_access_out_sys_t
         for ( uint32_t i = i_firstseg; i <= p_sys->i_segment; i++ )
         {
             char *psz_name;
-            if ( ! ( psz_name = formatSegmentPath( p_access, psz_idxFormat, i, false ) ) )
+            if ( ! ( psz_name = formatSegmentPath( psz_idxFormat, i, false ) ) )
             {
                 free( psz_idxTmp );
                 fclose( fp );
@@ -316,7 +316,7 @@ static int updateIndexAndDel( sout_access_out_t *p_access, sout_access_out_sys_t
     // Then take care of deletion
     if ( p_sys->b_delsegs && i_firstseg > 1 )
     {
-        char *psz_name = formatSegmentPath( p_access, p_access->psz_path, i_firstseg-1, true );
+        char *psz_name = formatSegmentPath( p_access->psz_path, i_firstseg-1, true );
          if ( psz_name )
          {
              vlc_unlink( psz_name );
@@ -391,7 +391,7 @@ static ssize_t openNextFile( sout_access_out_t *p_access, sout_access_out_sys_t
 
     uint32_t i_newseg = p_sys->i_segment + 1;
 
-    char *psz_seg = formatSegmentPath( p_access, p_access->psz_path, i_newseg, true );
+    char *psz_seg = formatSegmentPath( p_access->psz_path, i_newseg, true );
     if ( !psz_seg )
         return -1;
 
diff --git a/modules/video_filter/marq.c b/modules/video_filter/marq.c
index 890d99b..c800230 100644
--- a/modules/video_filter/marq.c
+++ b/modules/video_filter/marq.c
@@ -291,7 +291,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
         }
     }
 
-    char *msg = str_format( p_filter, p_sys->format ? p_sys->format : "" );
+    char *msg = str_format_time( p_sys->format ? p_sys->format : "" );
     if( unlikely( msg == NULL ) )
         goto out;
     if( p_sys->message != NULL && !strcmp( msg, p_sys->message ) )
diff --git a/src/video_output/snapshot.c b/src/video_output/snapshot.c
index 8ecac34..5accd89 100644
--- a/src/video_output/snapshot.c
+++ b/src/video_output/snapshot.c
@@ -149,7 +149,7 @@ int vout_snapshot_SaveImage(char **name, int *sequential,
         /* */
         char *prefix = NULL;
         if (cfg->prefix_fmt)
-            prefix = str_format(object, cfg->prefix_fmt);
+            prefix = str_format_time(cfg->prefix_fmt);
         if (prefix)
             filename_sanitize(prefix);
         else {
@@ -202,7 +202,7 @@ int vout_snapshot_SaveImage(char **name, int *sequential,
         free(prefix);
     } else {
         /* The user specified a full path name (including file name) */
-        filename = str_format(object, cfg->path);
+        filename = str_format_time(cfg->path);
         path_sanitize(filename);
     }
 



More information about the vlc-commits mailing list