wut  v1.5.0
Wii U Toolchain
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
12 extern "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 
25 typedef int CAMHandle;
26 typedef int CAMError;
27 
28 typedef struct CAMEventData CAMEventData;
29 typedef struct CAMMode CAMMode;
30 typedef struct CAMWorkMem CAMWorkMem;
31 typedef struct CAMStreamInfo CAMStreamInfo;
32 typedef struct CAMSetupInfo CAMSetupInfo;
33 typedef struct CAMSurface CAMSurface;
34 
35 typedef enum CamError
36 {
47 
48 typedef enum CamFps
49 {
53 
54 typedef enum CamStreamType
55 {
58 
59 typedef enum CamEventType
60 {
64 
66 {
68  uint32_t data0;
69  uint32_t data1;
70  uint32_t data2;
71 };
72 WUT_CHECK_OFFSET(CAMEventData, 0x00, eventType);
73 WUT_CHECK_OFFSET(CAMEventData, 0x04, data0);
74 WUT_CHECK_OFFSET(CAMEventData, 0x08, data1);
75 WUT_CHECK_OFFSET(CAMEventData, 0x0C, data2);
76 WUT_CHECK_SIZE(CAMEventData, 0x10);
77 
78 typedef void(*CAMEventHandler)(CAMEventData *camEventData);
79 
80 struct CAMMode
81 {
82  int unk_0x00;
84 };
85 WUT_CHECK_OFFSET(CAMMode, 0x00, unk_0x00);
86 WUT_CHECK_OFFSET(CAMMode, 0x04, fps);
87 WUT_CHECK_SIZE(CAMMode, 0x08);
88 
89 struct CAMWorkMem
90 {
91  int size; // size of the work mem
92  void *pMem; // pointer to the work mem
93 };
94 WUT_CHECK_OFFSET(CAMWorkMem, 0x00, size);
95 WUT_CHECK_OFFSET(CAMWorkMem, 0x04, pMem);
96 WUT_CHECK_SIZE(CAMWorkMem, 0x08);
97 
99 {
101  int height; // stream height
102  int width; // stream width
103 };
104 WUT_CHECK_OFFSET(CAMStreamInfo, 0x00, type);
105 WUT_CHECK_OFFSET(CAMStreamInfo, 0x04, height);
106 WUT_CHECK_OFFSET(CAMStreamInfo, 0x08, width);
107 WUT_CHECK_SIZE(CAMStreamInfo, 0x0C);
108 
110 {
114  WUT_UNKNOWN_BYTES(4);
117  uint32_t threadAffinity;
118  WUT_UNKNOWN_BYTES(0x10);
119 };
120 WUT_CHECK_OFFSET(CAMSetupInfo, 0x00, streamInfo);
121 WUT_CHECK_OFFSET(CAMSetupInfo, 0x0C, workMem);
122 WUT_CHECK_OFFSET(CAMSetupInfo, 0x14, eventHandler);
123 WUT_CHECK_OFFSET(CAMSetupInfo, 0x1C, mode);
124 WUT_CHECK_OFFSET(CAMSetupInfo, 0x24, threadAffinity);
125 WUT_CHECK_SIZE(CAMSetupInfo, 0x38);
126 
128 {
131  int height; // surface height
132  int width; // surface width
133  int pitch;
134  int alignment; // surface alignment
135  int tileMode;
137 };
138 WUT_CHECK_OFFSET(CAMSurface, 0x00, surfaceSize);
139 WUT_CHECK_OFFSET(CAMSurface, 0x04, surfaceBuffer);
140 WUT_CHECK_OFFSET(CAMSurface, 0x08, height);
141 WUT_CHECK_OFFSET(CAMSurface, 0x0C, width);
142 WUT_CHECK_OFFSET(CAMSurface, 0x10, pitch);
143 WUT_CHECK_OFFSET(CAMSurface, 0x14, alignment);
144 WUT_CHECK_OFFSET(CAMSurface, 0x18, tileMode);
145 WUT_CHECK_OFFSET(CAMSurface, 0x1C, pixelFormat);
146 WUT_CHECK_SIZE(CAMSurface, 0x20);
147 
148 CAMHandle
149 CAMInit(int instance, CAMSetupInfo *setupInfo, CAMError *err);
150 
151 void
153 
154 CAMError
156 
157 CAMError
159 
160 CAMError
162 
163 CAMError
165 
166 CAMError
167 CAMCheckMemSegmentation(void *pMem, uint32_t size);
168 
169 #ifdef __cplusplus
170 }
171 #endif
int pitch
Definition: camera.h:133
void CAMExit(CAMHandle handle)
int tileMode
Definition: camera.h:135
CAMEventHandler eventHandler
Definition: camera.h:113
uint32_t data0
Definition: camera.h:68
int unk_0x00
Definition: camera.h:82
uint32_t data1
Definition: camera.h:69
uint32_t data2
Definition: camera.h:70
CamEventType eventType
Definition: camera.h:67
CAMWorkMem workMem
Definition: camera.h:112
CAMError CAMCheckMemSegmentation(void *pMem, uint32_t size)
int size
Definition: camera.h:91
CAMStreamInfo streamInfo
Definition: camera.h:111
uint32_t threadAffinity
See OS_THREAD_ATTRIB.
Definition: camera.h:117
CAMError CAMClose(CAMHandle handle)
CamFps fps
Definition: camera.h:83
CamStreamType
Definition: camera.h:55
CAMHandle CAMInit(int instance, CAMSetupInfo *setupInfo, CAMError *err)
CamEventType
Definition: camera.h:60
CAMError CAMGetMemReq(CAMStreamInfo *streamInfo)
int pixelFormat
Definition: camera.h:136
int alignment
Definition: camera.h:134
CAMError CAMOpen(CAMHandle handle)
void(* CAMEventHandler)(CAMEventData *camEventData)
Definition: camera.h:78
int CAMHandle
Definition: camera.h:25
void * surfaceBuffer
Definition: camera.h:130
CamError
Definition: camera.h:36
CAMMode mode
Definition: camera.h:114
int CAMError
Definition: camera.h:26
CamStreamType type
Definition: camera.h:100
CamFps
Definition: camera.h:49
int height
Definition: camera.h:101
int surfaceSize
Definition: camera.h:129
void * pMem
Definition: camera.h:92
CAMError CAMSubmitTargetSurface(CAMHandle handle, CAMSurface *surface)
@ CAMERA_STREAM_TYPE_1
Definition: camera.h:56
@ CAMERA_DECODE_DONE
Definition: camera.h:61
@ CAMERA_DRC_DETACH
Definition: camera.h:62
@ CAMERA_ERROR_INVALID_ARG
Definition: camera.h:38
@ CAMERA_ERROR_UNKNOWN
Definition: camera.h:43
@ CAMERA_ERROR_INVALID_HANDLE
Definition: camera.h:39
@ CAMERA_ERROR_OK
Definition: camera.h:37
@ CAMERA_ERROR_DEVICE_IN_USE
Definition: camera.h:44
@ CAMERA_ERROR_NOT_READY
Definition: camera.h:41
@ CAMERA_ERROR_UNINITIALIZED
Definition: camera.h:42
@ CAMERA_ERROR_INSUFFICIENT_MEMORY
Definition: camera.h:40
@ CAMERA_ERROR_SEGMENT_VIOLATION
Definition: camera.h:45
@ CAMERA_FPS_30
Definition: camera.h:51
@ CAMERA_FPS_15
Definition: camera.h:50
Definition: camera.h:81