Expose V4L2 option on all platforms
This allows to report a meaningful error message if an unsupported feature is used on an incompatible platform. This is consistent with the behavior of -K/--hid-keyboard.
This commit is contained in:
parent
ba28d817fb
commit
26ee7ce566
1 changed files with 16 additions and 11 deletions
|
@ -240,11 +240,8 @@ static const struct sc_option options[] = {
|
||||||
{
|
{
|
||||||
.shortopt = 'N',
|
.shortopt = 'N',
|
||||||
.longopt = "no-display",
|
.longopt = "no-display",
|
||||||
.text = "Do not display device (only when screen recording "
|
.text = "Do not display device (only when screen recording or V4L2 "
|
||||||
#ifdef HAVE_V4L2
|
"sink is enabled).",
|
||||||
"or V4L2 sink "
|
|
||||||
#endif
|
|
||||||
"is enabled).",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.longopt_id = OPT_NO_KEY_REPEAT,
|
.longopt_id = OPT_NO_KEY_REPEAT,
|
||||||
|
@ -381,14 +378,14 @@ static const struct sc_option options[] = {
|
||||||
"Default is 0 (not forced): the local port used for "
|
"Default is 0 (not forced): the local port used for "
|
||||||
"establishing the tunnel will be used.",
|
"establishing the tunnel will be used.",
|
||||||
},
|
},
|
||||||
#ifdef HAVE_V4L2
|
|
||||||
{
|
{
|
||||||
.longopt_id = OPT_V4L2_SINK,
|
.longopt_id = OPT_V4L2_SINK,
|
||||||
.longopt = "v4l2-sink",
|
.longopt = "v4l2-sink",
|
||||||
.argdesc = "/dev/videoN",
|
.argdesc = "/dev/videoN",
|
||||||
.text = "Output to v4l2loopback device.\n"
|
.text = "Output to v4l2loopback device.\n"
|
||||||
"It requires to lock the video orientation (see "
|
"It requires to lock the video orientation (see "
|
||||||
"--lock-video-orientation).",
|
"--lock-video-orientation).\n"
|
||||||
|
"This feature is only available on Linux.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.longopt_id = OPT_V4L2_BUFFER,
|
.longopt_id = OPT_V4L2_BUFFER,
|
||||||
|
@ -398,9 +395,9 @@ static const struct sc_option options[] = {
|
||||||
"frames. This increases latency to compensate for jitter.\n"
|
"frames. This increases latency to compensate for jitter.\n"
|
||||||
"This option is similar to --display-buffer, but specific to "
|
"This option is similar to --display-buffer, but specific to "
|
||||||
"V4L2 sink.\n"
|
"V4L2 sink.\n"
|
||||||
"Default is 0 (no buffering).",
|
"Default is 0 (no buffering).\n"
|
||||||
|
"This option is only available on Linux.",
|
||||||
},
|
},
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
.shortopt = 'V',
|
.shortopt = 'V',
|
||||||
.longopt = "verbosity",
|
.longopt = "verbosity",
|
||||||
|
@ -1470,16 +1467,24 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||||
opts->tcpip = true;
|
opts->tcpip = true;
|
||||||
opts->tcpip_dst = optarg;
|
opts->tcpip_dst = optarg;
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_V4L2
|
|
||||||
case OPT_V4L2_SINK:
|
case OPT_V4L2_SINK:
|
||||||
|
#ifdef HAVE_V4L2
|
||||||
opts->v4l2_device = optarg;
|
opts->v4l2_device = optarg;
|
||||||
|
#else
|
||||||
|
LOGE("V4L2 (--v4l2-sink) is only available on Linux.");
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case OPT_V4L2_BUFFER:
|
case OPT_V4L2_BUFFER:
|
||||||
|
#ifdef HAVE_V4L2
|
||||||
if (!parse_buffering_time(optarg, &opts->v4l2_buffer)) {
|
if (!parse_buffering_time(optarg, &opts->v4l2_buffer)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
#else
|
||||||
|
LOGE("V4L2 (--v4l2-buffer) is only available on Linux.");
|
||||||
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// getopt prints the error message on stderr
|
// getopt prints the error message on stderr
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue