mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
props: make properties dynamic keys and values
This commit is contained in:
parent
048a4b81a8
commit
e28b5f91b8
15 changed files with 271 additions and 223 deletions
|
|
@ -31,19 +31,18 @@
|
|||
#include "spa-node.h"
|
||||
|
||||
static SpaResult
|
||||
setup_video_node (SpaNode *spa_node, PinosProperties *pinos_props) {
|
||||
setup_video_node (PinosCore *core, SpaNode *spa_node, PinosProperties *pinos_props) {
|
||||
SpaResult res;
|
||||
SpaProps *props;
|
||||
SpaPODProp *prop;
|
||||
const char *pattern;
|
||||
uint32_t pattern_int;
|
||||
const char *pattern, *pattern_uri;
|
||||
|
||||
/* Retrieve pattern property */
|
||||
pattern = pinos_properties_get (pinos_props, "pattern");
|
||||
if (strcmp (pattern, "smpte-snow") == 0) {
|
||||
pattern_int = 0;
|
||||
pattern_uri = SPA_PROPS__patternType ":smpte-snow";
|
||||
} else if (strcmp (pattern, "snow") == 0) {
|
||||
pattern_int = 1;
|
||||
pattern_uri = SPA_PROPS__patternType ":snow";
|
||||
} else {
|
||||
pinos_log_debug ("Unrecognized pattern");
|
||||
return SPA_RESULT_ERROR;
|
||||
|
|
@ -54,9 +53,9 @@ setup_video_node (SpaNode *spa_node, PinosProperties *pinos_props) {
|
|||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
|
||||
if ((prop = spa_pod_object_find_prop (props, 2))) {
|
||||
if (prop->body.value.type == SPA_POD_TYPE_INT)
|
||||
((SpaPODInt*)&prop->body.value)->value = pattern_int;
|
||||
if ((prop = spa_pod_object_find_prop (props, spa_id_map_get_id (core->uri.map, SPA_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);
|
||||
}
|
||||
|
||||
if ((res = spa_node_set_props (spa_node, props)) != SPA_RESULT_OK) {
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ pinos_spa_node_load (PinosCore *core,
|
|||
this = &impl->this;
|
||||
|
||||
if (setup_func != NULL) {
|
||||
if (setup_func (spa_node, properties) != SPA_RESULT_OK) {
|
||||
if (setup_func (core, spa_node, properties) != SPA_RESULT_OK) {
|
||||
pinos_log_debug ("Unrecognized properties");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ struct _PinosSpaNode {
|
|||
PinosSpaNode *node));
|
||||
};
|
||||
|
||||
typedef SpaResult (*SetupNode) (SpaNode *spa_node,
|
||||
typedef SpaResult (*SetupNode) (PinosCore *core,
|
||||
SpaNode *spa_node,
|
||||
PinosProperties *pinos_props);
|
||||
|
||||
PinosSpaNode * pinos_spa_node_load (PinosCore *core,
|
||||
|
|
@ -47,7 +48,7 @@ PinosSpaNode * pinos_spa_node_load (PinosCore *core,
|
|||
const char *factory_name,
|
||||
const char *name,
|
||||
PinosProperties *properties,
|
||||
SetupNode setup_func);
|
||||
SetupNode setup_func);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue