node: add some more port flags

Add port flags to mark physical and terminal ports
This commit is contained in:
Wim Taymans 2018-02-09 18:05:35 +01:00
parent 60177646e9
commit 342f0d59d0
5 changed files with 19 additions and 6 deletions

View file

@ -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_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 #define SPA_PORT_INFO_FLAG_LIVE (1<<6) /**< output buffers from this port are
* timestamped against a live clock. */ * 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 flags; /**< port flags */
uint32_t rate; /**< rate of sequence numbers on port */ uint32_t rate; /**< rate of sequence numbers on port */
const struct spa_dict *props; /**< extra port properties */ const struct spa_dict *props; /**< extra port properties */

View file

@ -430,7 +430,6 @@ static int port_set_format(struct spa_node *node,
} }
if (this->have_format) { if (this->have_format) {
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS | SPA_PORT_INFO_FLAG_LIVE;
this->info.rate = this->rate; this->info.rate = this->rate;
} }
@ -703,7 +702,10 @@ impl_init(const struct spa_handle_factory *factory,
this->stream = SND_PCM_STREAM_PLAYBACK; this->stream = SND_PCM_STREAM_PLAYBACK;
reset_props(&this->props); 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); spa_list_init(&this->ready);

View file

@ -442,7 +442,6 @@ static int port_set_format(struct spa_node *node,
} }
if (this->have_format) { if (this->have_format) {
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS | SPA_PORT_INFO_FLAG_LIVE;
this->info.rate = this->rate; this->info.rate = this->rate;
} }
@ -769,7 +768,10 @@ impl_init(const struct spa_handle_factory *factory,
this->stream = SND_PCM_STREAM_CAPTURE; this->stream = SND_PCM_STREAM_CAPTURE;
reset_props(&this->props); 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->free);
spa_list_init(&this->ready); spa_list_init(&this->ready);

View file

@ -1007,7 +1007,9 @@ impl_init(const struct spa_handle_factory *factory,
reset_props(&this->props); reset_props(&this->props);
port->log = this->log; 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->export_buf = true;
port->have_query_ext_ctrl = true; port->have_query_ext_ctrl = true;

View file

@ -894,7 +894,10 @@ static int spa_v4l2_set_format(struct impl *this, struct spa_video_info *format,
port->fmt = fmt; port->fmt = fmt;
port->info.flags = (port->export_buf ? SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS : 0) | 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; port->info.rate = streamparm.parm.capture.timeperframe.denominator;
return 0; return 0;