From 51f18b540aa65d70691e168ec5383ccda86f970b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 4 Aug 2015 15:59:36 +0200 Subject: [PATCH] introspect: add state and format for output source Add state and negotiated format to output source properties. --- src/client/introspect.c | 14 ++++++++++++++ src/client/introspect.h | 20 ++++++++++++++++++++ src/dbus/org.pinos.xml | 19 +++++++++++++++---- src/server/source-output.c | 22 ++++++++++++++++++++++ src/tests/test-subscribe.c | 10 ++++++---- 5 files changed, 77 insertions(+), 8 deletions(-) diff --git a/src/client/introspect.c b/src/client/introspect.c index af61564ce..ab723f890 100644 --- a/src/client/introspect.c +++ b/src/client/introspect.c @@ -339,6 +339,20 @@ source_output_fill_info (PinosSourceOutputInfo *info, GDBusProxy *proxy) } else { info->possible_formats = NULL; } + if ((variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "State"))) { + info->state = g_variant_get_uint32 (variant); + g_variant_unref (variant); + } else { + info->state = PINOS_SOURCE_OUTPUT_STATE_ERROR; + } + if ((variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Format"))) { + gsize len; + gchar *format = g_variant_dup_string (variant, &len); + info->format = g_bytes_new_take (format, len + 1); + g_variant_unref (variant); + } else { + info->format = NULL; + } info->properties = pinos_properties_from_variant ( g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Properties")); diff --git a/src/client/introspect.h b/src/client/introspect.h index 3409d5cf3..bec90201f 100644 --- a/src/client/introspect.h +++ b/src/client/introspect.h @@ -164,12 +164,30 @@ void pinos_context_get_source_info_by_id (PinosContext *context, GCancellable *cancellable, gpointer user_data); +/** + * PinosSourceState: + * @PINOS_SOURCE_OUTPUT_STATE_ERROR: the source output is in error + * @PINOS_SOURCE_OUTPUT_STATE_IDLE: the source output is idle + * @PINOS_SOURCE_OUTPUT_STATE_STARTING: the source output is starting + * @PINOS_SOURCE_OUTPUT_STATE_STREAMING: the source output is streaming + * + * The different source output states + */ +typedef enum { + PINOS_SOURCE_OUTPUT_STATE_ERROR = -1, + PINOS_SOURCE_OUTPUT_STATE_IDLE = 0, + PINOS_SOURCE_OUTPUT_STATE_STARTING = 1, + PINOS_SOURCE_OUTPUT_STATE_STREAMING = 2, +} PinosSourceOutputState; + /** * PinosSourceOutputInfo: * @id: generic id of the output * @client_path: the owner client * @source_path: the source path * @possible_formats: the possible formats + * @state: the state + * @format: when streaming, the current format * @properties: the properties of the source * * The source information. Extra information can be added in later @@ -180,6 +198,8 @@ typedef struct { const char *client_path; const char *source_path; GBytes *possible_formats; + PinosSourceOutputState state; + GBytes *format; PinosProperties *properties; } PinosSourceOutputInfo; diff --git a/src/dbus/org.pinos.xml b/src/dbus/org.pinos.xml index f6b4d4db8..783341760 100644 --- a/src/dbus/org.pinos.xml +++ b/src/dbus/org.pinos.xml @@ -93,12 +93,12 @@ + + + + + +