params: make method on node and port to enum params

Do not pass the params of the node in the node_info, instead,
make a method to enumerate the params. This makes it possible for
clients to only enumerate what they need and when they need it.
Improve introspection of a port, add the name and properties.
Add an enum_param method on the port that can be used to enumerate
port formats.
Change -monitor and -cli and add support for enum_params on the node
and port.
This commit is contained in:
Wim Taymans 2018-02-20 10:31:55 +01:00
parent a9a95a4205
commit 58667d6ced
14 changed files with 977 additions and 259 deletions

View file

@ -200,30 +200,24 @@ new_node (GstPipeWireDeviceProvider *self, const struct pw_node_info *info, uint
const gchar *klass = NULL;
const struct spa_dict_item *item;
GstPipeWireDeviceType type;
int i;
struct pw_type *t = self->type;
caps = gst_caps_new_empty ();
#if 0
int i;
struct pw_type *t = self->type;
for (i = 0; i < info->n_params; i++) {
if (!spa_pod_is_object_id(info->params[i], t->param.idEnumFormat))
continue;
GstCaps *c1 = gst_caps_from_format (info->params[i], t->map);
if (c1)
gst_caps_append (caps, c1);
}
#endif
if (info->max_input_ports > 0 && info->max_output_ports == 0) {
type = GST_PIPEWIRE_DEVICE_TYPE_SINK;
for (i = 0; i < info->n_input_params; i++) {
if (!spa_pod_is_object_id(info->input_params[i], t->param.idEnumFormat))
continue;
GstCaps *c1 = gst_caps_from_format (info->input_params[i], t->map);
if (c1)
gst_caps_append (caps, c1);
}
}
else if (info->max_output_ports > 0 && info->max_input_ports == 0) {
} else if (info->max_output_ports > 0 && info->max_input_ports == 0) {
type = GST_PIPEWIRE_DEVICE_TYPE_SOURCE;
for (i = 0; i < info->n_output_params; i++) {
if (!spa_pod_is_object_id(info->output_params[i], t->param.idEnumFormat))
continue;
GstCaps *c1 = gst_caps_from_format (info->output_params[i], t->map);
if (c1)
gst_caps_append (caps, c1);
}
} else {
gst_caps_unref(caps);
return NULL;