Rename --output-file to --record

To record the screen to a local file:

    scrcpy --record file.mp4
This commit is contained in:
Romain Vimont 2018-11-11 14:03:29 +01:00
parent 70579dc709
commit 22bf0c19d6
3 changed files with 15 additions and 14 deletions

View file

@ -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,

View file

@ -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:

View file

@ -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;