mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-04 15:19:11 +00:00
Initialize only video subsystem in screen.c
SDL may initialize several subsystems (e.g. video and audio). Initialize only video in screen.c, and call SQL_Quit in any case.
This commit is contained in:
parent
c20245630e
commit
36d3799727
4 changed files with 7 additions and 7 deletions
|
@ -319,6 +319,8 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
avformat_network_deinit(); // ignore failure
|
avformat_network_deinit(); // ignore failure
|
||||||
|
|
||||||
|
SDL_Quit();
|
||||||
|
|
||||||
#if defined (__WINDOWS__) && ! defined (WINDOWS_NOCONSOLE)
|
#if defined (__WINDOWS__) && ! defined (WINDOWS_NOCONSOLE)
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
fprintf(stderr, "Press any key to continue...\n");
|
fprintf(stderr, "Press any key to continue...\n");
|
||||||
|
|
|
@ -157,7 +157,7 @@ SDL_bool scrcpy(const struct scrcpy_options *options) {
|
||||||
LOGW("Cannot request to keep default signal handlers");
|
LOGW("Cannot request to keep default signal handlers");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sdl_init_and_configure()) {
|
if (!sdl_video_init()) {
|
||||||
ret = SDL_FALSE;
|
ret = SDL_FALSE;
|
||||||
goto finally_destroy_server;
|
goto finally_destroy_server;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,12 @@
|
||||||
|
|
||||||
#define DISPLAY_MARGINS 96
|
#define DISPLAY_MARGINS 96
|
||||||
|
|
||||||
SDL_bool sdl_init_and_configure(void) {
|
SDL_bool sdl_video_init(void) {
|
||||||
if (SDL_Init(SDL_INIT_VIDEO)) {
|
if (SDL_InitSubSystem(SDL_INIT_VIDEO)) {
|
||||||
LOGC("Could not initialize SDL: %s", SDL_GetError());
|
LOGC("Could not initialize SDL video: %s", SDL_GetError());
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
atexit(SDL_Quit);
|
|
||||||
|
|
||||||
// Use the best available scale quality
|
// Use the best available scale quality
|
||||||
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "2")) {
|
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "2")) {
|
||||||
LOGW("Could not enable bilinear filtering");
|
LOGW("Could not enable bilinear filtering");
|
||||||
|
|
|
@ -35,7 +35,7 @@ struct screen {
|
||||||
}
|
}
|
||||||
|
|
||||||
// init SDL and set appropriate hints
|
// init SDL and set appropriate hints
|
||||||
SDL_bool sdl_init_and_configure(void);
|
SDL_bool sdl_video_init(void);
|
||||||
|
|
||||||
// initialize default values
|
// initialize default values
|
||||||
void screen_init(struct screen *screen);
|
void screen_init(struct screen *screen);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue