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

@@ -191,8 +191,9 @@ screen_update_content_rect(struct screen *screen) {
}
void
screen_init(struct screen *screen) {
screen_init(struct screen *screen, struct video_buffer *vb) {
*screen = (struct screen) SCREEN_INITIALIZER;
screen->vb = vb;
}
static inline SDL_Texture *
@@ -446,8 +447,8 @@ update_texture(struct screen *screen, const AVFrame *frame) {
}
bool
screen_update_frame(struct screen *screen, struct video_buffer *vb) {
const AVFrame *frame = video_buffer_take_rendering_frame(vb);
screen_update_frame(struct screen *screen) {
const AVFrame *frame = video_buffer_take_rendering_frame(screen->vb);
struct size new_frame_size = {frame->width, frame->height};
if (!prepare_for_frame(screen, new_frame_size)) {
return false;