[vlc-devel] [PATCH 5/5] Use CurrentInput instead of CurrentPlayingItem for MPRIS2 metadata
Alex Merry
dev at randomguy3.me.uk
Sun Jan 27 22:25:14 CET 2013
Nothing else in the D-Bus interface uses CurrentPlayingItem, and it fits
better with the main interface (which displays no metadata if the track
is stopped).
---
modules/control/dbus/dbus_player.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/modules/control/dbus/dbus_player.c b/modules/control/dbus/dbus_player.c
index 6a203f6..497a069 100644
--- a/modules/control/dbus/dbus_player.c
+++ b/modules/control/dbus/dbus_player.c
@@ -715,18 +715,22 @@ MarshalMetadata( intf_thread_t *p_intf, DBusMessageIter *container )
DBusMessageIter a;
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
- PL_LOCK;
- playlist_item_t* p_item = playlist_CurrentPlayingItem( p_playlist );
-
- if( p_item )
- GetInputMeta( p_item->p_input, container );
-
- PL_UNLOCK;
-
- if( !p_item &&
- ( !dbus_message_iter_open_container( container, DBUS_TYPE_ARRAY, "{sv}", &a ) ||
- !dbus_message_iter_close_container( container, &a ) ) ) {
- return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ input_thread_t *p_input;
+ if( ( p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist ) ) ) {
+ PL_LOCK;
+ input_item_t *p_item = input_GetItem( p_input );
+ if( p_item ) {
+ GetInputMeta( p_item, container );
+ } else {
+ // avoid breaking the type marshalling
+ if( !dbus_message_iter_open_container( container, DBUS_TYPE_ARRAY, "{sv}", &a ) ||
+ !dbus_message_iter_close_container( container, &a ) ) {
+ PL_UNLOCK;
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ }
+ }
+ PL_UNLOCK;
+ vlc_object_release( (vlc_object_t*) p_input );
}
return VLC_SUCCESS;
--
1.8.1.1
More information about the vlc-devel
mailing list