[vlc-commits] skins2: improve $N text variable

Erwan Tulou git at videolan.org
Sat Mar 30 20:17:09 CET 2013


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Sat Mar 30 19:38:32 2013 +0100| [0097e7385d2966815a35ddd6d22e54897e9cc6c7] | committer: Erwan Tulou

skins2: improve $N text variable

Instead of hardcoding what we think the name of the current item is, make it
configurable via the --input-title-format parameter.

This change makes skins2 more consistent with qt4 that already uses this
means to set the title of the main window.

Default display will now be "artist + title" instead of just "title".
Users who would still prefer the previous behaviour can get it with
--input-title-format '$t'

This fixes a request described at http://forum.videolan.org/viewtopic.php?f=15&t=108976

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

 modules/gui/skins2/src/vlcproc.cpp |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/modules/gui/skins2/src/vlcproc.cpp b/modules/gui/skins2/src/vlcproc.cpp
index d5d17f5..c159435 100644
--- a/modules/gui/skins2/src/vlcproc.cpp
+++ b/modules/gui/skins2/src/vlcproc.cpp
@@ -32,6 +32,7 @@
 #include <vlc_vout.h>
 #include <vlc_playlist.h>
 #include <vlc_url.h>
+#include <vlc_strings.h>
 
 #include "vlcproc.hpp"
 #include "os_factory.hpp"
@@ -789,6 +790,7 @@ void VlcProc::init_variables()
 
 void VlcProc::update_current_input()
 {
+    playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;
     input_thread_t* pInput = getIntf()->p_sys->p_input;
     if( !pInput )
         return;
@@ -796,16 +798,11 @@ void VlcProc::update_current_input()
     input_item_t *pItem = input_GetItem( pInput );
     if( pItem )
     {
-        // Update short name
-        char *psz_name = input_item_GetTitle( pItem );
-        if( EMPTY_STR( psz_name ) )
-        {
-            free( psz_name );
-            psz_name = input_item_GetName( pItem );
-        }
-        if( !psz_name )
-            psz_name = strdup ( "" );
+        // Update short name (as defined by --input-title-format)
+        char *psz_fmt = var_InheritString( getIntf(), "input-title-format" );
+        char *psz_name = str_format_meta( pPlaylist, psz_fmt );
         SET_TEXT( m_cVarStreamName, UString( getIntf(), psz_name ) );
+        free( psz_fmt );
         free( psz_name );
 
         // Update local path (if possible) or full uri



More information about the vlc-commits mailing list