xrt: Refactor frameserver start stream arguments

This commit is contained in:
Jakob Bornecrantz 2019-09-02 13:23:32 +01:00
parent 1b35846506
commit 3b1abffa2d
3 changed files with 13 additions and 11 deletions

View file

@ -572,7 +572,9 @@ v4l2_fs_configure_capture(struct xrt_fs *xfs,
}
static bool
v4l2_fs_stream_start(struct xrt_fs *xfs, uint32_t descriptor_index)
v4l2_fs_stream_start(struct xrt_fs *xfs,
struct xrt_frame_sink *xs,
uint32_t descriptor_index)
{
struct v4l2_fs *vid = v4l2_fs(xfs);
@ -583,6 +585,7 @@ v4l2_fs_stream_start(struct xrt_fs *xfs, uint32_t descriptor_index)
}
vid->selected = descriptor_index;
vid->sink = xs;
vid->is_running = true;
if (pthread_create(&vid->stream_thread, NULL, v4l2_fs_stream_run,
xfs)) {
@ -667,9 +670,7 @@ v4l2_fs_node_destroy(struct xrt_frame_node *node)
}
struct xrt_fs *
v4l2_fs_create(struct xrt_frame_context *xfctx,
const char *path,
struct xrt_frame_sink *sink)
v4l2_fs_create(struct xrt_frame_context *xfctx, const char *path)
{
struct v4l2_fs *vid = U_TYPED_CALLOC(struct v4l2_fs);
vid->base.enumerate_modes = v4l2_fs_enumerate_modes;
@ -681,7 +682,6 @@ v4l2_fs_create(struct xrt_frame_context *xfctx,
vid->node.destroy = v4l2_fs_node_destroy;
vid->print_spew = debug_get_bool_option_v4l2_spew();
vid->print_debug = debug_get_bool_option_v4l2_debug();
vid->sink = sink;
vid->fd = -1;
int fd = open(path, O_RDWR, 0);

View file

@ -63,9 +63,7 @@ struct v4l2_source_descriptor
* @ingroup drv_v4l2
*/
struct xrt_fs *
v4l2_fs_create(struct xrt_frame_context *xfctx,
const char *path,
struct xrt_frame_sink *sink);
v4l2_fs_create(struct xrt_frame_context *xfctx, const char *path);
#ifdef __cplusplus

View file

@ -72,7 +72,9 @@ struct xrt_fs
/*!
* Start the capture stream.
*/
bool (*stream_start)(struct xrt_fs *xfs, uint32_t descriptor_index);
bool (*stream_start)(struct xrt_fs *xfs,
struct xrt_frame_sink *xs,
uint32_t descriptor_index);
/*!
* Stop the capture stream.
@ -123,9 +125,11 @@ xrt_fs_configure_capture(struct xrt_fs *xfs,
* @ingroup xrt_iface
*/
static inline XRT_MAYBE_UNUSED bool
xrt_fs_stream_start(struct xrt_fs *xfs, uint32_t descriptor_index)
xrt_fs_stream_start(struct xrt_fs *xfs,
struct xrt_frame_sink *xs,
uint32_t descriptor_index)
{
return xfs->stream_start(xfs, descriptor_index);
return xfs->stream_start(xfs, xs, descriptor_index);
}
/*!