Files
scrcpy/app/src/display.h
2026-01-24 22:41:34 +01:00

58 lines
1.2 KiB
C

#ifndef SC_DISPLAY_H
#define SC_DISPLAY_H
#include "common.h"
#include <stdbool.h>
#include <stdint.h>
#include <libavutil/frame.h>
#include <SDL3/SDL.h>
#include "coords.h"
#include "opengl.h"
#ifdef __APPLE__
# define SC_DISPLAY_FORCE_OPENGL_CORE_PROFILE
#endif
enum sc_texture_type {
SC_TEXTURE_TYPE_FRAME,
SC_TEXTURE_TYPE_ICON,
};
struct sc_display {
SDL_Renderer *renderer; // owned by the caller
SDL_Texture *texture;
// Only valid if texture != NULL
struct sc_size texture_size;
enum sc_texture_type texture_type;
struct sc_opengl gl;
#ifdef SC_DISPLAY_FORCE_OPENGL_CORE_PROFILE
SDL_GLContext gl_context;
#endif
bool mipmaps;
uint32_t texture_id; // only set if mipmaps is enabled
};
bool
sc_display_init(struct sc_display *display, SDL_Renderer *renderer,
bool mipmaps);
void
sc_display_destroy(struct sc_display *display);
bool
sc_display_set_texture_from_frame(struct sc_display *display,
const AVFrame *frame);
bool
sc_display_set_texture_from_surface(struct sc_display *display,
SDL_Surface *surface);
SDL_Texture *
sc_display_get_current_texture(struct sc_display *display);
#endif