implement alsa capture with timers

Add timer based alsa capture support
Improve format negotiation in alsa
Better track buffer owner in the links
This commit is contained in:
Wim Taymans 2017-03-30 17:30:28 +02:00
parent 73ec9e2d24
commit 7b8bb8da6b
10 changed files with 190 additions and 337 deletions

View file

@ -428,6 +428,8 @@ spa_alsa_sink_node_port_get_format (SpaNode *node,
const SpaFormat **format)
{
SpaALSASink *this;
SpaPODBuilder b = { NULL, };
SpaPODFrame f[2];
if (node == NULL || format == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
@ -440,7 +442,14 @@ spa_alsa_sink_node_port_get_format (SpaNode *node,
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
*format = NULL;
spa_pod_builder_init (&b, this->format_buffer, sizeof (this->format_buffer));
spa_pod_builder_format (&b, &f[0], this->type.format,
this->type.media_type.audio, this->type.media_subtype.raw,
PROP (&f[1], this->type.format_audio.format, SPA_POD_TYPE_ID, this->current_format.info.raw.format),
PROP (&f[1], this->type.format_audio.rate, SPA_POD_TYPE_INT, this->current_format.info.raw.rate),
PROP (&f[1], this->type.format_audio.channels, SPA_POD_TYPE_INT, this->current_format.info.raw.channels));
*format = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaFormat);
return SPA_RESULT_OK;
}