diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2022-11-22 10:54:56 +0000 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2022-11-22 16:02:25 +0000 |
commit | d2b0811d8bd4385397bf092fc42c319313baf8b2 (patch) | |
tree | fcc64b19739e7314f43a5cd5e6ffea61048168fc /src/main.c | |
parent | 7dc71fd6fef7a242d108d5c8cb7683aa9fd4511f (diff) |
main: add default option to use test-source
Now that we have test-source which provides video by generating a test
pattern in userspace, allow its selection in the command line options.
Since it isn't backed by anything, it is set as the default video source
if nothing else is specified.
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -15,6 +15,7 @@ #include "events.h" #include "stream.h" #include "v4l2-source.h" +#include "test-source.h" static void usage(const char *argv0) { @@ -56,7 +57,7 @@ static void sigint_handler(int signal __attribute__((unused))) int main(int argc, char *argv[]) { char *function = NULL; - char *cap_device = "/dev/video1"; + char *cap_device = NULL; struct uvc_function_config *fc; struct uvc_stream *stream = NULL; struct video_source *src = NULL; @@ -101,13 +102,17 @@ int main(int argc, char *argv[]) signal(SIGINT, sigint_handler); /* Create and initialize a video source. */ - src = v4l2_video_source_create(cap_device); + if (cap_device) + src = v4l2_video_source_create(cap_device); + else + src = test_video_source_create(); if (src == NULL) { ret = 1; goto done; } - v4l2_video_source_init(src, &events); + if (cap_device) + v4l2_video_source_init(src, &events); /* Create and initialise the stream. */ stream = uvc_stream_new(fc->video); |