Add --list-cameras

Add an option to list the device cameras.

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
This commit is contained in:
Simon Chan
2023-07-16 17:07:19 +08:00
committed by Romain Vimont
parent 8c96ab130e
commit 5ed63314a5
11 changed files with 100 additions and 4 deletions

View File

@@ -81,6 +81,7 @@ enum {
OPT_KILL_ADB_ON_CLOSE,
OPT_TIME_LIMIT,
OPT_PAUSE_ON_EXIT,
OPT_LIST_CAMERAS,
};
struct sc_option {
@@ -320,6 +321,11 @@ static const struct sc_option options[] = {
"This is a workaround for some devices not behaving as "
"expected when setting the device clipboard programmatically.",
},
{
.longopt_id = OPT_LIST_CAMERAS,
.longopt = "list-cameras",
.text = "List device cameras.",
},
{
.longopt_id = OPT_LIST_DISPLAYS,
.longopt = "list-displays",
@@ -1998,6 +2004,9 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
case OPT_LIST_DISPLAYS:
opts->list |= SC_OPTION_LIST_DISPLAYS;
break;
case OPT_LIST_CAMERAS:
opts->list |= SC_OPTION_LIST_CAMERAS;
break;
case OPT_REQUIRE_AUDIO:
opts->require_audio = true;
break;

View File

@@ -182,6 +182,7 @@ struct scrcpy_options {
bool kill_adb_on_close;
#define SC_OPTION_LIST_ENCODERS 0x1
#define SC_OPTION_LIST_DISPLAYS 0x2
#define SC_OPTION_LIST_CAMERAS 0x4
uint8_t list;
};

View File

@@ -317,6 +317,9 @@ execute_server(struct sc_server *server,
if (params->list & SC_OPTION_LIST_DISPLAYS) {
ADD_PARAM("list_displays=true");
}
if (params->list & SC_OPTION_LIST_CAMERAS) {
ADD_PARAM("list_cameras=true");
}
#undef ADD_PARAM