mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-11 13:30:07 -05:00
types: more work on types
This commit is contained in:
parent
acedfe71c0
commit
5825c62d6d
76 changed files with 1713 additions and 1477 deletions
|
|
@ -35,14 +35,14 @@ setup_video_node (PinosCore *core, SpaNode *spa_node, PinosProperties *pinos_pro
|
|||
SpaResult res;
|
||||
SpaProps *props;
|
||||
SpaPODProp *prop;
|
||||
const char *pattern, *pattern_uri;
|
||||
const char *pattern, *pattern_type;
|
||||
|
||||
/* Retrieve pattern property */
|
||||
pattern = pinos_properties_get (pinos_props, "pattern");
|
||||
if (strcmp (pattern, "smpte-snow") == 0) {
|
||||
pattern_uri = SPA_TYPE_PROPS__patternType ":smpte-snow";
|
||||
pattern_type = SPA_TYPE_PROPS__patternType ":smpte-snow";
|
||||
} else if (strcmp (pattern, "snow") == 0) {
|
||||
pattern_uri = SPA_TYPE_PROPS__patternType ":snow";
|
||||
pattern_type = SPA_TYPE_PROPS__patternType ":snow";
|
||||
} else {
|
||||
pinos_log_debug ("Unrecognized pattern");
|
||||
return SPA_RESULT_ERROR;
|
||||
|
|
@ -53,9 +53,9 @@ setup_video_node (PinosCore *core, SpaNode *spa_node, PinosProperties *pinos_pro
|
|||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
|
||||
if ((prop = spa_pod_object_find_prop (props, spa_id_map_get_id (core->uri.map, SPA_TYPE_PROPS__patternType)))) {
|
||||
if ((prop = spa_pod_object_find_prop (props, spa_type_map_get_id (core->type.map, SPA_TYPE_PROPS__patternType)))) {
|
||||
if (prop->body.value.type == SPA_POD_TYPE_URI)
|
||||
SPA_POD_VALUE (SpaPODURI, &prop->body.value) = spa_id_map_get_id (core->uri.map, pattern_uri);
|
||||
SPA_POD_VALUE (SpaPODURI, &prop->body.value) = spa_type_map_get_id (core->type.map, pattern_type);
|
||||
}
|
||||
|
||||
if ((res = spa_node_set_props (spa_node, props)) != SPA_RESULT_OK) {
|
||||
|
|
|
|||
|
|
@ -67,11 +67,11 @@ add_item (PinosSpaMonitor *this, SpaMonitorItem *item)
|
|||
SpaPOD *info = NULL;
|
||||
|
||||
spa_pod_object_query (item,
|
||||
impl->core->uri.monitor_types.name, SPA_POD_TYPE_STRING, &name,
|
||||
impl->core->uri.monitor_types.id, SPA_POD_TYPE_STRING, &id,
|
||||
impl->core->uri.monitor_types.klass, SPA_POD_TYPE_STRING, &klass,
|
||||
impl->core->uri.monitor_types.factory, SPA_POD_TYPE_POINTER, &factory,
|
||||
impl->core->uri.monitor_types.info, SPA_POD_TYPE_STRUCT, &info,
|
||||
impl->core->type.monitor.name, SPA_POD_TYPE_STRING, &name,
|
||||
impl->core->type.monitor.id, SPA_POD_TYPE_STRING, &id,
|
||||
impl->core->type.monitor.klass, SPA_POD_TYPE_STRING, &klass,
|
||||
impl->core->type.monitor.factory, SPA_POD_TYPE_POINTER, &factory,
|
||||
impl->core->type.monitor.info, SPA_POD_TYPE_STRUCT, &info,
|
||||
0);
|
||||
|
||||
pinos_log_debug ("monitor %p: add: \"%s\" (%s)", this, name, id);
|
||||
|
|
@ -85,11 +85,11 @@ add_item (PinosSpaMonitor *this, SpaMonitorItem *item)
|
|||
pinos_log_error ("can't make factory instance: %d", res);
|
||||
return;
|
||||
}
|
||||
if ((res = spa_handle_get_interface (handle, impl->core->uri.spa_node, &node_iface)) < 0) {
|
||||
if ((res = spa_handle_get_interface (handle, impl->core->type.spa_node, &node_iface)) < 0) {
|
||||
pinos_log_error ("can't get NODE interface: %d", res);
|
||||
return;
|
||||
}
|
||||
if ((res = spa_handle_get_interface (handle, impl->core->uri.spa_clock, &clock_iface)) < 0) {
|
||||
if ((res = spa_handle_get_interface (handle, impl->core->type.spa_clock, &clock_iface)) < 0) {
|
||||
pinos_log_info ("no CLOCK interface: %d", res);
|
||||
}
|
||||
|
||||
|
|
@ -151,8 +151,8 @@ remove_item (PinosSpaMonitor *this, SpaMonitorItem *item)
|
|||
const char *name, *id;
|
||||
|
||||
spa_pod_object_query (item,
|
||||
impl->core->uri.monitor_types.name, SPA_POD_TYPE_STRING, &name,
|
||||
impl->core->uri.monitor_types.id, SPA_POD_TYPE_STRING, &id,
|
||||
impl->core->type.monitor.name, SPA_POD_TYPE_STRING, &name,
|
||||
impl->core->type.monitor.id, SPA_POD_TYPE_STRING, &id,
|
||||
0);
|
||||
|
||||
pinos_log_debug ("monitor %p: remove: \"%s\" (%s)", this, name, id);
|
||||
|
|
@ -169,20 +169,20 @@ on_monitor_event (SpaMonitor *monitor,
|
|||
PinosSpaMonitor *this = user_data;
|
||||
PinosSpaMonitorImpl *impl = SPA_CONTAINER_OF (this, PinosSpaMonitorImpl, this);
|
||||
|
||||
if (SPA_EVENT_TYPE (event) == impl->core->uri.monitor_types.Added) {
|
||||
if (SPA_EVENT_TYPE (event) == impl->core->type.monitor.Added) {
|
||||
SpaMonitorItem *item = SPA_POD_CONTENTS (SpaEvent, event);
|
||||
add_item (this, item);
|
||||
}
|
||||
else if (SPA_EVENT_TYPE (event) == impl->core->uri.monitor_types.Removed) {
|
||||
else if (SPA_EVENT_TYPE (event) == impl->core->type.monitor.Removed) {
|
||||
SpaMonitorItem *item = SPA_POD_CONTENTS (SpaEvent, event);
|
||||
remove_item (this, item);
|
||||
}
|
||||
else if (SPA_EVENT_TYPE (event) == impl->core->uri.monitor_types.Changed) {
|
||||
else if (SPA_EVENT_TYPE (event) == impl->core->type.monitor.Changed) {
|
||||
SpaMonitorItem *item = SPA_POD_CONTENTS (SpaEvent, event);
|
||||
const char *name;
|
||||
|
||||
spa_pod_object_query (item,
|
||||
impl->core->uri.monitor_types.name, SPA_POD_TYPE_STRING, &name,
|
||||
impl->core->type.monitor.name, SPA_POD_TYPE_STRING, &name,
|
||||
0);
|
||||
|
||||
pinos_log_debug ("monitor %p: changed: \"%s\"", this, name);
|
||||
|
|
@ -253,7 +253,7 @@ pinos_spa_monitor_load (PinosCore *core,
|
|||
goto init_failed;
|
||||
}
|
||||
if ((res = spa_handle_get_interface (handle,
|
||||
core->uri.spa_monitor,
|
||||
core->type.spa_monitor,
|
||||
&iface)) < 0) {
|
||||
free (handle);
|
||||
pinos_log_error ("can't get MONITOR interface: %d", res);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ pinos_spa_node_load (PinosCore *core,
|
|||
goto init_failed;
|
||||
}
|
||||
if ((res = spa_handle_get_interface (handle,
|
||||
core->uri.spa_node,
|
||||
core->type.spa_node,
|
||||
&iface)) < 0) {
|
||||
pinos_log_error ("can't get interface %d", res);
|
||||
goto interface_failed;
|
||||
|
|
@ -89,7 +89,7 @@ pinos_spa_node_load (PinosCore *core,
|
|||
spa_node = iface;
|
||||
|
||||
if ((res = spa_handle_get_interface (handle,
|
||||
core->uri.spa_clock,
|
||||
core->type.spa_clock,
|
||||
&iface)) < 0) {
|
||||
iface = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue