Remove port

Remove the port object. We don't use it as a dbus object and we don't
need it, we can use the link and node object directy.
Move poll code and event handler to the node.
This commit is contained in:
Wim Taymans 2016-09-02 19:51:23 +02:00
parent 463954a299
commit 7d3e46e7f9
22 changed files with 689 additions and 1848 deletions

View file

@ -82,6 +82,7 @@ struct _V4l2Format {
typedef struct {
bool export_buf;
bool have_buffers;
bool started;
bool next_fmtdesc;
struct v4l2_fmtdesc fmtdesc;
@ -381,8 +382,6 @@ spa_v4l2_source_node_port_enum_formats (SpaNode *node,
this = (SpaV4l2Source *) node->handle;
fprintf (stderr, "%d\n", port_id);
if (port_id != 0)
return SPA_RESULT_INVALID_PORT;
@ -414,6 +413,7 @@ spa_v4l2_source_node_port_set_format (SpaNode *node,
state = &this->state[port_id];
if (format == NULL) {
spa_v4l2_pause (this);
spa_v4l2_clear_buffers (this);
spa_v4l2_close (this);
state->current_format = NULL;

View file

@ -402,6 +402,7 @@ again:
fmt->fmt.props.prop_info = fmt->infos;
fmt->fmt.props.n_prop_info = pi = 0;
fmt->fmt.props.unset_mask = 0;
fmt->fmt.mem.mem.pool_id = SPA_ID_INVALID;
if (info->media_subtype == SPA_MEDIA_SUBTYPE_RAW) {
spa_prop_info_fill_video (&fmt->infos[pi],
@ -850,6 +851,9 @@ spa_v4l2_start (SpaV4l2Source *this)
enum v4l2_buf_type type;
SpaEvent event;
if (state->started)
return SPA_RESULT_OK;
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (xioctl (state->fd, VIDIOC_STREAMON, &type) < 0) {
perror ("VIDIOC_STREAMON");
@ -873,6 +877,8 @@ spa_v4l2_start (SpaV4l2Source *this)
state->poll.user_data = this;
this->event_cb (&this->node, &event, this->user_data);
state->started = true;
return SPA_RESULT_OK;
}
@ -883,11 +889,16 @@ spa_v4l2_pause (SpaV4l2Source *this)
enum v4l2_buf_type type;
SpaEvent event;
if (!state->started)
return SPA_RESULT_OK;
event.type = SPA_EVENT_TYPE_REMOVE_POLL;
event.data = &state->poll;
event.size = sizeof (state->poll);
this->event_cb (&this->node, &event, this->user_data);
state->started = false;
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (xioctl (state->fd, VIDIOC_STREAMOFF, &type) < 0) {
perror ("VIDIOC_STREAMOFF");