From 6b6681eb10dc56ff3b796ba070246803c3b34c69 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Wed, 23 Nov 2022 07:33:02 +0000 Subject: main: add support for slideshow_source Add facilities in main() to allow selection and usage of slideshow_source. Reviewed-by: Kieran Bingham Reviewed-by: Daniel Scally Signed-off-by: Paul Elder --- src/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index c2d59f8..4ed0101 100644 --- a/src/main.c +++ b/src/main.c @@ -17,6 +17,7 @@ #include "v4l2-source.h" #include "test-source.h" #include "jpg-source.h" +#include "slideshow-source.h" static void usage(const char *argv0) { @@ -24,6 +25,7 @@ static void usage(const char *argv0) fprintf(stderr, "Available options are\n"); fprintf(stderr, " -c device V4L2 source device\n"); fprintf(stderr, " -i image MJPEG image\n"); + fprintf(stderr, " -s directory directory of slideshow images\n"); fprintf(stderr, " -h Print this help screen and exit\n"); fprintf(stderr, "\n"); fprintf(stderr, " UVC device instance specifier\n"); @@ -60,6 +62,8 @@ int main(int argc, char *argv[]) char *function = NULL; char *cap_device = NULL; char *img_path = NULL; + char *slideshow_dir = NULL; + struct uvc_function_config *fc; struct uvc_stream *stream = NULL; struct video_source *src = NULL; @@ -67,7 +71,7 @@ int main(int argc, char *argv[]) int ret = 0; int opt; - while ((opt = getopt(argc, argv, "c:i:h")) != -1) { + while ((opt = getopt(argc, argv, "c:i:s:k:h")) != -1) { switch (opt) { case 'c': cap_device = optarg; @@ -77,6 +81,10 @@ int main(int argc, char *argv[]) img_path = optarg; break; + case 's': + slideshow_dir = optarg; + break; + case 'h': usage(argv[0]); return 0; @@ -118,6 +126,8 @@ int main(int argc, char *argv[]) src = v4l2_video_source_create(cap_device); else if (img_path) src = jpg_video_source_create(img_path); + else if (slideshow_dir) + src = slideshow_video_source_create(slideshow_dir); else src = test_video_source_create(); if (src == NULL) { -- cgit v1.2.3