#include <vlc_common.h>
#include <vlc_playlist.h>
+#include <vlc_input.h>
#include <vlc_interface.h>
#include <math.h>
{
/* 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;
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 )
{
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" );
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 );
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 );
+ playlist_TogglePause( PL );
if( p_input )
vlc_object_release( p_input );
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 );
+ playlist_TogglePause( PL );
else
playlist_Play( PL );
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 )
{
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 )
{
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" ) )
{
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 );
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 );
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 );
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 )
{
free( ppsz_properties[i] );
}
+ free( ppsz_properties );
+
if( !dbus_message_iter_close_container( &args, &changed_properties ) )
return DBUS_HANDLER_RESULT_NEED_MEMORY;
if( !dbus_message_iter_close_container( &args, &invalidated_properties ) )
return DBUS_HANDLER_RESULT_NEED_MEMORY;
- free( ppsz_properties );
-
SIGNAL_SEND;
}