[vlc-commits] dbus: use playlist_CurrentInput()
Rémi Denis-Courmont
git at videolan.org
Wed Jan 1 19:51:45 CET 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jan 1 19:19:26 2014 +0200| [fb7155e36aec16542f2de35313ada2296ad92455] | committer: Rémi Denis-Courmont
dbus: use playlist_CurrentInput()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fb7155e36aec16542f2de35313ada2296ad92455
---
modules/control/dbus/dbus.c | 13 +++++++------
modules/control/dbus/dbus_player.c | 37 +++++++++++++++++-------------------
2 files changed, 24 insertions(+), 26 deletions(-)
diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c
index f0356ca..1d5c5b8 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -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,
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_init( &player_properties, 0 );
@@ -536,6 +535,8 @@ static void ProcessEvents( intf_thread_t *p_intf,
case SIGNAL_INTF_CHANGE:
case SIGNAL_PLAYLIST_ITEM_APPEND:
case SIGNAL_PLAYLIST_ITEM_DELETED:
+ {
+ playlist_t *p_playlist = p_intf->p_sys->p_playlist;
PL_LOCK;
b_can_play = playlist_CurrentSize( p_playlist ) > 0;
PL_UNLOCK;
@@ -549,6 +550,7 @@ static void ProcessEvents( intf_thread_t *p_intf,
if( !vlc_dictionary_has_key( &tracklist_properties, "Tracks" ) )
vlc_dictionary_insert( &tracklist_properties, "Tracks", NULL );
break;
+ }
case SIGNAL_VOLUME_MUTED:
case SIGNAL_VOLUME_CHANGE:
vlc_dictionary_insert( &player_properties, "Volume", NULL );
@@ -571,7 +573,7 @@ static void ProcessEvents( intf_thread_t *p_intf,
break;
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;
if( p_input )
{
@@ -594,7 +596,7 @@ static void ProcessEvents( intf_thread_t *p_intf,
{
input_thread_t *p_input;
input_item_t *p_item;
- p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist );
+ p_input = pl_CurrentInput( p_intf );
if( p_input )
{
p_item = input_GetItem( p_input );
@@ -1063,7 +1065,6 @@ static int AllCallback( vlc_object_t *p_this, const char *psz_var,
static int TrackChange( intf_thread_t *p_intf )
{
intf_sys_t *p_sys = p_intf->p_sys;
- playlist_t *p_playlist = p_sys->p_playlist;
input_thread_t *p_input = NULL;
input_item_t *p_item = NULL;
@@ -1081,7 +1082,7 @@ static int TrackChange( intf_thread_t *p_intf )
p_sys->b_meta_read = false;
- p_input = playlist_CurrentInput( p_playlist );
+ p_input = pl_CurrentInput( p_intf );
if( !p_input )
{
return VLC_SUCCESS;
diff --git a/modules/control/dbus/dbus_player.c b/modules/control/dbus/dbus_player.c
index e2332a9..7fd8b77 100644
--- a/modules/control/dbus/dbus_player.c
+++ b/modules/control/dbus/dbus_player.c
@@ -44,8 +44,7 @@ MarshalPosition( intf_thread_t *p_intf, DBusMessageIter *container )
{
/* returns position in microseconds */
dbus_int64_t i_pos;
- input_thread_t *p_input;
- p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist );
+ input_thread_t *p_input = pl_CurrentInput( p_intf );
if( !p_input )
i_pos = 0;
@@ -87,7 +86,7 @@ DBUS_METHOD( SetPosition )
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 )
{
@@ -138,7 +137,7 @@ DBUS_METHOD( Seek )
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" ) )
{
i_pos = var_GetTime( p_input, "time" );
@@ -208,7 +207,7 @@ DBUS_METHOD( Stop )
DBUS_METHOD( Play )
{
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 )
playlist_Play( PL );
@@ -222,7 +221,7 @@ DBUS_METHOD( Play )
DBUS_METHOD( Pause )
{
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 )
playlist_Pause( PL );
@@ -236,7 +235,7 @@ DBUS_METHOD( Pause )
DBUS_METHOD( PlayPause )
{
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 )
playlist_Pause( PL );
@@ -324,8 +323,7 @@ static int
MarshalCanPause( intf_thread_t *p_intf, DBusMessageIter *container )
{
dbus_bool_t b_can_pause = FALSE;
- input_thread_t *p_input;
- p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist );
+ input_thread_t *p_input = pl_CurrentInput( p_intf );
if( p_input )
{
@@ -357,8 +355,7 @@ static int
MarshalCanSeek( intf_thread_t *p_intf, DBusMessageIter *container )
{
dbus_bool_t b_can_seek = FALSE;
- input_thread_t *p_input;
- p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist );
+ input_thread_t *p_input = pl_CurrentInput( p_intf );
if( p_input )
{
@@ -401,10 +398,10 @@ DBUS_METHOD( ShuffleSet )
static int
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;
- if( ( p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist ) ) )
+ if( p_input != NULL )
{
switch( var_GetInteger( p_input, "state" ) )
{
@@ -435,9 +432,9 @@ static int
MarshalRate( intf_thread_t *p_intf, DBusMessageIter *container )
{
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" );
vlc_object_release( (vlc_object_t*) p_input );
@@ -461,8 +458,8 @@ DBUS_METHOD( RateSet )
if( VLC_SUCCESS != DemarshalSetPropertyValue( p_from, &d_rate ) )
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- input_thread_t *p_input;
- if( ( p_input = playlist_CurrentInput( PL ) ) )
+ input_thread_t *p_input = pl_CurrentInput( p_this );
+ if( p_input != NULL )
{
var_SetFloat( p_input, "rate", (float) d_rate );
vlc_object_release( (vlc_object_t*) p_input );
@@ -551,10 +548,10 @@ static int
MarshalMetadata( intf_thread_t *p_intf, DBusMessageIter *container )
{
DBusMessageIter a;
- input_thread_t *p_input = NULL;
+ input_thread_t *p_input = pl_CurrentInput( p_intf );
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 );
@@ -597,7 +594,7 @@ DBUS_SIGNAL( SeekedSignal )
dbus_int64_t i_pos = 0;
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 )
{
More information about the vlc-commits
mailing list