diff --git a/app/src/main.c b/app/src/main.c index 11129138..65887295 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -11,7 +11,7 @@ struct args { const char *serial; const char *crop; - const char *out_filename; + const char *record_filename; SDL_bool fullscreen; SDL_bool help; SDL_bool version; @@ -50,13 +50,13 @@ static void usage(const char *arg0) { " is preserved.\n" " Default is %d%s.\n" "\n" - " -o, --output-file\n" - " Write video output to file.\n" - "\n" " -p, --port port\n" " Set the TCP port the client listens on.\n" " Default is %d.\n" "\n" + " -r, --record file.mp4\n" + " Record screen to file.\n" + "\n" " -s, --serial\n" " The device serial number. Mandatory only if several devices\n" " are connected to adb.\n" @@ -211,15 +211,15 @@ static SDL_bool parse_args(struct args *args, int argc, char *argv[]) { {"fullscreen", no_argument, NULL, 'f'}, {"help", no_argument, NULL, 'h'}, {"max-size", required_argument, NULL, 'm'}, - {"output-file", required_argument, NULL, 'o'}, {"port", required_argument, NULL, 'p'}, + {"record", required_argument, NULL, 'r'}, {"serial", required_argument, NULL, 's'}, {"show-touches", no_argument, NULL, 't'}, {"version", no_argument, NULL, 'v'}, {NULL, 0, NULL, 0 }, }; int c; - while ((c = getopt_long(argc, argv, "b:c:fhm:o:p:s:tv", long_options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "b:c:fhm:p:r:s:tv", long_options, NULL)) != -1) { switch (c) { case 'b': if (!parse_bit_rate(optarg, &args->bit_rate)) { @@ -240,14 +240,14 @@ static SDL_bool parse_args(struct args *args, int argc, char *argv[]) { return SDL_FALSE; } break; - case 'o': - args->out_filename = optarg; - break; case 'p': if (!parse_port(optarg, &args->port)) { return SDL_FALSE; } break; + case 'r': + args->record_filename = optarg; + break; case 's': args->serial = optarg; break; @@ -281,6 +281,7 @@ int main(int argc, char *argv[]) { struct args args = { .serial = NULL, .crop = NULL, + .record_filename = NULL, .help = SDL_FALSE, .version = SDL_FALSE, .show_touches = SDL_FALSE, @@ -318,7 +319,7 @@ int main(int argc, char *argv[]) { .serial = args.serial, .crop = args.crop, .port = args.port, - .out_filename = args.out_filename, + .record_filename = args.record_filename, .max_size = args.max_size, .bit_rate = args.bit_rate, .show_touches = args.show_touches, diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 766c26f2..7f6df90c 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -192,8 +192,8 @@ SDL_bool scrcpy(const struct scrcpy_options *options) { } struct recorder *rec = NULL; - if (options->out_filename) { - if (!recorder_init(&recorder, options->out_filename, frame_size)) { + if (options->record_filename) { + if (!recorder_init(&recorder, options->record_filename, frame_size)) { ret = SDL_FALSE; server_stop(&server); goto finally_destroy_file_handler; @@ -255,7 +255,7 @@ finally_destroy_file_handler: file_handler_join(&file_handler); file_handler_destroy(&file_handler); finally_destroy_recorder: - if (options->out_filename) { + if (options->record_filename) { recorder_destroy(&recorder); } finally_destroy_frames: diff --git a/app/src/scrcpy.h b/app/src/scrcpy.h index 4716c587..89945e6c 100644 --- a/app/src/scrcpy.h +++ b/app/src/scrcpy.h @@ -6,7 +6,7 @@ struct scrcpy_options { const char *serial; const char *crop; - const char *out_filename; + const char *record_filename; Uint16 port; Uint16 max_size; Uint32 bit_rate;