From 678f97a658be15939b2b72e455f338a9de4a8da1 Mon Sep 17 00:00:00 2001 From: Mirsal Ennaime Date: Tue, 25 Mar 2008 03:43:27 +0100 Subject: [PATCH] Dbus control module: * Add the MprisVersion Method. * The MPRIS 1.0 implementation is now complete. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafaël Carré --- modules/control/dbus.c | 17 +++++++++++++++++ modules/control/dbus.h | 8 ++++++++ 2 files changed, 25 insertions(+) diff --git a/modules/control/dbus.c b/modules/control/dbus.c index 54739d7edc..ec2914d34b 100644 --- a/modules/control/dbus.c +++ b/modules/control/dbus.c @@ -127,6 +127,22 @@ DBUS_METHOD( Quit ) REPLY_SEND; } +DBUS_METHOD( MprisVersion ) +{ /*implemented version of the mpris spec */ + REPLY_INIT; + OUT_ARGUMENTS; + VLC_UNUSED( p_this ); + dbus_uint16_t i_major = VLC_MPRIS_VERSION_MAJOR; + dbus_uint16_t i_minor = VLC_MPRIS_VERSION_MINOR; + DBusMessageIter version; + + dbus_message_iter_open_container( &args, DBUS_TYPE_STRUCT, NULL, &version ); + dbus_message_iter_append_basic( &version, DBUS_TYPE_UINT16, &i_major ); + dbus_message_iter_append_basic( &version, DBUS_TYPE_UINT16, &i_minor ); + dbus_message_iter_close_container( &args, &version ); + REPLY_SEND; +} + DBUS_METHOD( PositionGet ) { /* returns position in milliseconds */ REPLY_INIT; @@ -605,6 +621,7 @@ DBUS_METHOD( handle_root ) /* here D-Bus method's names are associated to an handler */ METHOD_FUNC( "Identity", Identity ); + METHOD_FUNC( "MprisVersion", MprisVersion ); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } diff --git a/modules/control/dbus.h b/modules/control/dbus.h index bc39fa0b9d..c9057d7ab3 100644 --- a/modules/control/dbus.h +++ b/modules/control/dbus.h @@ -22,6 +22,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ +/* MPRIS VERSION */ +#define VLC_MPRIS_VERSION_MAJOR 1 +#define VLC_MPRIS_VERSION_MINOR 0 + /* DBUS IDENTIFIERS */ /* name registered on the session bus */ @@ -76,6 +80,7 @@ #define ADD_BOOL( b ) DBUS_ADD( DBUS_TYPE_BOOLEAN, b ) #define ADD_INT32( i ) DBUS_ADD( DBUS_TYPE_INT32, i ) #define ADD_BYTE( b ) DBUS_ADD( DBUS_TYPE_BYTE, b ) +#define ADD_UINT16( i ) DBUS_ADD( DBUS_TYPE_UINT16, i ) /* XML data to answer org.freedesktop.DBus.Introspectable.Introspect requests */ @@ -94,6 +99,9 @@ const char* psz_introspection_xml_data_root = " \n" " \n" " \n" +" \n" +" \n" +" \n" " \n" "\n" ; -- GitLab