]> git.sesse.net Git - vlc/commitdiff
str_format_meta(): take playlist as parameter directly
authorRémi Denis-Courmont <remi@remlab.net>
Tue, 21 Aug 2012 18:30:05 +0000 (21:30 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 21 Aug 2012 18:31:54 +0000 (21:31 +0300)
Also inline str_format().

include/vlc_strings.h
modules/gui/qt4/input_manager.cpp
src/input/input.c
src/libvlccore.sym
src/text/strings.c

index 9b4d0944cf94b6c4208fe26f2d92caee8fb7459c..91592826f20551b2a5cf6f661ad437acded65d0d 100644 (file)
@@ -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 * );
index 45e555f4f8f9cb5bf5a8dc459260077e7f1a0394..dae5ef54003db5b009ce1b26197d569976a9364d 100644 (file)
@@ -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 );
index 88366efb62414c292414e14531be0a9485c48947..e35bd85ffbceff24f22d3053d35bbebeacf6320b 100644 (file)
@@ -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;
     }
index e3b451920e0131d509b91caecbb7cabfcf5ccaf1..a8599345a768bc11c36cf41a8ccd24e1f100aa87 100644 (file)
@@ -402,7 +402,6 @@ stream_Read
 stream_ReadLine
 stream_UrlNew
 stream_vaControl
-str_format
 str_format_meta
 str_format_time
 str_duration
index 9ed515d13b4a172ece1fbd48182fa6ba6fca25d1..8db7b26e896359a5a66f519c74d8360bd4b2fcf5 100644 (file)
@@ -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