Commit b55ddc8f authored by Rémi Denis-Courmont's avatar 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 cccd51a5.
parent 1c4f1394
...@@ -152,7 +152,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -152,7 +152,7 @@ static int Open( vlc_object_t *p_this )
#endif #endif
else 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 ); path_sanitize( psz_tmp );
fd = vlc_open( psz_tmp, O_RDWR | O_CREAT | O_LARGEFILE | fd = vlc_open( psz_tmp, O_RDWR | O_CREAT | O_LARGEFILE |
......
...@@ -173,7 +173,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -173,7 +173,7 @@ static int Open( vlc_object_t *p_this )
if ( psz_idx ) if ( psz_idx )
{ {
char *psz_tmp; char *psz_tmp;
psz_tmp = str_format( p_access, psz_idx ); psz_tmp = str_format_time( psz_idx );
free( psz_idx ); free( psz_idx );
if ( !psz_tmp ) if ( !psz_tmp )
{ {
...@@ -203,12 +203,12 @@ static int Open( vlc_object_t *p_this ) ...@@ -203,12 +203,12 @@ static int Open( vlc_object_t *p_this )
/***************************************************************************** /*****************************************************************************
* formatSegmentPath: create segment path name based on seg # * 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_result;
char *psz_firstNumSign; char *psz_firstNumSign;
if ( ! ( psz_result = str_format( p_access, psz_path ) ) ) if ( ! ( psz_result = str_format_time( psz_path ) ) )
return NULL; return NULL;
psz_firstNumSign = psz_result + strcspn( psz_result, SEG_NUMBER_PLACEHOLDER ); 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 ...@@ -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++ ) for ( uint32_t i = i_firstseg; i <= p_sys->i_segment; i++ )
{ {
char *psz_name; char *psz_name;
if ( ! ( psz_name = formatSegmentPath( p_access, psz_idxFormat, i, false ) ) ) if ( ! ( psz_name = formatSegmentPath( psz_idxFormat, i, false ) ) )
{ {
free( psz_idxTmp ); free( psz_idxTmp );
fclose( fp ); fclose( fp );
...@@ -316,7 +316,7 @@ static int updateIndexAndDel( sout_access_out_t *p_access, sout_access_out_sys_t ...@@ -316,7 +316,7 @@ static int updateIndexAndDel( sout_access_out_t *p_access, sout_access_out_sys_t
// Then take care of deletion // Then take care of deletion
if ( p_sys->b_delsegs && i_firstseg > 1 ) 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 ) if ( psz_name )
{ {
vlc_unlink( 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 ...@@ -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; 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 ) if ( !psz_seg )
return -1; return -1;
......
...@@ -291,7 +291,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) ...@@ -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 ) ) if( unlikely( msg == NULL ) )
goto out; goto out;
if( p_sys->message != NULL && !strcmp( msg, p_sys->message ) ) if( p_sys->message != NULL && !strcmp( msg, p_sys->message ) )
......
...@@ -149,7 +149,7 @@ int vout_snapshot_SaveImage(char **name, int *sequential, ...@@ -149,7 +149,7 @@ int vout_snapshot_SaveImage(char **name, int *sequential,
/* */ /* */
char *prefix = NULL; char *prefix = NULL;
if (cfg->prefix_fmt) if (cfg->prefix_fmt)
prefix = str_format(object, cfg->prefix_fmt); prefix = str_format_time(cfg->prefix_fmt);
if (prefix) if (prefix)
filename_sanitize(prefix); filename_sanitize(prefix);
else { else {
...@@ -202,7 +202,7 @@ int vout_snapshot_SaveImage(char **name, int *sequential, ...@@ -202,7 +202,7 @@ int vout_snapshot_SaveImage(char **name, int *sequential,
free(prefix); free(prefix);
} else { } else {
/* The user specified a full path name (including file name) */ /* 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); path_sanitize(filename);
} }
......
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