Skip to content

Commit

Permalink
Rename --output-file to --record
Browse files Browse the repository at this point in the history
To record the screen to a local file:

    scrcpy --record file.mp4
  • Loading branch information
rom1v committed Nov 11, 2018
1 parent 70579dc commit 22bf0c1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
21 changes: 11 additions & 10 deletions app/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)) {
Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions app/src/scrcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -255,7 +255,7 @@ SDL_bool scrcpy(const struct scrcpy_options *options) {
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:
Expand Down
2 changes: 1 addition & 1 deletion app/src/scrcpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 22bf0c1

Please sign in to comment.