#pragma once #include #include #ifdef CAMU_HAVE_FFMPEG #include #endif #if defined STELA_API_OPENGL #ifdef STELA_USE_EGL #include #endif #endif enum { CAMU_RENDERER_FULLSCREEN = 0, CAMU_RENDERER_SCALING, CAMU_RENDERER_BACKGROUND }; enum { CAMU_SCALING_DEFAULT = 0, CAMU_SCALING_NEAREST }; enum { CAMU_BACKGROUND_DEFAULT = 0, CAMU_BACKGROUND_TRANSPARENT }; struct camu_overlay { u16 ref; u16 alloc; s32 num; struct nn_mutex *lock; }; #define CAMU_OVERLAY_OFFSET(overlay, n) ((void *)(((u8 *)(overlay)) + sizeof(struct camu_overlay) + (n))) #define CAMU_OVERLAY_FROM_HEAD(p) (struct camu_overlay *)(((u8 *)p) - sizeof(struct camu_overlay)) struct camu_frame_queue; struct camu_codec_stream; struct camu_screen; struct camu_renderer { bool (*create_renderer)( struct camu_renderer *, u32 *, u32 *, #if defined STELA_API_VULKAN VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL (*get_vk_proc_address)(VkInstance, const char *), VkResult (*vk_create_surface)(void *, VkInstance, VkSurfaceKHR *), VkResult (*vk_destroy_surface)(VkInstance, VkSurfaceKHR), const char *const *(*vk_get_extensions)(u32 *), #elif defined STELA_API_DX11 HWND win32_window, #elif defined STELA_API_OPENGL #ifdef STELA_USE_EGL EGLDisplay display, EGLContext context, #endif void (*get_gl_proc_address(char const *))(void), bool (*gl_load_loader)(void *), bool (*gl_make_current)(void *), void (*gl_release_current)(void *), void (*gl_swap_buffers)(void *), #endif void *priv); struct camu_frame_queue *(*create_queue)(struct camu_renderer *); void (*add_font)(struct camu_renderer *, struct camu_codec_stream *); u32 (*get_latency)(struct camu_renderer *); void (*resize)(struct camu_renderer *, u32 *, u32 *); void (*set)(struct camu_renderer *, u8, u8); bool (*render)(struct camu_renderer *, struct camu_screen *, bool); #ifdef CAMU_HAVE_FFMPEG s32 (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, s32 flags); void *opaque; #endif void (*free)(struct camu_renderer **); }; struct camu_overlay *camu_overlay_alloc(struct camu_overlay *prev, u32 count, size_t item_size);