Commit 27da8366 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

dbus: use pl_CurrentInput()

parent 5be88dcf
...@@ -512,8 +512,7 @@ static int UpdateTimeouts( intf_thread_t *p_intf, mtime_t i_loop_interval ) ...@@ -512,8 +512,7 @@ static int UpdateTimeouts( intf_thread_t *p_intf, mtime_t i_loop_interval )
static void ProcessEvents( intf_thread_t *p_intf, static void ProcessEvents( intf_thread_t *p_intf,
callback_info_t **p_events, int i_events ) callback_info_t **p_events, int i_events )
{ {
playlist_t *p_playlist = p_intf->p_sys->p_playlist; bool b_can_play = p_intf->p_sys->b_can_play;
bool b_can_play = p_intf->p_sys->b_can_play;
vlc_dictionary_t player_properties, tracklist_properties, root_properties; vlc_dictionary_t player_properties, tracklist_properties, root_properties;
vlc_dictionary_init( &player_properties, 0 ); vlc_dictionary_init( &player_properties, 0 );
...@@ -536,6 +535,8 @@ static void ProcessEvents( intf_thread_t *p_intf, ...@@ -536,6 +535,8 @@ static void ProcessEvents( intf_thread_t *p_intf,
case SIGNAL_INTF_CHANGE: case SIGNAL_INTF_CHANGE:
case SIGNAL_PLAYLIST_ITEM_APPEND: case SIGNAL_PLAYLIST_ITEM_APPEND:
case SIGNAL_PLAYLIST_ITEM_DELETED: case SIGNAL_PLAYLIST_ITEM_DELETED:
{
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
PL_LOCK; PL_LOCK;
b_can_play = playlist_CurrentSize( p_playlist ) > 0; b_can_play = playlist_CurrentSize( p_playlist ) > 0;
PL_UNLOCK; PL_UNLOCK;
...@@ -549,6 +550,7 @@ static void ProcessEvents( intf_thread_t *p_intf, ...@@ -549,6 +550,7 @@ static void ProcessEvents( intf_thread_t *p_intf,
if( !vlc_dictionary_has_key( &tracklist_properties, "Tracks" ) ) if( !vlc_dictionary_has_key( &tracklist_properties, "Tracks" ) )
vlc_dictionary_insert( &tracklist_properties, "Tracks", NULL ); vlc_dictionary_insert( &tracklist_properties, "Tracks", NULL );
break; break;
}
case SIGNAL_VOLUME_MUTED: case SIGNAL_VOLUME_MUTED:
case SIGNAL_VOLUME_CHANGE: case SIGNAL_VOLUME_CHANGE:
vlc_dictionary_insert( &player_properties, "Volume", NULL ); vlc_dictionary_insert( &player_properties, "Volume", NULL );
...@@ -571,7 +573,7 @@ static void ProcessEvents( intf_thread_t *p_intf, ...@@ -571,7 +573,7 @@ static void ProcessEvents( intf_thread_t *p_intf,
break; break;
case SIGNAL_INPUT_METADATA: case SIGNAL_INPUT_METADATA:
{ {
input_thread_t *p_input = playlist_CurrentInput( p_playlist ); input_thread_t *p_input = pl_CurrentInput( p_intf );
input_item_t *p_item; input_item_t *p_item;
if( p_input ) if( p_input )
{ {
...@@ -594,7 +596,7 @@ static void ProcessEvents( intf_thread_t *p_intf, ...@@ -594,7 +596,7 @@ static void ProcessEvents( intf_thread_t *p_intf,
{ {
input_thread_t *p_input; input_thread_t *p_input;
input_item_t *p_item; input_item_t *p_item;
p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist ); p_input = pl_CurrentInput( p_intf );
if( p_input ) if( p_input )
{ {
p_item = input_GetItem( p_input ); p_item = input_GetItem( p_input );
...@@ -1063,7 +1065,6 @@ static int AllCallback( vlc_object_t *p_this, const char *psz_var, ...@@ -1063,7 +1065,6 @@ static int AllCallback( vlc_object_t *p_this, const char *psz_var,
static int TrackChange( intf_thread_t *p_intf ) static int TrackChange( intf_thread_t *p_intf )
{ {
intf_sys_t *p_sys = p_intf->p_sys; intf_sys_t *p_sys = p_intf->p_sys;
playlist_t *p_playlist = p_sys->p_playlist;
input_thread_t *p_input = NULL; input_thread_t *p_input = NULL;
input_item_t *p_item = NULL; input_item_t *p_item = NULL;
...@@ -1081,7 +1082,7 @@ static int TrackChange( intf_thread_t *p_intf ) ...@@ -1081,7 +1082,7 @@ static int TrackChange( intf_thread_t *p_intf )
p_sys->b_meta_read = false; p_sys->b_meta_read = false;
p_input = playlist_CurrentInput( p_playlist ); p_input = pl_CurrentInput( p_intf );
if( !p_input ) if( !p_input )
{ {
return VLC_SUCCESS; return VLC_SUCCESS;
......
...@@ -44,8 +44,7 @@ MarshalPosition( intf_thread_t *p_intf, DBusMessageIter *container ) ...@@ -44,8 +44,7 @@ MarshalPosition( intf_thread_t *p_intf, DBusMessageIter *container )
{ {
/* returns position in microseconds */ /* returns position in microseconds */
dbus_int64_t i_pos; dbus_int64_t i_pos;
input_thread_t *p_input; input_thread_t *p_input = pl_CurrentInput( p_intf );
p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist );
if( !p_input ) if( !p_input )
i_pos = 0; i_pos = 0;
...@@ -87,7 +86,7 @@ DBUS_METHOD( SetPosition ) ...@@ -87,7 +86,7 @@ DBUS_METHOD( SetPosition )
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} }
input_thread_t *p_input = playlist_CurrentInput( PL ); input_thread_t *p_input = pl_CurrentInput( p_this );
if( p_input ) if( p_input )
{ {
...@@ -138,7 +137,7 @@ DBUS_METHOD( Seek ) ...@@ -138,7 +137,7 @@ DBUS_METHOD( Seek )
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} }
input_thread_t *p_input = playlist_CurrentInput( PL ); input_thread_t *p_input = pl_CurrentInput( p_this );
if( p_input && var_GetBool( p_input, "can-seek" ) ) if( p_input && var_GetBool( p_input, "can-seek" ) )
{ {
i_pos = var_GetTime( p_input, "time" ); i_pos = var_GetTime( p_input, "time" );
...@@ -208,7 +207,7 @@ DBUS_METHOD( Stop ) ...@@ -208,7 +207,7 @@ DBUS_METHOD( Stop )
DBUS_METHOD( Play ) DBUS_METHOD( Play )
{ {
REPLY_INIT; REPLY_INIT;
input_thread_t *p_input = playlist_CurrentInput( PL ); input_thread_t *p_input = pl_CurrentInput( p_this );
if( !p_input || var_GetInteger( p_input, "state" ) != PLAYING_S ) if( !p_input || var_GetInteger( p_input, "state" ) != PLAYING_S )
playlist_Play( PL ); playlist_Play( PL );
...@@ -222,7 +221,7 @@ DBUS_METHOD( Play ) ...@@ -222,7 +221,7 @@ DBUS_METHOD( Play )
DBUS_METHOD( Pause ) DBUS_METHOD( Pause )
{ {
REPLY_INIT; REPLY_INIT;
input_thread_t *p_input = playlist_CurrentInput( PL ); input_thread_t *p_input = pl_CurrentInput( p_this );
if( p_input && var_GetInteger(p_input, "state") == PLAYING_S ) if( p_input && var_GetInteger(p_input, "state") == PLAYING_S )
playlist_Pause( PL ); playlist_Pause( PL );
...@@ -236,7 +235,7 @@ DBUS_METHOD( Pause ) ...@@ -236,7 +235,7 @@ DBUS_METHOD( Pause )
DBUS_METHOD( PlayPause ) DBUS_METHOD( PlayPause )
{ {
REPLY_INIT; REPLY_INIT;
input_thread_t *p_input = playlist_CurrentInput( PL ); input_thread_t *p_input = pl_CurrentInput( p_this );
if( p_input && var_GetInteger(p_input, "state") == PLAYING_S ) if( p_input && var_GetInteger(p_input, "state") == PLAYING_S )
playlist_Pause( PL ); playlist_Pause( PL );
...@@ -324,8 +323,7 @@ static int ...@@ -324,8 +323,7 @@ static int
MarshalCanPause( intf_thread_t *p_intf, DBusMessageIter *container ) MarshalCanPause( intf_thread_t *p_intf, DBusMessageIter *container )
{ {
dbus_bool_t b_can_pause = FALSE; dbus_bool_t b_can_pause = FALSE;
input_thread_t *p_input; input_thread_t *p_input = pl_CurrentInput( p_intf );
p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist );
if( p_input ) if( p_input )
{ {
...@@ -357,8 +355,7 @@ static int ...@@ -357,8 +355,7 @@ static int
MarshalCanSeek( intf_thread_t *p_intf, DBusMessageIter *container ) MarshalCanSeek( intf_thread_t *p_intf, DBusMessageIter *container )
{ {
dbus_bool_t b_can_seek = FALSE; dbus_bool_t b_can_seek = FALSE;
input_thread_t *p_input; input_thread_t *p_input = pl_CurrentInput( p_intf );
p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist );
if( p_input ) if( p_input )
{ {
...@@ -401,10 +398,10 @@ DBUS_METHOD( ShuffleSet ) ...@@ -401,10 +398,10 @@ DBUS_METHOD( ShuffleSet )
static int static int
MarshalPlaybackStatus( intf_thread_t *p_intf, DBusMessageIter *container ) MarshalPlaybackStatus( intf_thread_t *p_intf, DBusMessageIter *container )
{ {
input_thread_t *p_input; input_thread_t *p_input = pl_CurrentInput( p_intf );
const char *psz_playback_status; const char *psz_playback_status;
if( ( p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist ) ) ) if( p_input != NULL )
{ {
switch( var_GetInteger( p_input, "state" ) ) switch( var_GetInteger( p_input, "state" ) )
{ {
...@@ -435,9 +432,9 @@ static int ...@@ -435,9 +432,9 @@ static int
MarshalRate( intf_thread_t *p_intf, DBusMessageIter *container ) MarshalRate( intf_thread_t *p_intf, DBusMessageIter *container )
{ {
double d_rate; double d_rate;
input_thread_t *p_input; input_thread_t *p_input = pl_CurrentInput( p_intf );
if( ( p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist ) ) ) if( p_input != NULL )
{ {
d_rate = var_GetFloat( p_input, "rate" ); d_rate = var_GetFloat( p_input, "rate" );
vlc_object_release( (vlc_object_t*) p_input ); vlc_object_release( (vlc_object_t*) p_input );
...@@ -461,8 +458,8 @@ DBUS_METHOD( RateSet ) ...@@ -461,8 +458,8 @@ DBUS_METHOD( RateSet )
if( VLC_SUCCESS != DemarshalSetPropertyValue( p_from, &d_rate ) ) if( VLC_SUCCESS != DemarshalSetPropertyValue( p_from, &d_rate ) )
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
input_thread_t *p_input; input_thread_t *p_input = pl_CurrentInput( p_this );
if( ( p_input = playlist_CurrentInput( PL ) ) ) if( p_input != NULL )
{ {
var_SetFloat( p_input, "rate", (float) d_rate ); var_SetFloat( p_input, "rate", (float) d_rate );
vlc_object_release( (vlc_object_t*) p_input ); vlc_object_release( (vlc_object_t*) p_input );
...@@ -551,10 +548,10 @@ static int ...@@ -551,10 +548,10 @@ static int
MarshalMetadata( intf_thread_t *p_intf, DBusMessageIter *container ) MarshalMetadata( intf_thread_t *p_intf, DBusMessageIter *container )
{ {
DBusMessageIter a; DBusMessageIter a;
input_thread_t *p_input = NULL; input_thread_t *p_input = pl_CurrentInput( p_intf );
input_item_t *p_item = NULL; input_item_t *p_item = NULL;
if( ( p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist ) ) ) if( p_input != NULL )
{ {
p_item = input_GetItem( p_input ); p_item = input_GetItem( p_input );
...@@ -597,7 +594,7 @@ DBUS_SIGNAL( SeekedSignal ) ...@@ -597,7 +594,7 @@ DBUS_SIGNAL( SeekedSignal )
dbus_int64_t i_pos = 0; dbus_int64_t i_pos = 0;
intf_thread_t *p_intf = (intf_thread_t*) p_data; intf_thread_t *p_intf = (intf_thread_t*) p_data;
input_thread_t *p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist ); input_thread_t *p_input = pl_CurrentInput( p_intf );
if( p_input ) if( p_input )
{ {
......
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