pulse-server: rework audioinfo argument parsing

Make a new method to parse parts of the audioinfo based on custom
keys, leaving unparsed values to defaults. Implement the generic audio
parsing with this.

We can then remove some duplicate code where the audio keys didn't match
or where only parts of the info needed to be parsed.

Also make a method to serialize the audioinfo to properties and use that
when making arguments to load the modules.

Avoid doing some custom property serialization, move all key/values into
properties and serialize those with the generic functions.
This commit is contained in:
Wim Taymans 2023-05-04 18:43:08 +02:00
parent 11c478d0fa
commit 37210794d8
16 changed files with 227 additions and 409 deletions

View file

@ -70,5 +70,12 @@ void module_add_listener(struct module *module,
void module_args_add_props(struct pw_properties *props, const char *str);
int module_args_to_audioinfo(struct impl *impl, struct pw_properties *props, struct spa_audio_info_raw *info);
bool module_args_parse_bool(const char *str);
int module_args_to_audioinfo_keys(struct impl *impl, struct pw_properties *props,
const char *key_format, const char *key_rate,
const char *key_channels, const char *key_channel_map,
struct spa_audio_info_raw *info);
void audioinfo_to_properties(struct spa_audio_info_raw *info, struct pw_properties *props);
#endif