PipeWire  0.3.29
pw_properties Struct Reference

Public Member Functions

SPA_EXPORT struct pw_propertiespw_properties_new (const char *key,...)
 Make a new properties object. More...
 
SPA_EXPORT struct pw_propertiespw_properties_new_dict (const struct spa_dict *dict)
 Make a new properties object from the given dictionary. More...
 
SPA_EXPORT struct pw_propertiespw_properties_new_string (const char *object)
 Make a new properties object from the given str. More...
 
SPA_EXPORT struct pw_propertiespw_properties_copy (const struct pw_properties *properties)
 Copy a properties object. More...
 
SPA_EXPORT int pw_properties_update_keys (struct pw_properties *props, const struct spa_dict *dict, const char *keys[])
 Copy multiple keys from one property to another. More...
 
SPA_EXPORT void pw_properties_clear (struct pw_properties *properties)
 Clear a properties object. More...
 
SPA_EXPORT int pw_properties_update (struct pw_properties *props, const struct spa_dict *dict)
 Update properties. More...
 
SPA_EXPORT int pw_properties_add (struct pw_properties *props, const struct spa_dict *dict)
 Add properties. More...
 
SPA_EXPORT int pw_properties_add_keys (struct pw_properties *props, const struct spa_dict *dict, const char *keys[])
 Add keys. More...
 
SPA_EXPORT void pw_properties_free (struct pw_properties *properties)
 Free a properties object. More...
 
SPA_EXPORT int pw_properties_set (struct pw_properties *properties, const char *key, const char *value)
 Set a property value. More...
 
SPA_EXPORT int pw_properties_setf (struct pw_properties *properties, const char *key, const char *format,...)
 Set a property value by format. More...
 
SPA_EXPORT const char * pw_properties_get (const struct pw_properties *properties, const char *key)
 Get a property. More...
 
SPA_EXPORT const char * pw_properties_iterate (const struct pw_properties *properties, void **state)
 Iterate property values. More...
 

Data Fields

struct spa_dict dict
 dictionary of key/values More...
 
uint32_t flags
 extra flags More...
 

Member Function Documentation

◆ pw_properties_add()

SPA_EXPORT int pw_properties_add ( struct pw_properties props,
const struct spa_dict dict 
)

Add properties.

Parameters
propsproperties to add
dictnew properties
Returns
the number of added properties

The properties from dict that are not yet in props are added.

References spa_dict::items, spa_dict_item::key, spa_dict::n_items, pw_properties_get(), pw_properties_set(), and spa_dict_item::value.

◆ pw_properties_add_keys()

SPA_EXPORT int pw_properties_add_keys ( struct pw_properties props,
const struct spa_dict dict,
const char *  keys[] 
)

Add keys.

Parameters
propsproperties to add
dictnew properties
keysa NULL terminated list of keys to add
Returns
the number of added properties

The properties with keys from dict that are not yet in props are added.

References pw_properties_get(), pw_properties_set(), and spa_dict_lookup().

◆ pw_properties_clear()

SPA_EXPORT void pw_properties_clear ( struct pw_properties properties)

Clear a properties object.

Parameters
propertiesproperties to clear

References pw_array_for_each, and SPA_CONTAINER_OF.

Referenced by pw_properties_free().

◆ pw_properties_copy()

SPA_EXPORT struct pw_properties * pw_properties_copy ( const struct pw_properties properties)

Copy a properties object.

Parameters
propertiesproperties to copy
Returns
a new properties object

References dict, and pw_properties_new_dict().

◆ pw_properties_free()

SPA_EXPORT void pw_properties_free ( struct pw_properties properties)

Free a properties object.

Parameters
propertiesthe properties to free

References pw_properties_clear(), and SPA_CONTAINER_OF.

Referenced by pw_context_create_core(), pw_context_create_factory(), pw_context_destroy(), pw_impl_core_destroy(), pw_impl_factory_destroy(), and pw_impl_module_destroy().

◆ pw_properties_get()

SPA_EXPORT const char * pw_properties_get ( const struct pw_properties properties,
const char *  key 
)

Get a property.

Parameters
propertiesa Key-Value pairs
keya key
Returns
the property for key or NULL when the key was not found

Get the property in properties with key.

References SPA_CONTAINER_OF.

Referenced by pw_context_create_core(), pw_context_get_conf_section(), pw_context_new(), pw_context_parse_conf_section(), pw_filter_connect(), pw_properties_add(), and pw_properties_add_keys().

