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);
new_source (const pa_source_info * info)
{
GstCaps *caps;
+ GstStructure *props;
guint i;
caps = gst_caps_new_empty ();
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 ();
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
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;
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;
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)