summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-12-17 17:34:10 +0100
committerWim Taymans <wtaymans@redhat.com>2019-12-17 17:34:10 +0100
commite9b62c0ce68a096b2ac1244f1588d19738936a5e (patch)
tree4e304d3cf3f6d51bf3885bf9361116748b444139
parent59c92bddbaa1717956a9c006946af373fa94e6b6 (diff)
v0: set media class
Set the media class on the client-node after we know the number of ports. Add more type mappings Fix change_mask on core_info
-rw-r--r--src/modules/module-client-node/v0/client-node.c9
-rw-r--r--src/modules/module-protocol-native/v0/protocol-native.c20
-rw-r--r--src/modules/module-protocol-native/v0/typemap.h12
3 files changed, 37 insertions, 4 deletions
diff --git a/src/modules/module-client-node/v0/client-node.c b/src/modules/module-client-node/v0/client-node.c
index 50bbda36..499f7ce6 100644
--- a/src/modules/module-client-node/v0/client-node.c
+++ b/src/modules/module-client-node/v0/client-node.c
@@ -903,6 +903,7 @@ static void setup_transport(struct impl *impl)
{
struct node *this = &impl->node;
uint32_t max_inputs = 0, max_outputs = 0, n_inputs = 0, n_outputs = 0;
+ struct spa_dict_item items[1];
n_inputs = this->n_inputs;
max_inputs = this->info.max_input_ports == 0 ? this->n_inputs : this->info.max_input_ports;
@@ -912,6 +913,13 @@ static void setup_transport(struct impl *impl)
impl->transport = pw_client_node0_transport_new(impl->context, max_inputs, max_outputs);
impl->transport->area->n_input_ports = n_inputs;
impl->transport->area->n_output_ports = n_outputs;
+
+ if (n_inputs > 0) {
+ items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_MEDIA_CLASS, "Stream/Input/Video");
+ } else {
+ items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_MEDIA_CLASS, "Stream/Output/Video");
+ }
+ pw_impl_node_update_properties(impl->this.node, &SPA_DICT_INIT(items, 1));
}
static void
@@ -1292,7 +1300,6 @@ struct pw_impl_client_node0 *pw_impl_client_node0_new(struct pw_resource *resour
if ((name = pw_properties_get(properties, "node.name")) == NULL)
name = "client-node";
pw_properties_set(properties, PW_KEY_MEDIA_TYPE, "Video");
- pw_properties_set(properties, SPA_KEY_MEDIA_CLASS, "Stream/Duplex/Video");
impl->node.resource = resource;
this->resource = resource;
diff --git a/src/modules/module-protocol-native/v0/protocol-native.c b/src/modules/module-protocol-native/v0/protocol-native.c
index e5d4e00d..fbd80a88 100644
--- a/src/modules/module-protocol-native/v0/protocol-native.c
+++ b/src/modules/module-protocol-native/v0/protocol-native.c
@@ -75,22 +75,38 @@ static void core_marshal_info(void *object, const struct pw_core_info *info)
struct pw_resource *resource = object;
struct spa_pod_builder *b;
uint32_t i, n_items;
- struct spa_pod_frame f;
+ uint64_t change_mask = 0;
+ struct spa_pod_frame f;
struct pw_protocol_native_message *msg;
b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_INFO, &msg);
+#define PW_CORE_V0_CHANGE_MASK_USER_NAME (1 << 0)
+#define PW_CORE_V0_CHANGE_MASK_HOST_NAME (1 << 1)
+#define PW_CORE_V0_CHANGE_MASK_VERSION (1 << 2)
+#define PW_CORE_V0_CHANGE_MASK_NAME (1 << 3)
+#define PW_CORE_V0_CHANGE_MASK_COOKIE (1 << 4)
+#define PW_CORE_V0_CHANGE_MASK_PROPS (1 << 5)
+
if (msg->seq == 0) {
update_types_server(resource);
b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_INFO, &msg);
+ change_mask |= PW_CORE_V0_CHANGE_MASK_USER_NAME |
+ PW_CORE_V0_CHANGE_MASK_HOST_NAME |
+ PW_CORE_V0_CHANGE_MASK_VERSION |
+ PW_CORE_V0_CHANGE_MASK_NAME |
+ PW_CORE_V0_CHANGE_MASK_COOKIE;
}
n_items = info->props ? info->props->n_items : 0;
+ if (info->change_mask & PW_CORE_CHANGE_MASK_PROPS)
+ change_mask |= PW_CORE_V0_CHANGE_MASK_PROPS;
+
spa_pod_builder_push_struct(b, &f);
spa_pod_builder_add(b,
"i", info->id,
- "l", info->change_mask,
+ "l", change_mask,
"s", info->user_name,
"s", info->host_name,
"s", info->version,
diff --git a/src/modules/module-protocol-native/v0/typemap.h b/src/modules/module-protocol-native/v0/typemap.h
index b8ea4704..e4978fc0 100644
--- a/src/modules/module-protocol-native/v0/typemap.h
+++ b/src/modules/module-protocol-native/v0/typemap.h
@@ -17,8 +17,18 @@ const struct type_info {
{ "PipeWire:Interface:Link", PW_TYPE_INFO_INTERFACE_BASE "Link", PW_TYPE_INTERFACE_Link, },
{ "PipeWire:Interface:Client", PW_TYPE_INFO_INTERFACE_BASE "Client", PW_TYPE_INTERFACE_Client, },
{ "PipeWire:Interface:Module", PW_TYPE_INFO_INTERFACE_BASE "Module", PW_TYPE_INTERFACE_Module, },
- { "PipeWire:Interface:ClientNode", PW_TYPE_INFO_INTERFACE_BASE "ClientNode", PW_TYPE_INTERFACE_ClientNode, },
{ "PipeWire:Interface:Device", PW_TYPE_INFO_INTERFACE_BASE "Device", PW_TYPE_INTERFACE_Device, },
+
+ { "PipeWire:Interface:Metadata", PW_TYPE_INFO_INTERFACE_BASE "Metadata", PW_TYPE_INTERFACE_Metadata, },
+ { "PipeWire:Interface:Session", PW_TYPE_INFO_INTERFACE_BASE "Session", PW_TYPE_INTERFACE_Session, },
+ { "PipeWire:Interface:Endpoint", PW_TYPE_INFO_INTERFACE_BASE "Endpoint", PW_TYPE_INTERFACE_Endpoint, },
+ { "PipeWire:Interface:EndpointStream", PW_TYPE_INFO_INTERFACE_BASE "EndpointStream", PW_TYPE_INTERFACE_EndpointStream, },
+ { "PipeWire:Interface:EndpointLink", PW_TYPE_INFO_INTERFACE_BASE "EndpointLink", PW_TYPE_INTERFACE_EndpointLink, },
+
+ { "PipeWire:Interface:ClientNode", PW_TYPE_INFO_INTERFACE_BASE "ClientNode", PW_TYPE_INTERFACE_ClientNode, },
+ { "PipeWire:Interface:ClientSession", PW_TYPE_INFO_INTERFACE_BASE "ClientSession", PW_TYPE_INTERFACE_ClientSession, },
+ { "PipeWire:Interface:ClientEndpoint", PW_TYPE_INFO_INTERFACE_BASE "ClientEndpoint", PW_TYPE_INTERFACE_ClientEndpoint, },
+
{ "Spa:Interface:Node", SPA_TYPE_INFO_INTERFACE_BASE "Node", SPA_TYPE_INTERFACE_Node, },
{ "Spa:Interface:Clock", },
{ "Spa:Interface:Monitor", },