summaryrefslogtreecommitdiff
path: root/pipewire-alsa
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-11-21 16:14:50 +0100
committerWim Taymans <wtaymans@redhat.com>2019-11-21 16:14:50 +0100
commit738603fd040cf35c425532b90d9a4e58f1fc4abb (patch)
tree03949409c5f016d75ddf46eabf03d3777f086052 /pipewire-alsa
parentbe53554defe2bc935c0dc216872ed835f2307c05 (diff)
stream: Align with pw_filter
Remove some of the unused states in pw_stream. The app can know the state by following the format and buffer events. Make it possible to be notified of io are updates. This should make it possible to follow the transport etc. Make it possible to be notified of any param changes. Rename finish_format to update_params because that is what it does. Make this work in the same was as the filter: updating the params removes all old params of the types and installs the new ones. Don't get the Props and PropInfo from the node proxy, instead get them directly from the adapter that we have locally. Update the controls directly on the adapter instead of going to the server first.
Diffstat (limited to 'pipewire-alsa')
-rw-r--r--pipewire-alsa/alsa-plugins/pcm_pipewire.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/pipewire-alsa/alsa-plugins/pcm_pipewire.c b/pipewire-alsa/alsa-plugins/pcm_pipewire.c
index 453ae9b0..ed729ebc 100644
--- a/pipewire-alsa/alsa-plugins/pcm_pipewire.c
+++ b/pipewire-alsa/alsa-plugins/pcm_pipewire.c
@@ -310,7 +310,7 @@ snd_pcm_pipewire_process_record(snd_pcm_pipewire_t *pw, struct pw_buffer *b)
return 0;
}
-static void on_stream_format_changed(void *data, const struct spa_pod *format)
+static void on_stream_param_changed(void *data, uint32_t id, const struct spa_pod *param)
{
snd_pcm_pipewire_t *pw = data;
snd_pcm_ioplug_t *io = &pw->io;
@@ -322,6 +322,9 @@ static void on_stream_format_changed(void *data, const struct spa_pod *format)
uint32_t buffers;
uint32_t size;
+ if (param == NULL || id != SPA_PARAM_Format)
+ return;
+
io->period_size = pw->min_avail;
buffers = SPA_CLAMP(io->buffer_size / io->period_size, MIN_BUFFERS, MAX_BUFFERS);
size = io->period_size * stride;
@@ -337,7 +340,7 @@ static void on_stream_format_changed(void *data, const struct spa_pod *format)
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride),
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
- pw_stream_finish_format(pw->stream, 0, params, n_params);
+ pw_stream_update_params(pw->stream, params, n_params);
}
static void on_stream_process(void *data)
@@ -360,7 +363,7 @@ static void on_stream_process(void *data)
static const struct pw_stream_events stream_events = {
PW_VERSION_STREAM_EVENTS,
- .format_changed = on_stream_format_changed,
+ .param_changed = on_stream_param_changed,
.process = on_stream_process,
};