[vlc-commits] Move helpers for GetAllProperties into dbus.c

Alex Merry git at videolan.org
Mon Jan 28 17:39:55 CET 2013


vlc | branch: master | Alex Merry <dev at randomguy3.me.uk> | Mon Jan 28 11:54:11 2013 +0000| [119aa810f8eecb90ed930ec6a817cae6bc5a9faa] | committer: Mirsal Ennaime

Move helpers for GetAllProperties into dbus.c

This is in preparation for implementing GetAllProperties for the player
and tracklist interfaces.

Signed-off-by: Mirsal Ennaime <mirsal at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=119aa810f8eecb90ed930ec6a817cae6bc5a9faa
---

 modules/control/dbus/dbus.c        |   37 ++++++++++++++++++++++++++++++++++++
 modules/control/dbus/dbus_common.h |    7 +++++++
 modules/control/dbus/dbus_root.c   |   36 -----------------------------------
 3 files changed, 44 insertions(+), 36 deletions(-)

diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c
index a52bb74..e9dd35b 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -4,10 +4,12 @@
  * Copyright © 2006-2008 Rafaël Carré
  * Copyright © 2007-2012 Mirsal Ennaime
  * Copyright © 2009-2012 The VideoLAN team
+ * Copyright © 2013      Alex Merry
  * $Id$
  *
  * Authors:    Rafaël Carré <funman at videolanorg>
  *             Mirsal Ennaime <mirsal at mirsal fr>
+ *             Alex Merry <dev at randomguy3 me uk>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1210,6 +1212,41 @@ int GetInputMeta( input_item_t* p_input,
     return VLC_SUCCESS;
 }
 
+int AddProperty( intf_thread_t *p_intf,
+                 DBusMessageIter *p_container,
+                 const char* psz_property_name,
+                 const char* psz_signature,
+                 int (*pf_marshaller) (intf_thread_t*, DBusMessageIter*) )
+{
+    DBusMessageIter entry, v;
+
+    if( !dbus_message_iter_open_container( p_container,
+                                           DBUS_TYPE_DICT_ENTRY, NULL,
+                                           &entry ) )
+        return VLC_ENOMEM;
+
+    if( !dbus_message_iter_append_basic( &entry,
+                                         DBUS_TYPE_STRING,
+                                         &psz_property_name ) )
+        return VLC_ENOMEM;
+
+    if( !dbus_message_iter_open_container( &entry,
+                                           DBUS_TYPE_VARIANT, psz_signature,
+                                           &v ) )
+        return VLC_ENOMEM;
+
+    if( VLC_SUCCESS != pf_marshaller( p_intf, &v ) )
+        return VLC_ENOMEM;
+
+    if( !dbus_message_iter_close_container( &entry, &v) )
+        return VLC_ENOMEM;
+
+    if( !dbus_message_iter_close_container( p_container, &entry ) )
+        return VLC_ENOMEM;
+
+    return VLC_SUCCESS;
+}
+
 #undef ADD_META
 #undef ADD_VLC_META_STRING
 
diff --git a/modules/control/dbus/dbus_common.h b/modules/control/dbus/dbus_common.h
index 2e1c5b9..9579c3f 100644
--- a/modules/control/dbus/dbus_common.h
+++ b/modules/control/dbus/dbus_common.h
@@ -4,10 +4,12 @@
  * Copyright © 2006-2008 Rafaël Carré
  * Copyright © 2007-2010 Mirsal Ennaime
  * Copyright © 2009-2010 The VideoLAN team
+ * Copyright © 2013      Alex Merry
  * $Id$
  *
  * Authors:    Mirsal Ennaime <mirsal dot ennaime at gmailcom>
  *             Rafaël Carré <funman at videolanorg>
+ *             Alex Merry <dev at randomguy3 me uk>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -138,5 +140,10 @@ enum
 
 int DemarshalSetPropertyValue( DBusMessage *p_msg, void *p_arg );
 int GetInputMeta  ( input_item_t* p_input, DBusMessageIter *args );
+int AddProperty ( intf_thread_t *p_intf,
+                  DBusMessageIter *p_container,
+                  const char* psz_property_name,
+                  const char* psz_signature,
+                  int (*pf_marshaller) (intf_thread_t*, DBusMessageIter*) );
 
 #endif //dbus-common.h
diff --git a/modules/control/dbus/dbus_root.c b/modules/control/dbus/dbus_root.c
index 1b6b962..19f34e0 100644
--- a/modules/control/dbus/dbus_root.c
+++ b/modules/control/dbus/dbus_root.c
@@ -478,42 +478,6 @@ DBUS_METHOD( SetProperty )
 #undef PROPERTY_GET_FUNC
 #undef PROPERTY_MAPPING_END
 
-static int
-AddProperty( intf_thread_t *p_intf,
-             DBusMessageIter *p_container,
-             const char* psz_property_name,
-             const char* psz_signature,
-             int (*pf_marshaller) (intf_thread_t*, DBusMessageIter*) )
-{
-    DBusMessageIter entry, v;
-
-    if( !dbus_message_iter_open_container( p_container,
-                                           DBUS_TYPE_DICT_ENTRY, NULL,
-                                           &entry ) )
-        return VLC_ENOMEM;
-
-    if( !dbus_message_iter_append_basic( &entry,
-                                         DBUS_TYPE_STRING,
-                                         &psz_property_name ) )
-        return VLC_ENOMEM;
-
-    if( !dbus_message_iter_open_container( &entry,
-                                           DBUS_TYPE_VARIANT, psz_signature,
-                                           &v ) )
-        return VLC_ENOMEM;
-
-    if( VLC_SUCCESS != pf_marshaller( p_intf, &v ) )
-        return VLC_ENOMEM;
-
-    if( !dbus_message_iter_close_container( &entry, &v) )
-        return VLC_ENOMEM;
-
-    if( !dbus_message_iter_close_container( p_container, &entry ) )
-        return VLC_ENOMEM;
-
-    return VLC_SUCCESS;
-}
-
 #define ADD_PROPERTY( prop, signature ) \
     if( VLC_SUCCESS != AddProperty( (intf_thread_t*) p_this, \
                 &dict, #prop, signature, Marshal##prop ) ) \



More information about the vlc-commits mailing list