PipeWire 0.1.9

Public Member Functions | Data Fields
pw_properties Class Reference

A collection of key/value pairs. More...

## Public Member Functions
struct pw_properties * | pw_properties_new (const char *key,...)
| Make a new properties object. More...
struct pw_properties * | pw_properties_new_dict (const struct spa_dict *dict)
| Make a new properties object from the given dictionary. More...
struct pw_properties * | pw_properties_new_string (const char *str)
| Make a new properties object from the given str. More...
struct pw_properties * | pw_properties_copy (const struct pw_properties *properties)
| Copy a properties object. More...
struct pw_properties * | pw_properties_merge (const struct pw_properties *oldprops, struct pw_properties *newprops)
| Merge properties into one. More...
void | pw_properties_free (struct pw_properties *properties)
| Free a properties object. More...
int | pw_properties_set (struct pw_properties *properties, const char *key, const char *value)
| Set a property value. More...
int | pw_properties_setf (struct pw_properties *properties, const char *key, const char *format,...)
| Set a property value by format. More...
const char * | pw_properties_get (const struct pw_properties *properties, const char *key)
| Get a property. More...
const char * | pw_properties_iterate (const struct pw_properties *properties, void **state)
| Iterate property values. More...

## Data Fields
struct spa_dict | dict

## Detailed Description

A collection of key/value pairs.

Properties are used to pass around arbitrary key/value pairs. Both keys and values are strings which keeps things simple. Encoding of arbitrary values should be done by using a string serialization such as base64 for binary blobs.

## Member Function Documentation

## ◆ pw_properties_copy()

struct pw_properties * pw_properties_copy | ( | const struct pw_properties * | properties | ) |

Copy a properties object.

Parameters

  properties | properties to copy

Returns
  a new properties object

References pw_array_for_each, and pw_properties_new().

Referenced by pw_properties_merge().

## ◆ pw_properties_free()

void pw_properties_free | ( | struct pw_properties * | properties | ) |

Free a properties object.

Parameters

  properties | the properties to free

References pw_array_for_each.

Referenced by pw_core::pw_core_destroy(), pw_factory_destroy(), pw_global::pw_global_destroy(), pw_remote_destroy(), and pw_remote_new().

## ◆ pw_properties_get()

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

Get a property.

Parameters

  properties | a pw_properties
  key | a key

Returns
  the property for key or NULL when the key was not found

Get the property in properties with key.

Referenced by pw_core::pw_core_new(), pw_pipewire::pw_fill_remote_properties(), pw_link_new(), pw_port_add(), pw_properties_merge(), pw_remote_new(), and pw_stream_new().

## ◆ pw_properties_iterate()

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

Iterate property values.

Parameters

  properties | a pw_properties
  state | state

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::pw_array_check_index, and pw_array::pw_array_get_unchecked.

Referenced by pw_properties_merge().

## ◆ pw_properties_merge()

struct pw_properties * pw_properties_merge | ( | const struct pw_properties * | oldprops,
|  | struct pw_properties * | newprops
| ) |  |

Merge properties into one.

Parameters

  oldprops | properties to merge into
  newprops | properties to merge

Returns
  a newly allocated pw_properties

A new pw_properties is allocated and the properties of oldprops and newprops are copied into it in that order.

References pw_properties_copy(), pw_properties_get(), pw_properties_iterate(), and pw_properties_set().

## ◆ pw_properties_new()

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

Make a new properties object.

Parameters

  key | a first key
  ... | value and more keys NULL terminated

Returns
  a newly allocated properties object

Referenced by pw_client::pw_client_new(), pw_core::pw_core_new(), pw_factory_register(), pw_link_register(), pw_node_new(), pw_node_register(), pw_port_new(), pw_properties_copy(), pw_remote_new(), and pw_stream_new().

## ◆ pw_properties_new_dict()

struct pw_properties * pw_properties_new_dict | ( | const struct spa_dict * | dict | ) |

Make a new properties object from the given dictionary.

Parameters

  dict | a dictionary. keys and values are copied

Returns
  a new properties object

Referenced by pw_client::pw_client_update_properties().

## ◆ pw_properties_new_string()

struct pw_properties * pw_properties_new_string | ( | const char * | str | ) |

Make a new properties object from the given str.

str should be a whitespace separated list of key=value strings.

Parameters

  args | a property description

Returns
  a new properties object

## ◆ pw_properties_set()

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

Set a property value.

Parameters

  properties | the properties to change
  key | a key
  value | a value or NULL to remove the key

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_client::pw_client_update_properties(), pw_core::pw_core_update_properties(), pw_factory_register(), pw_pipewire::pw_fill_remote_properties(), pw_node_update_properties(), pw_port_add(), pw_port_update_properties(), pw_properties_merge(), and pw_stream_new().

## ◆ pw_properties_setf()

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

Set a property value by format.

Parameters

  properties | a pw_properties
  key | a key
  format | a value
  ... | extra arguments

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

Referenced by pw_client::pw_client_new(), pw_core::pw_core_new(), pw_factory_register(), pw_pipewire::pw_fill_remote_properties(), pw_link_register(), and pw_port_add().

## Field Documentation

## ◆ dict

struct spa_dict pw_properties::dict

Referenced by pw_core::pw_core_new(), pw_factory_new(), and pw_port_new().

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

- properties.h
- properties.c