From a753dba7ed68896912f291f7ca01edb85a66db75 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 11 Aug 2010 09:28:09 +0200 Subject: Add a --get-format option The option takes a pad name as argument and returns the active format (and optional crop settings if available) for that pad. Signed-off-by: Laurent Pinchart --- options.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'options.c') diff --git a/options.c b/options.c index 6fd2daf..f4a551b 100644 --- a/options.c +++ b/options.c @@ -35,7 +35,8 @@ static void usage(const char *argv0, int verbose) printf("%s [options] device\n", argv0); printf("-d, --device dev Media device name (default: %s)\n", MEDIA_DEVNAME_DEFAULT); printf("-e, --entity name Print the device name associated with the given entity\n"); - printf("-f, --formats Comma-separated list of formats to setup\n"); + printf("-f, --set-format Comma-separated list of formats to setup\n"); + printf(" --get-format pad Print the active format on a given pad\n"); printf("-h, --help Show verbose help and exit\n"); printf("-i, --interactive Modify links interactively\n"); printf("-l, --links Comma-separated list of links descriptors to setup\n"); @@ -68,12 +69,14 @@ static void usage(const char *argv0, int verbose) printf("\tdenominator Frame interval denominator\n"); } -#define OPT_PRINT_DOT 256 +#define OPT_PRINT_DOT 256 +#define OPT_GET_FORMAT 257 static struct option opts[] = { {"device", 1, 0, 'd'}, {"entity", 1, 0, 'e'}, - {"formats", 1, 0, 'f'}, + {"set-format", 1, 0, 'f'}, + {"get-format", 1, 0, OPT_GET_FORMAT}, {"help", 0, 0, 'h'}, {"interactive", 0, 0, 'i'}, {"links", 1, 0, 'l'}, @@ -136,6 +139,10 @@ int parse_cmdline(int argc, char **argv) media_opts.print_dot = 1; break; + case OPT_GET_FORMAT: + media_opts.pad = optarg; + break; + default: printf("Invalid option -%c\n", opt); printf("Run %s -h for help.\n", argv[0]); -- cgit v1.2.3