diff options
author | Wim Taymans <wtaymans@redhat.com> | 2015-07-15 18:23:05 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2015-07-15 18:29:21 +0200 |
commit | 0421d40d9caf4979af5183daa7607215c30ff8cc (patch) | |
tree | f409460ad1ac0dde00fa61a4b4b62900e5fc9285 /ext | |
parent | 1c00801585419ce78a1c7f0ed9a8b52678bb6aff (diff) |
pulse: add properties to GstDevice
Add the extra properties we get from pulse to the GstDevice we expose
with the device monitor
Diffstat (limited to 'ext')
-rw-r--r-- | ext/pulse/pulsedeviceprovider.c | 17 | ||||
-rw-r--r-- | ext/pulse/pulseutil.c | 22 | ||||
-rw-r--r-- | ext/pulse/pulseutil.h | 1 |
3 files changed, 35 insertions, 5 deletions
diff --git a/ext/pulse/pulsedeviceprovider.c b/ext/pulse/pulsedeviceprovider.c index d25cb04c9..8a292b972 100644 --- a/ext/pulse/pulsedeviceprovider.c +++ b/ext/pulse/pulsedeviceprovider.c @@ -40,7 +40,7 @@ GST_DEBUG_CATEGORY_EXTERN (pulse_debug); static GstDevice *gst_pulse_device_new (guint id, const gchar * device_name, GstCaps * caps, const gchar * internal_name, - GstPulseDeviceType type); + GstPulseDeviceType type, GstStructure * properties); G_DEFINE_TYPE (GstPulseDeviceProvider, gst_pulse_device_provider, GST_TYPE_DEVICE_PROVIDER); @@ -189,6 +189,7 @@ static GstDevice * new_source (const pa_source_info * info) { GstCaps *caps; + GstStructure *props; guint i; caps = gst_caps_new_empty (); @@ -196,14 +197,17 @@ new_source (const pa_source_info * info) for (i = 0; i < info->n_formats; i++) gst_caps_append (caps, gst_pulse_format_info_to_caps (info->formats[i])); + props = gst_pulse_make_structure (info->proplist); + return gst_pulse_device_new (info->index, info->description, - caps, info->name, GST_PULSE_DEVICE_TYPE_SOURCE); + caps, info->name, GST_PULSE_DEVICE_TYPE_SOURCE, props); } static GstDevice * new_sink (const pa_sink_info * info) { GstCaps *caps; + GstStructure *props; guint i; caps = gst_caps_new_empty (); @@ -211,8 +215,10 @@ new_sink (const pa_sink_info * info) for (i = 0; i < info->n_formats; i++) gst_caps_append (caps, gst_pulse_format_info_to_caps (info->formats[i])); + props = gst_pulse_make_structure (info->proplist); + return gst_pulse_device_new (info->index, info->description, - caps, info->name, GST_PULSE_DEVICE_TYPE_SINK); + caps, info->name, GST_PULSE_DEVICE_TYPE_SINK, props); } static void @@ -603,7 +609,8 @@ gst_pulse_device_reconfigure_element (GstDevice * device, GstElement * element) static GstDevice * gst_pulse_device_new (guint device_index, const gchar * device_name, - GstCaps * caps, const gchar * internal_name, GstPulseDeviceType type) + GstCaps * caps, const gchar * internal_name, GstPulseDeviceType type, + GstStructure * props) { GstPulseDevice *gstdev; const gchar *element = NULL; @@ -631,7 +638,7 @@ gst_pulse_device_new (guint device_index, const gchar * device_name, gstdev = g_object_new (GST_TYPE_PULSE_DEVICE, "display-name", device_name, "caps", caps, "device-class", klass, - "internal-name", internal_name, NULL); + "internal-name", internal_name, "properties", props, NULL); gstdev->type = type; gstdev->device_index = device_index; diff --git a/ext/pulse/pulseutil.c b/ext/pulse/pulseutil.c index 7bbc70b26..83aa4b640 100644 --- a/ext/pulse/pulseutil.c +++ b/ext/pulse/pulseutil.c @@ -376,6 +376,28 @@ gst_pulse_make_proplist (const GstStructure * properties) return proplist; } +GstStructure * +gst_pulse_make_structure (pa_proplist * properties) +{ + GstStructure *str; + void *state = NULL; + + str = gst_structure_new_empty ("pulse-proplist"); + + while (TRUE) { + const char *key, *val; + + key = pa_proplist_iterate (properties, &state); + if (key == NULL) + break; + + val = pa_proplist_gets (properties, key); + + gst_structure_set (str, key, G_TYPE_STRING, val, NULL); + } + return str; +} + static gboolean gst_pulse_format_info_int_prop_to_value (pa_format_info * format, const char *key, GValue * value) diff --git a/ext/pulse/pulseutil.h b/ext/pulse/pulseutil.h index 3b7293f0e..152c42d12 100644 --- a/ext/pulse/pulseutil.h +++ b/ext/pulse/pulseutil.h @@ -87,6 +87,7 @@ GstAudioRingBufferSpec *gst_pulse_channel_map_to_gst (const pa_channel_map * map void gst_pulse_cvolume_from_linear (pa_cvolume *v, unsigned channels, gdouble volume); pa_proplist *gst_pulse_make_proplist (const GstStructure *properties); +GstStructure *gst_pulse_make_structure (pa_proplist *properties); GstCaps * gst_pulse_format_info_to_caps (pa_format_info * format); |