mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
improve format filters
This commit is contained in:
parent
4bdbb58276
commit
22070ecbf8
4 changed files with 34 additions and 8 deletions
|
|
@ -300,6 +300,7 @@ spa_volume_node_port_enum_formats (SpaNode *node,
|
|||
uint8_t buffer[1024];
|
||||
SpaPODBuilder b = { NULL, };
|
||||
SpaPODFrame f[2];
|
||||
uint32_t count, match;
|
||||
|
||||
spa_return_val_if_fail (node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail (format != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
|
|
@ -308,10 +309,12 @@ spa_volume_node_port_enum_formats (SpaNode *node,
|
|||
|
||||
spa_return_val_if_fail (CHECK_PORT (this, direction, port_id), SPA_RESULT_INVALID_PORT);
|
||||
|
||||
count = match = filter ? 0 : index;
|
||||
|
||||
next:
|
||||
spa_pod_builder_init (&b, buffer, sizeof (buffer));
|
||||
|
||||
switch (index++) {
|
||||
switch (count++) {
|
||||
case 0:
|
||||
spa_pod_builder_format (&b, &f[0], this->type.format,
|
||||
this->type.media_type.audio, this->type.media_subtype.raw,
|
||||
|
|
@ -329,7 +332,7 @@ next:
|
|||
fmt = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaFormat);
|
||||
spa_pod_builder_init (&b, this->format_buffer, sizeof (this->format_buffer));
|
||||
|
||||
if ((res = spa_format_filter (fmt, filter, &b)) != SPA_RESULT_OK)
|
||||
if ((res = spa_format_filter (fmt, filter, &b)) != SPA_RESULT_OK || match++ != index)
|
||||
goto next;
|
||||
|
||||
*format = SPA_POD_BUILDER_DEREF (&b, 0, SpaFormat);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue