From 342f0d59d0abc698349d0c6e76c4618ef388149f Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 9 Feb 2018 18:05:35 +0100 Subject: node: add some more port flags Add port flags to mark physical and terminal ports --- spa/include/spa/node/node.h | 4 ++++ spa/plugins/alsa/alsa-sink.c | 6 ++++-- spa/plugins/alsa/alsa-source.c | 6 ++++-- spa/plugins/v4l2/v4l2-source.c | 4 +++- spa/plugins/v4l2/v4l2-utils.c | 5 ++++- 5 files changed, 19 insertions(+), 6 deletions(-) (limited to 'spa') diff --git a/spa/include/spa/node/node.h b/spa/include/spa/node/node.h index fd85e5e9..4d9c6817 100644 --- a/spa/include/spa/node/node.h +++ b/spa/include/spa/node/node.h @@ -53,6 +53,10 @@ struct spa_port_info { #define SPA_PORT_INFO_FLAG_NO_REF (1<<5) /**< the port does not keep a ref on the buffer */ #define SPA_PORT_INFO_FLAG_LIVE (1<<6) /**< output buffers from this port are * timestamped against a live clock. */ +#define SPA_PORT_INFO_FLAG_PHYSICAL (1<<7) /**< connects to some device */ +#define SPA_PORT_INFO_FLAG_TERMINAL (1<<8) /**< data was not created from this port + * or will not be made available on another + * port */ uint32_t flags; /**< port flags */ uint32_t rate; /**< rate of sequence numbers on port */ const struct spa_dict *props; /**< extra port properties */ diff --git a/spa/plugins/alsa/alsa-sink.c b/spa/plugins/alsa/alsa-sink.c index e825e501..cc681821 100644 --- a/spa/plugins/alsa/alsa-sink.c +++ b/spa/plugins/alsa/alsa-sink.c @@ -430,7 +430,6 @@ static int port_set_format(struct spa_node *node, } if (this->have_format) { - this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS | SPA_PORT_INFO_FLAG_LIVE; this->info.rate = this->rate; } @@ -703,7 +702,10 @@ impl_init(const struct spa_handle_factory *factory, this->stream = SND_PCM_STREAM_PLAYBACK; reset_props(&this->props); - this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS; + this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS | + SPA_PORT_INFO_FLAG_LIVE | + SPA_PORT_INFO_FLAG_PHYSICAL | + SPA_PORT_INFO_FLAG_TERMINAL; spa_list_init(&this->ready); diff --git a/spa/plugins/alsa/alsa-source.c b/spa/plugins/alsa/alsa-source.c index 22c60f6b..ba96b951 100644 --- a/spa/plugins/alsa/alsa-source.c +++ b/spa/plugins/alsa/alsa-source.c @@ -442,7 +442,6 @@ static int port_set_format(struct spa_node *node, } if (this->have_format) { - this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS | SPA_PORT_INFO_FLAG_LIVE; this->info.rate = this->rate; } @@ -769,7 +768,10 @@ impl_init(const struct spa_handle_factory *factory, this->stream = SND_PCM_STREAM_CAPTURE; reset_props(&this->props); - this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS; + this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS | + SPA_PORT_INFO_FLAG_LIVE | + SPA_PORT_INFO_FLAG_PHYSICAL | + SPA_PORT_INFO_FLAG_TERMINAL; spa_list_init(&this->free); spa_list_init(&this->ready); diff --git a/spa/plugins/v4l2/v4l2-source.c b/spa/plugins/v4l2/v4l2-source.c index 379e26d2..a25e4b82 100644 --- a/spa/plugins/v4l2/v4l2-source.c +++ b/spa/plugins/v4l2/v4l2-source.c @@ -1007,7 +1007,9 @@ impl_init(const struct spa_handle_factory *factory, reset_props(&this->props); port->log = this->log; - port->info.flags = SPA_PORT_INFO_FLAG_LIVE; + port->info.flags = SPA_PORT_INFO_FLAG_LIVE | + SPA_PORT_INFO_FLAG_PHYSICAL | + SPA_PORT_INFO_FLAG_TERMINAL; port->export_buf = true; port->have_query_ext_ctrl = true; diff --git a/spa/plugins/v4l2/v4l2-utils.c b/spa/plugins/v4l2/v4l2-utils.c index 8be43c30..4254702b 100644 --- a/spa/plugins/v4l2/v4l2-utils.c +++ b/spa/plugins/v4l2/v4l2-utils.c @@ -894,7 +894,10 @@ static int spa_v4l2_set_format(struct impl *this, struct spa_video_info *format, port->fmt = fmt; port->info.flags = (port->export_buf ? SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS : 0) | - SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS | SPA_PORT_INFO_FLAG_LIVE; + SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS | + SPA_PORT_INFO_FLAG_LIVE | + SPA_PORT_INFO_FLAG_PHYSICAL | + SPA_PORT_INFO_FLAG_TERMINAL; port->info.rate = streamparm.parm.capture.timeperframe.denominator; return 0; -- cgit v1.2.3