-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
Added a new option : -n/--no-window #418
Added a new option : -n/--no-window #418
Conversation
This option allows scrcpy to be run headless : we can now use scrcpy only for screen recording as an example
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.
Thank you for your contribution.
I like the idea to add such a flag. Maybe it could skip a lot more code (do not decode frame, do not initialize SDL…).
I'll test it probably after the FOSDEM.
screen_show_window(&screen); | ||
if (!no_window) { | ||
screen_show_window(&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.
I think you can skip code far earlier, you may not even need to initialize SDL nor decode frames at all if you have no window.
app/src/main.c
Outdated
@@ -209,6 +215,7 @@ static SDL_bool parse_args(struct args *args, int argc, char *argv[]) { | |||
{"bit-rate", required_argument, NULL, 'b'}, | |||
{"crop", required_argument, NULL, 'c'}, | |||
{"fullscreen", no_argument, NULL, 'f'}, | |||
{"no-window", no_argument, NULL, 'n'}, |
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.
alignment
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.
done; sorry for that
app/src/main.c
Outdated
@@ -219,7 +226,7 @@ static SDL_bool parse_args(struct args *args, int argc, char *argv[]) { | |||
{NULL, 0, NULL, 0 }, | |||
}; | |||
int c; | |||
while ((c = getopt_long(argc, argv, "b:c:fhm:p:r:s:tv", long_options, NULL)) != -1) { | |||
while ((c = getopt_long(argc, argv, "b:c:fnhm:p:r:s:tv", long_options, NULL)) != -1) { |
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.
(please keep the alphabetical order, ditto above and below)
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.
done
Hi, I have two simple recommendations for this patch:
Thanks, |
app/src/main.c
Outdated
@@ -232,6 +239,9 @@ static SDL_bool parse_args(struct args *args, int argc, char *argv[]) { | |||
case 'f': | |||
args->fullscreen = SDL_TRUE; | |||
break; | |||
case 'n': | |||
args->no_window = SDL_TRUE; |
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.
Missing default value or an initialization. See main.c
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.
done
Added an error message if nor -n is provided without -r |
Thanks a lot for that ; I tried some combinations but did not get something better yet ; if you have clear idea in mind may I let you look at this specific topic ? |
I've added a log message, thank you for this clever recommendation |
Yes, it requires some refactor beforehand: the decoder must be separated from the "video stream receiver", so that we can skip the decoder completely (we don't need to decode the video at all if there is no window). I will try to work on it so that it is included in the next version. |
Great to here this kind of news :) thanks a lot! |
Disable decoder, screen (display), file_handler and controller when --no-window is requested. <#418>
I refactored to split the decoder into stream+decoder: e6e011b. It's on I'm closing as merged (even if github does see it as merged). |
Disable decoder, screen (display), file_handler and controller when --no-window is requested. <#418>
I have renamed the option The description of scrcpy is "Display and control your Android device". We want an option to disable display, another one to disable control, so I also implemented |
Tested on multiple devices, seems to work great, thanks ❤️ |
@rom1v is possible to show fps when No-display is enabled? |
Currently, no. A command line option ( |
@Gapplay Please open a new issue for it, to not forget it. |
This option allows scrcpy to be run withou showing preview window : we can now use
scrcpy only for screen recording as an example