Reference video buffer from screen

This paves the way to handle EVENT_NEW_FRAME from screen.c, by allowing
to call screen_update_frame() without an explicit video_buffer instance.
This commit is contained in:
Romain Vimont
2021-02-15 18:28:41 +01:00
parent 0538e9645b
commit ea2369f568
3 changed files with 12 additions and 7 deletions

View File

@@ -30,7 +30,7 @@
#include "util/net.h"
static struct server server;
static struct screen screen = SCREEN_INITIALIZER;
static struct screen screen;
static struct fps_counter fps_counter;
static struct video_buffer video_buffer;
static struct stream stream;
@@ -179,7 +179,7 @@ handle_event(SDL_Event *event, const struct scrcpy_options *options) {
// this is the very first frame, show the window
screen_show_window(&screen);
}
if (!screen_update_frame(&screen, &video_buffer)) {
if (!screen_update_frame(&screen)) {
return EVENT_RESULT_CONTINUE;
}
break;
@@ -429,6 +429,8 @@ scrcpy(const struct scrcpy_options *options) {
const char *window_title =
options->window_title ? options->window_title : device_name;
screen_init(&screen, &video_buffer);
if (!screen_init_rendering(&screen, window_title, frame_size,
options->always_on_top, options->window_x,
options->window_y, options->window_width,