Improve negotiation

Fix selection of the default property value by restricting it to
something in the valid range of the property.
Fix audio/videotestsrc reuse
Fix format enum with filters.
Fix module property configuration
Fix connection refill
This commit is contained in:
Wim Taymans 2017-03-01 14:07:02 +01:00
parent 282995d0d0
commit 710a1a41e6
13 changed files with 131 additions and 81 deletions

View file

@ -74,8 +74,7 @@ spa_alsa_sink_node_get_props (SpaNode *node,
this = SPA_CONTAINER_OF (node, SpaALSASink, node);
b.data = this->props_buffer;
b.size = sizeof (this->props_buffer);
spa_pod_builder_init (&b, this->props_buffer, sizeof (this->props_buffer));
*props = SPA_MEMBER (b.data, spa_pod_builder_props (&b,
PROP_ID_DEVICE, SPA_POD_TYPE_STRING,
@ -329,7 +328,7 @@ spa_alsa_sink_node_port_enum_formats (SpaNode *node,
SpaResult res;
SpaFormat *fmt;
uint8_t buffer[1024];
SpaPODBuilder b = { buffer, sizeof (buffer), };
SpaPODBuilder b = { NULL, };
if (node == NULL || format == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
@ -339,7 +338,10 @@ spa_alsa_sink_node_port_enum_formats (SpaNode *node,
if (!CHECK_PORT (this, direction, port_id))
return SPA_RESULT_INVALID_PORT;
switch (index) {
next:
spa_pod_builder_init (&b, buffer, sizeof (buffer));
switch (index++) {
case 0:
fmt = SPA_MEMBER (buffer, spa_pod_builder_format (&b,
SPA_MEDIA_TYPE_AUDIO, SPA_MEDIA_SUBTYPE_RAW,
@ -370,12 +372,10 @@ spa_alsa_sink_node_port_enum_formats (SpaNode *node,
return SPA_RESULT_ENUM_END;
}
b.data = this->format_buffer;
b.size = sizeof (this->format_buffer);
b.offset = 0;
spa_pod_builder_init (&b, this->format_buffer, sizeof (this->format_buffer));
if ((res = spa_format_filter (fmt, filter, &b)) != SPA_RESULT_OK)
return res;
goto next;
*format = SPA_MEMBER (b.data, 0, SpaFormat);

View file

@ -74,8 +74,7 @@ spa_alsa_source_node_get_props (SpaNode *node,
this = SPA_CONTAINER_OF (node, SpaALSASource, node);
b.data = this->props_buffer;
b.size = sizeof (this->props_buffer);
spa_pod_builder_init (&b, this->props_buffer, sizeof (this->props_buffer));
*props = SPA_MEMBER (b.data, spa_pod_builder_props (&b,
PROP_ID_DEVICE, SPA_POD_TYPE_STRING,
@ -363,8 +362,8 @@ spa_alsa_source_node_port_enum_formats (SpaNode *node,
SpaALSASource *this;
SpaResult res;
SpaFormat *fmt;
uint8_t buffer[256];
SpaPODBuilder b = { buffer, sizeof (buffer), };
uint8_t buffer[1024];
SpaPODBuilder b = { NULL, };
if (node == NULL || format == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
@ -374,7 +373,10 @@ spa_alsa_source_node_port_enum_formats (SpaNode *node,
if (!CHECK_PORT (this, direction, port_id))
return SPA_RESULT_INVALID_PORT;
switch (index) {
next:
spa_pod_builder_init (&b, buffer, sizeof (buffer));
switch (index++) {
case 0:
fmt = SPA_MEMBER (buffer, spa_pod_builder_format (&b,
SPA_MEDIA_TYPE_AUDIO, SPA_MEDIA_SUBTYPE_RAW,
@ -404,12 +406,10 @@ spa_alsa_source_node_port_enum_formats (SpaNode *node,
return SPA_RESULT_ENUM_END;
}
b.data = this->format_buffer;
b.size = sizeof (this->format_buffer);
b.offset = 0;
spa_pod_builder_init (&b, this->format_buffer, sizeof (this->format_buffer));
if ((res = spa_format_filter (fmt, filter, &b)) != SPA_RESULT_OK)
return res;
goto next;
*format = SPA_MEMBER (this->format_buffer, 0, SpaFormat);