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 )
#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 |
......
......@@ -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;
......
......@@ -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 ) )
......
......@@ -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);
}
......
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