Commit 33132b6f authored by Jean-Paul Saman's avatar Jean-Paul Saman

dbus: add AspectRatio, AudioChannel and move Rate to /Player object.

parent 56b3fdd4
......@@ -92,8 +92,10 @@ enum
CAPS_CAN_SEEK = 1 << 4,
CAPS_CAN_PROVIDE_METADATA = 1 << 5,
CAPS_CAN_HAS_TRACKLIST = 1 << 6,
CAPS_CAN_RATE = 1 << 7, /* MPRIS v2.0 */
CAPS_CAN_PROVIDE_ES = 1 << 8 /* MPRIS v2.0 */
CAPS_CAN_CONTROL_RATE = 1 << 7, /* MPRIS v2.0 */
CAPS_CAN_CONTROL_REWIND = 1 << 8, /* MPRIS v2.0 */
CAPS_CAN_CONTROL_SUBTITLES = 1 << 9, /* MPRIS v2.0 */
CAPS_CAN_CONTROL_TELETEXT = 1 << 10 /* MPRIS v2.0 */
};
// The signal that can be get from the callbacks
......@@ -1336,11 +1338,153 @@ DBUS_METHOD( SetVideoPosition )
REPLY_SEND;
}
DBUS_METHOD( Fullscreen )
DBUS_METHOD( GetAspectRatio )
{
REPLY_INIT;
OUT_ARGUMENTS;
char *psz_aspect = NULL;
playlist_t *p_playlist = pl_Hold( (vlc_object_t*) p_this );
input_thread_t *p_input = playlist_CurrentInput( p_playlist );
if( p_input )
{
vout_thread_t *p_vout;
p_vout = input_GetVout( p_input );
if( p_vout )
{
psz_aspect = var_GetNonEmptyString( p_vout, "aspect-ratio" );
vlc_object_release( p_vout );
}
vlc_object_release( p_input );
}
pl_Release( (vlc_object_t*) p_this );
ADD_STRING( &psz_aspect );
free( psz_aspect );
REPLY_SEND;
}
DBUS_METHOD( SetAspectRatio )
{
REPLY_INIT;
OUT_ARGUMENTS;
DBusError error;
char *psz_aspect = NULL;
dbus_int32_t i_success = -1;
dbus_error_init( &error );
dbus_message_get_args( p_from, &error,
DBUS_TYPE_STRING, &psz_aspect,
DBUS_TYPE_INVALID );
if( dbus_error_is_set( &error ) )
{
msg_Err( (vlc_object_t*) p_this, "D-Bus message reading : %s",
error.message );
dbus_error_free( &error );
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
playlist_t *p_playlist = pl_Hold( (vlc_object_t*) p_this );
input_thread_t *p_input = playlist_CurrentInput( p_playlist );
if( p_input )
{
vout_thread_t *p_vout;
p_vout = input_GetVout( p_input );
if( p_vout )
{
if( psz_aspect )
{
int i_ret = var_SetString( p_vout, "aspect-ratio", psz_aspect );
if( i_ret >= 0 )
i_success = 0;
}
vlc_object_release( p_vout );
}
vlc_object_release( p_input );
}
pl_Release( (vlc_object_t*) p_this );
ADD_INT32(&i_success);
REPLY_SEND;
}
DBUS_METHOD( GetAudioChannel )
{
REPLY_INIT;
OUT_ARGUMENTS;
dbus_int32_t i_channel;
playlist_t *p_playlist = pl_Hold( (vlc_object_t*) p_this );
input_thread_t *p_input = playlist_CurrentInput( p_playlist );
if( p_input )
{
aout_instance_t *p_aout;
p_aout = input_GetAout( p_input );
if( p_aout )
{
i_channel = var_GetInteger( p_aout, "audio-channels" );
vlc_object_release( p_aout );
}
vlc_object_release( p_input );
}
pl_Release( (vlc_object_t*) p_this );
ADD_INT32( &i_channel );
REPLY_SEND;
}
DBUS_METHOD( SetAudioChannel )
{
REPLY_INIT;
OUT_ARGUMENTS;
DBusError error;
dbus_int32_t i_channel;
dbus_int32_t i_success = -1;
dbus_error_init( &error );
dbus_message_get_args( p_from, &error,
DBUS_TYPE_INT32, &i_channel,
DBUS_TYPE_INVALID );
if( dbus_error_is_set( &error ) )
{
msg_Err( (vlc_object_t*) p_this, "D-Bus message reading : %s",
error.message );
dbus_error_free( &error );
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
playlist_t *p_playlist = pl_Hold( (vlc_object_t*) p_this );
input_thread_t *p_input = playlist_CurrentInput( p_playlist );
if( p_input )
{
aout_instance_t *p_aout;
p_aout = input_GetAout( p_input );
if( p_aout )
{
int i_ret = var_SetInteger( p_aout, "audo-channels", i_channel );
if( i_ret >= 0 )
i_success = 0;
vlc_object_release( p_aout );
}
vlc_object_release( p_input );
}
pl_Release( (vlc_object_t*) p_this );
ADD_INT32(&i_success);
REPLY_SEND;
}
DBUS_METHOD( Fullscreen )
{
REPLY_INIT;
playlist_t *p_playlist = pl_Hold( (vlc_object_t*) p_this );
input_thread_t *p_input = playlist_CurrentInput( p_playlist );
......@@ -1455,6 +1599,8 @@ DBUS_METHOD( handle_player )
METHOD_FUNC( "GetStatus", GetStatus );
METHOD_FUNC( "GetMetadata", GetCurrentMetadata );
METHOD_FUNC( "GetCaps", GetCaps );
METHOD_FUNC( "GetRate", GetRate );
METHOD_FUNC( "SetRate", SetRate );
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
......@@ -1474,8 +1620,6 @@ DBUS_METHOD( handle_tracklist )
METHOD_FUNC( "DelTrack", DelTrack );
METHOD_FUNC( "SetLoop", SetLoop );
METHOD_FUNC( "SetRandom", SetRandom );
METHOD_FUNC( "GetRate", GetRate );
METHOD_FUNC( "SetRate", SetRate );
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
......@@ -1519,6 +1663,10 @@ DBUS_METHOD( handle_display )
METHOD_FUNC( "GetVideoPosition", GetVideoPosition );
METHOD_FUNC( "SetVideoPosition", SetVideoPosition );
METHOD_FUNC( "GetAspectRatio", GetAspectRatio );
METHOD_FUNC( "SetAspectRatio", SetAspectRatio );
METHOD_FUNC( "GetAudioChannel", GetAudioChannel );
METHOD_FUNC( "SetAudioChannel", SetAudioChannel );
METHOD_FUNC( "Fullscreen", Fullscreen );
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
......@@ -1946,6 +2094,14 @@ static int UpdateCaps( intf_thread_t* p_intf )
i_caps |= CAPS_CAN_PAUSE;
if( var_GetBool( p_input, "can-seek" ) )
i_caps |= CAPS_CAN_SEEK;
if( var_GetInteger( p_input, "can-rate" ) )
i_caps |= CAPS_CAN_CONTROL_RATE;
if( var_GetInteger( p_input, "can-rewind" ) )
i_caps |= CAPS_CAN_CONTROL_REWIND;
if( var_CountChoices( p_input, "spu-es" ) > 0 )
i_caps |= CAPS_CAN_CONTROL_SUBTITLES;
if( var_CountChoices( p_input, "teletext-es" ) > 0 )
i_caps |= CAPS_CAN_CONTROL_TELETEXT;
vlc_object_release( p_input );
}
......
......@@ -169,6 +169,13 @@ const char* psz_introspection_xml_data_player =
" <signal name=\"CapsChange\">\n"
" <arg type=\"i\"/>\n"
" </signal>\n"
" <method name=\"GetRate\">\n"
" <arg type=\"d\" direction=\"out\" />\n"
" </method>\n"
" <method name=\"SetRate\">\n"
" <arg type=\"d\" direction=\"in\" />\n"
" <arg type=\"i\" direction=\"out\" />\n"
" </method>\n"
" </interface>\n"
"</node>\n"
;
......@@ -207,13 +214,6 @@ const char* psz_introspection_xml_data_tracklist =
" <method name=\"SetRandom\">\n"
" <arg type=\"b\" direction=\"in\" />\n"
" </method>\n"
" <method name=\"GetRate\">\n"
" <arg type=\"d\" direction=\"out\" />\n"
" </method>\n"
" <method name=\"SetRate\">\n"
" <arg type=\"d\" direction=\"in\" />\n"
" <arg type=\"i\" direction=\"out\" />\n"
" </method>\n"
" <signal name=\"TrackListChange\">\n"
" <arg type=\"i\" />\n"
" </signal>\n"
......@@ -296,6 +296,20 @@ const char* psz_introspection_xml_data_display =
" <arg type=\"(iiii)\" direction=\"in\" />\n"
" <arg type=\"i\" direction=\"out\" />\n"
" </method>\n"
" <method name=\"GetAspectRatio\">\n"
" <arg type=\"s\" direction=\"out\" />\n"
" </method>\n"
" <method name=\"SetAspectRatio\">\n"
" <arg type=\"s\" direction=\"in\" />\n"
" <arg type=\"i\" direction=\"out\" />\n"
" </method>\n"
" <method name=\"GetAudioChannel\">\n"
" <arg type=\"i\" direction=\"out\" />\n"
" </method>\n"
" <method name=\"SetAudioChannel\">\n"
" <arg type=\"i\" direction=\"in\" />\n"
" <arg type=\"i\" direction=\"out\" />\n"
" </method>\n"
" <method name=\"Fullscreen\">\n"
" </method>\n"
" </interface>\n"
......
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