-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Record screen to file #292
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
struct args { | ||
const char *serial; | ||
const char *crop; | ||
const char *outfilename; | ||
SDL_bool fullscreen; | ||
SDL_bool help; | ||
SDL_bool version; | ||
|
@@ -49,6 +50,9 @@ static void usage(const char *arg0) { | |
" is preserved.\n" | ||
" Default is %d%s.\n" | ||
"\n" | ||
" -o, --output\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" | ||
|
@@ -207,14 +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", required_argument, NULL, 'o'}, | ||
{"port", required_argument, NULL, 'p'}, | ||
{"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:p:s:tv", long_options, NULL)) != -1) { | ||
while ((c = getopt_long(argc, argv, "b:c:fhm:o:p:s:tv", long_options, NULL)) != -1) { | ||
switch (c) { | ||
case 'b': | ||
if (!parse_bit_rate(optarg, &args->bit_rate)) { | ||
|
@@ -235,6 +240,9 @@ static SDL_bool parse_args(struct args *args, int argc, char *argv[]) { | |
return SDL_FALSE; | ||
} | ||
break; | ||
case 'o': | ||
args->outfilename = optarg; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make consistent, use underscore as delimiter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK |
||
break; | ||
case 'p': | ||
if (!parse_port(optarg, &args->port)) { | ||
return SDL_FALSE; | ||
|
@@ -310,6 +318,7 @@ int main(int argc, char *argv[]) { | |
.serial = args.serial, | ||
.crop = args.crop, | ||
.port = args.port, | ||
.outfilename = args.outfilename, | ||
.max_size = args.max_size, | ||
.bit_rate = args.bit_rate, | ||
.show_touches = args.show_touches, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,11 +193,11 @@ SDL_bool scrcpy(const struct scrcpy_options *options) { | |
goto finally_destroy_frames; | ||
} | ||
|
||
decoder_init(&decoder, &frames, device_socket); | ||
decoder_init(&decoder, &frames, device_socket, frame_size); | ||
|
||
// now we consumed the header values, the socket receives the video stream | ||
// start the decoder | ||
if (!decoder_start(&decoder)) { | ||
if (!decoder_start(&decoder, options->outfilename)) { | ||
ret = SDL_FALSE; | ||
server_stop(&server); | ||
goto finally_destroy_file_handler; | ||
|
@@ -228,7 +228,7 @@ SDL_bool scrcpy(const struct scrcpy_options *options) { | |
} | ||
|
||
ret = event_loop(); | ||
LOGD("quit..."); | ||
LOGI("quit..."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my opinion, |
||
|
||
screen_destroy(&screen); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, the
output
is too general. In the future, we may add some feature like output format. It make a bit confusing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--output-file?