mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-21 07:00:08 -05:00
Add stream for control - 1
This commit is contained in:
parent
618d60a1f2
commit
9dc20765e1
1 changed files with 40 additions and 0 deletions
|
|
@ -1176,6 +1176,10 @@ struct impl {
|
||||||
struct spa_hook playback_listener;
|
struct spa_hook playback_listener;
|
||||||
struct spa_audio_info_raw playback_info;
|
struct spa_audio_info_raw playback_info;
|
||||||
|
|
||||||
|
struct pw_properties *control_props;
|
||||||
|
struct pw_stream *control;
|
||||||
|
struct spa_hook control_listener;
|
||||||
|
|
||||||
struct spa_audio_info_raw info;
|
struct spa_audio_info_raw info;
|
||||||
|
|
||||||
struct spa_io_position *position;
|
struct spa_io_position *position;
|
||||||
|
|
@ -1219,6 +1223,23 @@ static void capture_process(void *d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void control_process(void *d)
|
||||||
|
{
|
||||||
|
struct impl *impl = d;
|
||||||
|
int res;
|
||||||
|
if ((res = pw_stream_trigger_process(impl->playback)) < 0) {
|
||||||
|
pw_log_debug("playback trigger error: %s", spa_strerror(res));
|
||||||
|
while (true) {
|
||||||
|
struct pw_buffer *t;
|
||||||
|
if ((t = pw_stream_dequeue_buffer(impl->control)) == NULL)
|
||||||
|
break;
|
||||||
|
/* playback part is not ready, consume, discard and recycle
|
||||||
|
* the capture buffers */
|
||||||
|
pw_stream_queue_buffer(impl->control, t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void playback_process(void *d)
|
static void playback_process(void *d)
|
||||||
{
|
{
|
||||||
struct impl *impl = d;
|
struct impl *impl = d;
|
||||||
|
|
@ -1578,6 +1599,15 @@ static const struct pw_stream_events out_stream_events = {
|
||||||
.param_changed = playback_param_changed,
|
.param_changed = playback_param_changed,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct pw_stream_events control_stream_events = {
|
||||||
|
PW_VERSION_STREAM_EVENTS,
|
||||||
|
.destroy = NULL,
|
||||||
|
.process = control_process,
|
||||||
|
.io_changed = NULL,
|
||||||
|
.state_changed = NULL,
|
||||||
|
.param_changed = NULL,
|
||||||
|
};
|
||||||
|
|
||||||
static int setup_streams(struct impl *impl)
|
static int setup_streams(struct impl *impl)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
@ -1587,6 +1617,16 @@ static int setup_streams(struct impl *impl)
|
||||||
struct spa_pod_dynamic_builder b;
|
struct spa_pod_dynamic_builder b;
|
||||||
struct spa_filter_graph *graph = impl->graph;
|
struct spa_filter_graph *graph = impl->graph;
|
||||||
|
|
||||||
|
impl->control = pw_stream_new(impl->core,
|
||||||
|
"filter control", impl->capture_props);
|
||||||
|
impl->control_props = NULL;
|
||||||
|
if (impl->control == NULL)
|
||||||
|
return -errno;
|
||||||
|
|
||||||
|
pw_stream_add_listener(impl->control,
|
||||||
|
&impl->control_listener,
|
||||||
|
&control_stream_events, impl);
|
||||||
|
|
||||||
impl->capture = pw_stream_new(impl->core,
|
impl->capture = pw_stream_new(impl->core,
|
||||||
"filter capture", impl->capture_props);
|
"filter capture", impl->capture_props);
|
||||||
impl->capture_props = NULL;
|
impl->capture_props = NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue