summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2022-11-22 15:41:50 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2022-11-22 16:05:29 +0000
commit29ff9edaec72098f1d9e0a1f5bb18c1f6fdfdde4 (patch)
tree714867890265678b5843887e48af87da8a9f96b1
parentbb83c7135540d3391f4d0b46911c8aedbcd84313 (diff)
main: add support for jpg_source
Add facilities in main() to allow selection and usage of jpg_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> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--src/main.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 606a4ac..c2d59f8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -16,6 +16,7 @@
#include "stream.h"
#include "v4l2-source.h"
#include "test-source.h"
+#include "jpg-source.h"
static void usage(const char *argv0)
{
@@ -58,6 +59,7 @@ int main(int argc, char *argv[])
{
char *function = NULL;
char *cap_device = NULL;
+ char *img_path = NULL;
struct uvc_function_config *fc;
struct uvc_stream *stream = NULL;
struct video_source *src = NULL;
@@ -65,12 +67,16 @@ int main(int argc, char *argv[])
int ret = 0;
int opt;
- while ((opt = getopt(argc, argv, "c:h")) != -1) {
+ while ((opt = getopt(argc, argv, "c:i:h")) != -1) {
switch (opt) {
case 'c':
cap_device = optarg;
break;
+ case 'i':
+ img_path = optarg;
+ break;
+
case 'h':
usage(argv[0]);
return 0;
@@ -91,6 +97,12 @@ int main(int argc, char *argv[])
return 1;
}
+ if (cap_device != NULL && img_path != NULL) {
+ printf("Both capture device and still image specified\n");
+ printf("Please specify only one\n");
+ return 1;
+ }
+
/*
* Create the events handler. Register a signal handler for SIGINT,
* received when the user presses CTRL-C. This will allow the main loop
@@ -104,6 +116,8 @@ int main(int argc, char *argv[])
/* Create and initialize a video source. */
if (cap_device)
src = v4l2_video_source_create(cap_device);
+ else if (img_path)
+ src = jpg_video_source_create(img_path);
else
src = test_video_source_create();
if (src == NULL) {