Commit 0097e738 authored by Erwan Tulou's avatar 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
parent ba9161b4
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <vlc_vout.h> #include <vlc_vout.h>
#include <vlc_playlist.h> #include <vlc_playlist.h>
#include <vlc_url.h> #include <vlc_url.h>
#include <vlc_strings.h>
#include "vlcproc.hpp" #include "vlcproc.hpp"
#include "os_factory.hpp" #include "os_factory.hpp"
...@@ -789,6 +790,7 @@ void VlcProc::init_variables() ...@@ -789,6 +790,7 @@ void VlcProc::init_variables()
void VlcProc::update_current_input() void VlcProc::update_current_input()
{ {
playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;
input_thread_t* pInput = getIntf()->p_sys->p_input; input_thread_t* pInput = getIntf()->p_sys->p_input;
if( !pInput ) if( !pInput )
return; return;
...@@ -796,16 +798,11 @@ void VlcProc::update_current_input() ...@@ -796,16 +798,11 @@ void VlcProc::update_current_input()
input_item_t *pItem = input_GetItem( pInput ); input_item_t *pItem = input_GetItem( pInput );
if( pItem ) if( pItem )
{ {
// Update short name // Update short name (as defined by --input-title-format)
char *psz_name = input_item_GetTitle( pItem ); char *psz_fmt = var_InheritString( getIntf(), "input-title-format" );
if( EMPTY_STR( psz_name ) ) char *psz_name = str_format_meta( pPlaylist, psz_fmt );
{
free( psz_name );
psz_name = input_item_GetName( pItem );
}
if( !psz_name )
psz_name = strdup ( "" );
SET_TEXT( m_cVarStreamName, UString( getIntf(), psz_name ) ); SET_TEXT( m_cVarStreamName, UString( getIntf(), psz_name ) );
free( psz_fmt );
free( psz_name ); free( psz_name );
// Update local path (if possible) or full uri // Update local path (if possible) or full uri
......
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