format: make helper functions to create formats

Use helper functions to create a fully specified format.
This commit is contained in:
Wim Taymans 2018-08-29 15:53:26 +02:00
parent 80de83f38a
commit 514528f2c7
24 changed files with 158 additions and 430 deletions

View file

@ -379,14 +379,12 @@ static int negotiate_formats(struct data *data)
uint8_t buffer[4096];
spa_pod_builder_init(&b, buffer, sizeof(buffer));
filter = spa_pod_builder_object(&b,
SPA_TYPE_OBJECT_Format, 0,
"I", SPA_MEDIA_TYPE_audio,
"I", SPA_MEDIA_SUBTYPE_raw,
":", SPA_FORMAT_AUDIO_format, "I", SPA_AUDIO_FORMAT_S16,
":", SPA_FORMAT_AUDIO_layout, "I", SPA_AUDIO_LAYOUT_INTERLEAVED,
":", SPA_FORMAT_AUDIO_rate, "i", 44100,
":", SPA_FORMAT_AUDIO_channels, "i", 2);
filter = spa_format_audio_raw_build(&b, 0,
&SPA_AUDIO_INFO_RAW_INIT(
.format = SPA_AUDIO_FORMAT_S16,
.layout = SPA_AUDIO_LAYOUT_INTERLEAVED,
.rate = 44100,
.channels = 2 ));
spa_debug_pod(0, spa_debug_types, filter);