[vlc-commits] Fix MPRIS2 metadata entry types
Alex Merry
git at videolan.org
Tue Jan 29 20:06:59 CET 2013
vlc/vlc-2.0 | branch: master | Alex Merry <dev at randomguy3.me.uk> | Mon Jan 28 11:54:15 2013 +0000| [08535304de5af24b2376aa0dedab92cf9b09e1de] | committer: Rémi Denis-Courmont
Fix MPRIS2 metadata entry types
Several of these entries, such as xesam:artist, should be lists of
strings, not strings.
Signed-off-by: Mirsal Ennaime <mirsal at videolan.org>
(cherry picked from commit ad8039e3e3b910730e71921b9f8952107644695a)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=08535304de5af24b2376aa0dedab92cf9b09e1de
---
modules/control/dbus/dbus.c | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c
index 462567d..ef1086e 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -1127,10 +1127,32 @@ int DemarshalSetPropertyValue( DBusMessage *p_msg, void *p_arg )
free( psz ); \
}
+#define ADD_META_SINGLETON_STRING_LIST( entry, item ) \
+ { \
+ char * psz = input_item_Get##item( p_input );\
+ if( psz ) { \
+ dbus_message_iter_open_container( &dict, DBUS_TYPE_DICT_ENTRY, \
+ NULL, &dict_entry ); \
+ dbus_message_iter_append_basic( &dict_entry, DBUS_TYPE_STRING, \
+ &ppsz_meta_items[entry] ); \
+ dbus_message_iter_open_container( &dict_entry, DBUS_TYPE_VARIANT, \
+ "as", &variant ); \
+ dbus_message_iter_open_container( &variant, DBUS_TYPE_ARRAY, "s", \
+ &list ); \
+ dbus_message_iter_append_basic( &list, \
+ DBUS_TYPE_STRING, \
+ &psz ); \
+ dbus_message_iter_close_container( &variant, &list ); \
+ dbus_message_iter_close_container( &dict_entry, &variant ); \
+ dbus_message_iter_close_container( &dict, &dict_entry ); \
+ } \
+ free( psz ); \
+ }
+
int GetInputMeta( input_item_t* p_input,
DBusMessageIter *args )
{
- DBusMessageIter dict, dict_entry, variant;
+ DBusMessageIter dict, dict_entry, variant, list;
/** The duration of the track can be expressed in second, milli-seconds and
µ-seconds */
dbus_int64_t i_mtime = input_item_GetDuration( p_input );
@@ -1157,19 +1179,19 @@ int GetInputMeta( input_item_t* p_input,
ADD_META( 0, DBUS_TYPE_OBJECT_PATH, psz_trackid );
ADD_VLC_META_STRING( 1, URI );
ADD_VLC_META_STRING( 2, Title );
- ADD_VLC_META_STRING( 3, Artist );
+ ADD_META_SINGLETON_STRING_LIST( 3, Artist );
ADD_VLC_META_STRING( 4, Album );
ADD_VLC_META_STRING( 5, TrackNum );
ADD_META( 6, DBUS_TYPE_UINT32, i_time );
ADD_META( 7, DBUS_TYPE_INT64, i_mtime );
- ADD_VLC_META_STRING( 8, Genre );
- ADD_VLC_META_STRING( 9, Rating );
- ADD_VLC_META_STRING( 10, Date );
+ ADD_META_SINGLETON_STRING_LIST( 8, Genre );
+ //ADD_META( 9, DBUS_TYPE_DOUBLE, rating );
+ ADD_VLC_META_STRING( 10, Date ); // this is supposed to be in ISO 8601 extended format
ADD_VLC_META_STRING( 11, ArtURL );
ADD_VLC_META_STRING( 12, TrackID );
ADD_VLC_META_STRING( 17, Copyright );
- ADD_VLC_META_STRING( 18, Description );
+ ADD_META_SINGLETON_STRING_LIST( 18, Description );
ADD_VLC_META_STRING( 19, EncodedBy );
ADD_VLC_META_STRING( 20, Language );
ADD_META( 21, DBUS_TYPE_INT64, i_length );
More information about the vlc-commits
mailing list