Commit 9cd91f92 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

str_format_meta(): take playlist as parameter directly

Also inline str_format().
parent b55ddc8f
......@@ -45,10 +45,15 @@ VLC_API size_t vlc_b64_decode_binary( uint8_t **pp_dst, const char *psz_src );
VLC_API char * vlc_b64_decode( const char *psz_src );
VLC_API char * str_format_time( const char * );
VLC_API char * str_format_meta( vlc_object_t *, const char * );
#define str_format_meta( a, b ) str_format_meta( VLC_OBJECT( a ), b )
VLC_API char * str_format( vlc_object_t *, const char * );
#define str_format( a, b ) str_format( VLC_OBJECT( a ), b )
VLC_API char * str_format_meta( playlist_t *, const char * );
static inline char *str_format( playlist_t *pl, const char *fmt )
{
char *s1 = str_format_time( fmt );
char *s2 = str_format_meta( pl, s1 );
free( s1 );
return s2;
}
VLC_API void filename_sanitize( char * );
VLC_API void path_sanitize( char * );
......
......@@ -484,7 +484,7 @@ void InputManager::UpdateName()
/* Try to get the nowplaying */
char *format = var_InheritString( p_intf, "input-title-format" );
char *formated = str_format_meta( p_input, format );
char *formated = str_format_meta( THEPL, format );
free( format );
name = qfu(formated);
free( formated );
......
......@@ -55,6 +55,7 @@
#include <vlc_fs.h>
#include <vlc_strings.h>
#include <vlc_modules.h>
#include <vlc_playlist.h> // FIXME
/*****************************************************************************
* Local prototypes
......@@ -3237,7 +3238,7 @@ char *input_CreateFilename( vlc_object_t *p_obj, const char *psz_path, const cha
{
closedir( path );
char *psz_tmp = str_format( p_obj, psz_prefix );
char *psz_tmp = str_format( pl_Get(p_obj), psz_prefix );
if( !psz_tmp )
return NULL;
......@@ -3253,7 +3254,7 @@ char *input_CreateFilename( vlc_object_t *p_obj, const char *psz_path, const cha
}
else
{
psz_file = str_format( p_obj, psz_path );
psz_file = str_format( pl_Get(p_obj), psz_path );
path_sanitize( psz_file );
return psz_file;
}
......
......@@ -402,7 +402,6 @@ stream_Read
stream_ReadLine
stream_UrlNew
stream_vaControl
str_format
str_format_meta
str_format_time
str_duration
......
......@@ -527,8 +527,7 @@ static void format_duration (char *buf, size_t len, int64_t duration)
memcpy( dst+d, string, len ); \
d += len; \
}
#undef str_format_meta
char *str_format_meta( vlc_object_t *p_object, const char *string )
char *str_format_meta( playlist_t *p_object, const char *string )
{
const char *s = string;
bool b_is_format = false;
......@@ -539,7 +538,7 @@ char *str_format_meta( vlc_object_t *p_object, const char *string )
if( !dst ) return NULL;
int d = 0;
input_thread_t *p_input = playlist_CurrentInput( pl_Get(p_object) );
input_thread_t *p_input = playlist_CurrentInput( p_object );
input_item_t *p_item = NULL;
if( p_input )
{
......@@ -847,19 +846,6 @@ char *str_format_meta( vlc_object_t *p_object, const char *string )
#undef INSERT_STRING
#undef INSERT_STRING_NO_FREE
#undef str_format
/**
* Apply str format time and str format meta
*/
char *str_format( vlc_object_t *p_this, const char *psz_src )
{
char *psz_buf1, *psz_buf2;
psz_buf1 = str_format_time( psz_src );
psz_buf2 = str_format_meta( p_this, psz_buf1 );
free( psz_buf1 );
return psz_buf2;
}
/**
* Remove forbidden, potentially forbidden and otherwise evil characters from
* filenames. This includes slashes, and popular characters like colon
......
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