1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#pragma once
#include <al/types.h>
#include <stl/window.h>
#ifdef CAMU_HAVE_FFMPEG
#include <libavcodec/avcodec.h>
#endif
#if defined STELA_API_OPENGL
#ifdef STELA_USE_EGL
#include <stl/egl.h>
#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);
|