◆ pw_properties_iterate()

SPA_EXPORT const char * pw_properties_iterate ( const struct pw_properties properties,
void **  state 
)

Iterate property values.

Parameters
propertiesa Key-Value pairs
statestate
Returns
The next key or NULL when there are no more keys to iterate.

Iterate over properties, returning each key in turn. state should point to a pointer holding NULL to get the first element and will be updated after each iteration. When NULL is returned, all elements have been iterated.

References pw_array_check_index, pw_array_get_unchecked, SPA_CONTAINER_OF, SPA_INT_TO_PTR, and SPA_PTR_TO_INT.

◆ pw_properties_new()

SPA_EXPORT struct pw_properties * pw_properties_new ( const char *  key,
  ... 
)

Make a new properties object.

Parameters
keya first key
...value and more keys NULL terminated
Returns
a newly allocated properties object

Referenced by pw_context_connect_self(), pw_context_create_client(), pw_context_create_core(), pw_context_create_device(), pw_context_create_factory(), pw_context_create_node(), pw_context_create_port(), pw_context_new(), pw_filter_add_port(), pw_filter_new_simple(), pw_global_new(), and pw_stream_new_simple().

◆ pw_properties_new_dict()

SPA_EXPORT struct pw_properties * pw_properties_new_dict ( const struct spa_dict dict)

Make a new properties object from the given dictionary.

Parameters
dicta dictionary. keys and values are copied
Returns
a new properties object

Referenced by pw_context_create_port(), and pw_properties_copy().

◆ pw_properties_new_string()

SPA_EXPORT struct pw_properties * pw_properties_new_string ( const char *  object)

Make a new properties object from the given str.

object should be a whitespace separated list of key=value strings or a json object.

Parameters
objecta property description
Returns
a new properties object

References res.

◆ pw_properties_set()

SPA_EXPORT int pw_properties_set ( struct pw_properties properties,
const char *  key,
const char *  value 
)

Set a property value.

Parameters
propertiesthe properties to change
keya key
valuea value or NULL to remove the key
Returns
1 if the properties were changed. 0 if nothing was changed because the property already existed with the same value or because the key to remove did not exist.

Set the property in properties with key to value. Any previous value of key will be overwritten. When value is NULL, the key will be removed.

Referenced by pw_context_connect_self(), pw_context_create_port(), pw_properties_add(), pw_properties_add_keys(), pw_properties_update(), pw_properties_update_keys(), and pw_properties_update_string().

◆ pw_properties_setf()

SPA_EXPORT int pw_properties_setf ( struct pw_properties properties,
const char *  key,
const char *  format,
  ... 
)

Set a property value by format.

Parameters
propertiesa Key-Value pairs
keya key
formata value
...extra arguments
Returns
1 if the property was changed. 0 if nothing was changed because the property already existed with the same value or because the key to remove did not exist.

Set the property in properties with key to the value in printf style format Any previous value of key will be overwritten.

References spa_dict_item::key, pw_properties_setva(), res, va_end(), and va_start().

Referenced by pw_context_create_core(), and pw_context_create_port().

◆ pw_properties_update()

SPA_EXPORT int pw_properties_update ( struct pw_properties props,
const struct spa_dict dict 
)

Update properties.

Parameters
propsproperties to update
dictnew properties
Returns
the number of changed properties

The properties in props are updated with dict. Keys in dict with NULL values are removed from props.

References spa_dict_item::key, pw_properties_set(), spa_dict_for_each, and spa_dict_item::value.

Referenced by pw_context_update_properties(), pw_core_update_properties(), pw_filter_update_properties(), pw_impl_core_update_properties(), pw_impl_factory_update_properties(), pw_impl_module_update_properties(), and pw_stream_update_properties().

◆ pw_properties_update_keys()

SPA_EXPORT int pw_properties_update_keys ( struct pw_properties props,
const struct spa_dict dict,
const char *  keys[] 
)

Copy multiple keys from one property to another.

Parameters
propsproperties to copy to
dictproperties to copy from
keysa NULL terminated list of keys to copy
Returns
the number of keys changed in dest

References dict, pw_properties_set(), and spa_dict_lookup().

Referenced by pw_global_update_keys().

Field Documentation

◆ dict

◆ flags

uint32_t pw_properties::flags

extra flags


The documentation for this struct was generated from the following files: