summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2022-11-23 07:33:02 +0000
committerDaniel Scally <dan.scally@ideasonboard.com>2022-12-06 14:42:12 +0000
commit6b6681eb10dc56ff3b796ba070246803c3b34c69 (patch)
treec452bca395227fc76a2de3b8b4f8df5360b63361
parentbecfda202621418f2304649249d4437481b691c1 (diff)
main: add support for slideshow_source
Add facilities in main() to allow selection and usage of slideshow_source. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
-rw-r--r--src/main.c12
1 files changed, 11 insertions, 1 deletions
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> 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) {