--device-persistent -> -n|--persistent

This commit is contained in:
Devaev Maxim
2019-03-16 01:30:55 +03:00
parent 142670c374
commit 27d42d2545

View File

@@ -41,7 +41,7 @@
#include "http.h" #include "http.h"
static const char _SHORT_OPTS[] = "d:i:x:y:m:a:f:z:tb:w:q:c:s:p:u:ro:e:h"; static const char _SHORT_OPTS[] = "d:i:x:y:m:a:f:z:ntb:w:q:c:s:p:u:ro:e:h";
static const struct option _LONG_OPTS[] = { static const struct option _LONG_OPTS[] = {
{"device", required_argument, NULL, 'd'}, {"device", required_argument, NULL, 'd'},
{"input", required_argument, NULL, 'i'}, {"input", required_argument, NULL, 'i'},
@@ -51,14 +51,14 @@ static const struct option _LONG_OPTS[] = {
{"tv-standard", required_argument, NULL, 'a'}, {"tv-standard", required_argument, NULL, 'a'},
{"desired-fps", required_argument, NULL, 'f'}, {"desired-fps", required_argument, NULL, 'f'},
{"min-frame-size", required_argument, NULL, 'z'}, {"min-frame-size", required_argument, NULL, 'z'},
{"persistent", no_argument, NULL, 'n'},
{"dv-timings", no_argument, NULL, 't'}, {"dv-timings", no_argument, NULL, 't'},
{"buffers", required_argument, NULL, 'b'}, {"buffers", required_argument, NULL, 'b'},
{"workers", required_argument, NULL, 'w'}, {"workers", required_argument, NULL, 'w'},
{"quality", required_argument, NULL, 'q'}, {"quality", required_argument, NULL, 'q'},
{"encoder", required_argument, NULL, 'c'}, {"encoder", required_argument, NULL, 'c'},
{"device-timeout", required_argument, NULL, 1000}, {"device-timeout", required_argument, NULL, 1000},
{"device-persistent", no_argument, NULL, 1001}, {"device-error-delay", required_argument, NULL, 1001},
{"device-error-delay", required_argument, NULL, 1002},
{"brightness", required_argument, NULL, 2000}, {"brightness", required_argument, NULL, 2000},
{"brightness-auto", no_argument, NULL, 2001}, {"brightness-auto", no_argument, NULL, 2001},
@@ -124,6 +124,7 @@ static void _help(struct device_t *dev, struct encoder_t *encoder, struct http_s
printf(" -f|--desired-fps <N> -- Desired FPS. Default: maximum as possible.\n\n"); printf(" -f|--desired-fps <N> -- Desired FPS. Default: maximum as possible.\n\n");
printf(" -z|--min-frame-size <N> -- Drop frames smaller then this limit.\n"); printf(" -z|--min-frame-size <N> -- Drop frames smaller then this limit.\n");
printf(" Useful if the device produces small-sized garbage frames.\n\n"); printf(" Useful if the device produces small-sized garbage frames.\n\n");
printf(" -n|--persistent -- Don't re-initialize device on timeout. Default: disabled.\n\n");
printf(" -t|--dv-timings -- Enable DV timings queriyng and events processing.\n"); printf(" -t|--dv-timings -- Enable DV timings queriyng and events processing.\n");
printf(" Supports automatic resolution changing. Default: disabled.\n\n"); printf(" Supports automatic resolution changing. Default: disabled.\n\n");
printf(" -b|--buffers <N> -- The number of buffers to receive data from the device.\n"); printf(" -b|--buffers <N> -- The number of buffers to receive data from the device.\n");
@@ -134,9 +135,8 @@ static void _help(struct device_t *dev, struct encoder_t *encoder, struct http_s
printf(" -c|--encoder <type> -- Use specified encoder. It may affects to workers number.\n"); printf(" -c|--encoder <type> -- Use specified encoder. It may affects to workers number.\n");
printf(" -- Available: %s; default: CPU.\n\n", ENCODER_TYPES_STR); printf(" -- Available: %s; default: CPU.\n\n", ENCODER_TYPES_STR);
printf(" --device-timeout <seconds> -- Timeout for device querying. Default: %u\n\n", dev->timeout); printf(" --device-timeout <seconds> -- Timeout for device querying. Default: %u\n\n", dev->timeout);
printf(" --device-persistent -- Don't re-initialize device on timeout. Default: disabled.\n\n");
printf(" --device-error-delay <seconds> -- Delay before trying to connect to the device again\n"); printf(" --device-error-delay <seconds> -- Delay before trying to connect to the device again\n");
printf(" after a timeout. Default: %u\n\n", dev->error_delay); printf(" after timeout. Default: %u\n\n", dev->error_delay);
printf("Image control options:\n"); printf("Image control options:\n");
printf("---------------\n"); printf("---------------\n");
printf(" --brightness <N> -- Set brightness. Default: no change.\n\n"); printf(" --brightness <N> -- Set brightness. Default: no change.\n\n");
@@ -245,14 +245,14 @@ static int _parse_options(int argc, char *argv[], struct device_t *dev, struct e
case 'a': OPT_PARSE(dev->standard, device_parse_standard, STANDARD_UNKNOWN, "TV standard"); case 'a': OPT_PARSE(dev->standard, device_parse_standard, STANDARD_UNKNOWN, "TV standard");
case 'f': OPT_UNSIGNED(dev->desired_fps, "--desired-fps", 0, 30); case 'f': OPT_UNSIGNED(dev->desired_fps, "--desired-fps", 0, 30);
case 'z': OPT_UNSIGNED(dev->min_frame_size, "--min-frame-size", 0, 8192); case 'z': OPT_UNSIGNED(dev->min_frame_size, "--min-frame-size", 0, 8192);
case 'n': OPT_SET(dev->persistent, true);
case 't': OPT_SET(dev->dv_timings, true); case 't': OPT_SET(dev->dv_timings, true);
case 'b': OPT_UNSIGNED(dev->n_buffers, "--buffers", 1, 32); case 'b': OPT_UNSIGNED(dev->n_buffers, "--buffers", 1, 32);
case 'w': OPT_UNSIGNED(dev->n_workers, "--workers", 1, 32); case 'w': OPT_UNSIGNED(dev->n_workers, "--workers", 1, 32);
case 'q': OPT_UNSIGNED(encoder->quality, "--quality", 1, 100); case 'q': OPT_UNSIGNED(encoder->quality, "--quality", 1, 100);
case 'c': OPT_PARSE(encoder->type, encoder_parse_type, ENCODER_TYPE_UNKNOWN, "encoder type"); case 'c': OPT_PARSE(encoder->type, encoder_parse_type, ENCODER_TYPE_UNKNOWN, "encoder type");
case 1000: OPT_UNSIGNED(dev->timeout, "--device-timeout", 1, 60); case 1000: OPT_UNSIGNED(dev->timeout, "--device-timeout", 1, 60);
case 1001: OPT_SET(dev->persistent, true); case 1001: OPT_UNSIGNED(dev->error_delay, "--device-error-delay", 1, 60);
case 1002: OPT_UNSIGNED(dev->error_delay, "--device-error-delay", 1, 60);
case 2000: OPT_CTL(brightness); case 2000: OPT_CTL(brightness);
case 2001: OPT_CTL_AUTO(brightness); case 2001: OPT_CTL_AUTO(brightness);