Add --list-encoders

Add an option to list the device encoders properly.

PR #3757 <https://github.com/Genymobile/scrcpy/pull/3757>
This commit is contained in:
Romain Vimont
2023-02-22 23:15:15 +01:00
parent e4eae49eed
commit fe9166a88c
16 changed files with 157 additions and 29 deletions

View File

@@ -183,12 +183,16 @@ await_for_server(bool *connected) {
while (SDL_WaitEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
*connected = false;
if (connected) {
*connected = false;
}
return true;
case SC_EVENT_SERVER_CONNECTION_FAILED:
return false;
case SC_EVENT_SERVER_CONNECTED:
*connected = true;
if (connected) {
*connected = true;
}
return true;
default:
break;
@@ -339,6 +343,7 @@ scrcpy(struct scrcpy_options *options) {
.tcpip_dst = options->tcpip_dst,
.cleanup = options->cleanup,
.power_on = options->power_on,
.list_encoders = options->list_encoders,
};
static const struct sc_server_callbacks cbs = {
@@ -356,6 +361,12 @@ scrcpy(struct scrcpy_options *options) {
server_started = true;
if (options->list_encoders) {
bool ok = await_for_server(NULL);
ret = ok ? SCRCPY_EXIT_SUCCESS : SCRCPY_EXIT_FAILURE;
goto end;
}
if (options->display) {
sdl_set_hints(options->render_driver);
}