wut v1.8.0
Wii U Toolchain
Loading...
Searching...
No Matches
camera.h
Go to the documentation of this file.
1#pragma once
2#include <wut.h>
3#include <coreinit/thread.h>
4
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#define CAMERA_WIDTH 640
16#define CAMERA_PITCH 768
17#define CAMERA_HEIGHT 480
18
19#define CAMERA_Y_BUFFER_SIZE (CAMERA_PITCH * CAMERA_HEIGHT)
20#define CAMERA_UV_BUFFER_SIZE (CAMERA_PITCH * CAMERA_HEIGHT / 2)
21#define CAMERA_YUV_BUFFER_SIZE (CAMERA_Y_BUFFER_SIZE + CAMERA_UV_BUFFER_SIZE)
22
23#define CAMERA_YUV_BUFFER_ALIGNMENT 256
24
25typedef int CAMHandle;
26typedef int CAMError;
27
29typedef struct CAMMode CAMMode;
30typedef struct CAMWorkMem CAMWorkMem;
33typedef struct CAMSurface CAMSurface;
34
50
51typedef enum CamFps
52{
56
61
67
69{
72 union
73 {
74 struct
75 {
82 } decode;
83 struct
84 {
89 } detach;
91 uint32_t args[3];
92 };
93};
94WUT_CHECK_OFFSET(CAMEventData, 0x00, eventType);
95WUT_CHECK_OFFSET(CAMEventData, 0x04, decode.surfaceBuffer);
96WUT_CHECK_OFFSET(CAMEventData, 0x08, decode.handle);
97WUT_CHECK_OFFSET(CAMEventData, 0x0c, decode.failed);
98WUT_CHECK_OFFSET(CAMEventData, 0x04, detach.connected);
99WUT_CHECK_OFFSET(CAMEventData, 0x08, detach.handle);
100WUT_CHECK_OFFSET(CAMEventData, 0x04, args);
101WUT_CHECK_SIZE(CAMEventData, 0x10);
102
103typedef void(*CAMEventHandler)(CAMEventData *camEventData);
104
112WUT_CHECK_OFFSET(CAMMode, 0x00, forceDrc);
113WUT_CHECK_OFFSET(CAMMode, 0x04, fps);
114WUT_CHECK_SIZE(CAMMode, 0x08);
115
117{
119 uint32_t size;
121 void *pMem;
122};
123WUT_CHECK_OFFSET(CAMWorkMem, 0x00, size);
124WUT_CHECK_OFFSET(CAMWorkMem, 0x04, pMem);
125WUT_CHECK_SIZE(CAMWorkMem, 0x08);
126
128{
132 uint32_t height;
134 uint32_t width;
135};
136WUT_CHECK_OFFSET(CAMStreamInfo, 0x00, type);
137WUT_CHECK_OFFSET(CAMStreamInfo, 0x04, height);
138WUT_CHECK_OFFSET(CAMStreamInfo, 0x08, width);
139WUT_CHECK_SIZE(CAMStreamInfo, 0x0C);
140
155WUT_CHECK_OFFSET(CAMSetupInfo, 0x00, streamInfo);
156WUT_CHECK_OFFSET(CAMSetupInfo, 0x0C, workMem);
157WUT_CHECK_OFFSET(CAMSetupInfo, 0x14, eventHandler);
158WUT_CHECK_OFFSET(CAMSetupInfo, 0x18, mode);
159WUT_CHECK_OFFSET(CAMSetupInfo, 0x20, threadAffinity);
160WUT_CHECK_SIZE(CAMSetupInfo, 0x34);
161
163{
165 int32_t surfaceSize;
169 int32_t height;
171 int32_t width;
173 int32_t pitch;
175 int32_t alignment;
177 int32_t tileMode;
179 int32_t pixelFormat;
180};
181WUT_CHECK_OFFSET(CAMSurface, 0x00, surfaceSize);
182WUT_CHECK_OFFSET(CAMSurface, 0x04, surfaceBuffer);
183WUT_CHECK_OFFSET(CAMSurface, 0x08, height);
184WUT_CHECK_OFFSET(CAMSurface, 0x0C, width);
185WUT_CHECK_OFFSET(CAMSurface, 0x10, pitch);
186WUT_CHECK_OFFSET(CAMSurface, 0x14, alignment);
187WUT_CHECK_OFFSET(CAMSurface, 0x18, tileMode);
188WUT_CHECK_OFFSET(CAMSurface, 0x1C, pixelFormat);
189WUT_CHECK_SIZE(CAMSurface, 0x20);
190
196CAMInit(int instance, CAMSetupInfo *setupInfo, CAMError *err);
197
201void
203
209
216
222int32_t
224
233
238CAMCheckMemSegmentation(void *pMem, uint32_t size);
239
240#ifdef __cplusplus
241}
242#endif
void CAMExit(CAMHandle handle)
Deinitialize and clean up.
CAMEventHandler eventHandler
Event handler.
Definition camera.h:148
uint32_t width
Stream width.
Definition camera.h:134
BOOL forceDrc
If TRUE, the GamePad will display the camera output regardless of what is being rendered.
Definition camera.h:108
CamEventType eventType
Event type.
Definition camera.h:71
int32_t width
Surface width.
Definition camera.h:171
CAMWorkMem workMem
Memory used by library to record and decode frames.
Definition camera.h:146
CAMError CAMCheckMemSegmentation(void *pMem, uint32_t size)
Checks whether memory is segmented correctly to be used with the camera library.
CAMStreamInfo streamInfo
Stream info.
Definition camera.h:144
uint32_t threadAffinity
See OS_THREAD_ATTRIB.
Definition camera.h:152
CAMError CAMClose(CAMHandle handle)
Stops recording and decoding.
CamFps fps
Framerate setting.
Definition camera.h:110
CamStreamType
Definition camera.h:58
CAMHandle CAMInit(int instance, CAMSetupInfo *setupInfo, CAMError *err)
Initialize the camera.
int32_t surfaceSize
Number of bytes allocated to surface buffer.
Definition camera.h:165
int32_t height
Surface height.
Definition camera.h:169
CamEventType
Definition camera.h:63
uint32_t height
Stream height.
Definition camera.h:132
int32_t alignment
Surface alignment.
Definition camera.h:175
int32_t tileMode
Tile mode, should be zero.
Definition camera.h:177
int32_t pitch
Surface pitch.
Definition camera.h:173
int32_t pixelFormat
Pixel format, Should be zero.
Definition camera.h:179
CAMError CAMOpen(CAMHandle handle)
Start recording and decoding frames.
void(* CAMEventHandler)(CAMEventData *camEventData)
Definition camera.h:103
int CAMHandle
Definition camera.h:25
void * surfaceBuffer
Pointer to the buffer of the decoded image.
Definition camera.h:77
CamError
Definition camera.h:36
uint32_t size
Size of the work memory.
Definition camera.h:119
int32_t CAMGetMemReq(CAMStreamInfo *streamInfo)
Get the number of bytes requied by the work memory.
CAMMode mode
Camera mode.
Definition camera.h:150
BOOL connected
Will be FALSE.
Definition camera.h:86
int CAMError
Definition camera.h:26
CamStreamType type
Stream type, only CAMERA_STREAM_TYPE_1 is valid.
Definition camera.h:130
CamFps
Definition camera.h:52
CAMHandle handle
Handle of instance.
Definition camera.h:79
void * pMem
Pointer to the work memory.
Definition camera.h:121
CAMError CAMSubmitTargetSurface(CAMHandle handle, CAMSurface *surface)
Submit 1 surface to the working queue.
BOOL failed
TRUE if decode failed.
Definition camera.h:81
@ CAMERA_STREAM_TYPE_1
Definition camera.h:59
@ CAMERA_DECODE_DONE
Definition camera.h:64
@ CAMERA_DRC_DETACH
Definition camera.h:65
@ CAMERA_ERROR_INVALID_ARG
Definition camera.h:38
@ CAMERA_ERROR_TOO_MANY_SURFACES
Definition camera.h:40
@ CAMERA_ERROR_UVD_SESSION
Definition camera.h:47
@ CAMERA_ERROR_INVALID_HANDLE
Definition camera.h:39
@ CAMERA_ERROR_UVD_CONTEXT
Definition camera.h:45
@ CAMERA_ERROR_OK
Definition camera.h:37
@ CAMERA_ERROR_DEVICE_IN_USE
Definition camera.h:46
@ CAMERA_ERROR_NOT_READY
Definition camera.h:42
@ CAMERA_ERROR_UNINITIALIZED
Definition camera.h:43
@ CAMERA_ERROR_INSUFFICIENT_MEMORY
Definition camera.h:41
@ CAMERA_ERROR_UVC
Definition camera.h:44
@ CAMERA_ERROR_SEGMENT_VIOLATION
Definition camera.h:48
@ CAMERA_FPS_30
Definition camera.h:54
@ CAMERA_FPS_15
Definition camera.h:53
int32_t BOOL
Definition wut_types.h:7