OpenMAXAL_Android.h revision 23fc68ef3d6b7c5e6ceaf530fc9522c109f3a43e
1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef OPENMAX_AL_ANDROID_H_
18#define OPENMAX_AL_ANDROID_H_
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24/*---------------------------------------------------------------------------*/
25/* Android common types                                                      */
26/*---------------------------------------------------------------------------*/
27
28typedef xa_int64_t             XAAint64;          /* 64 bit signed integer   */
29
30typedef xa_uint64_t            XAAuint64;         /* 64 bit unsigned integer */
31
32/*---------------------------------------------------------------------------*/
33/* Android common types                                                      */
34/*---------------------------------------------------------------------------*/
35
36#define XA_ANDROID_VIDEOCODEC_VP8            ((XAuint32) 0x00000006)
37
38#define XA_ANDROID_VIDEOPROFILE_VP8_MAIN     ((XAuint32) 0x00000001)
39
40#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION0   ((XAuint32) 0x00000001)
41#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION1   ((XAuint32) 0x00000002)
42#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION2   ((XAuint32) 0x00000003)
43#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION3   ((XAuint32) 0x00000004)
44
45/*---------------------------------------------------------------------------*/
46/* Android Buffer Queue Interface                                            */
47/*---------------------------------------------------------------------------*/
48
49extern XA_API const XAInterfaceID XA_IID_ANDROIDBUFFERQUEUE;
50
51struct XAAndroidBufferQueueItf_;
52typedef const struct XAAndroidBufferQueueItf_ * const * XAAndroidBufferQueueItf;
53
54#define XA_ANDROID_ITEMKEY_NONE             ((XAuint32) 0x00000000)
55#define XA_ANDROID_ITEMKEY_EOS              ((XAuint32) 0x00000001)
56#define XA_ANDROID_ITEMKEY_DISCONTINUITY    ((XAuint32) 0x00000002)
57#define XA_ANDROID_ITEMKEY_BUFFERQUEUEEVENT ((XAuint32) 0x00000003)
58#define XA_ANDROID_ITEMKEY_FORMAT_CHANGE    ((XAuint32) 0x00000004)
59
60#define XA_ANDROIDBUFFERQUEUEEVENT_NONE        ((XAuint32) 0x00000000)
61#define XA_ANDROIDBUFFERQUEUEEVENT_PROCESSED   ((XAuint32) 0x00000001)
62#define XA_ANDROIDBUFFERQUEUEEVENT_UNREALIZED  ((XAuint32) 0x00000002)
63#define XA_ANDROIDBUFFERQUEUEEVENT_CLEARED     ((XAuint32) 0x00000004)
64#define XA_ANDROIDBUFFERQUEUEEVENT_STOPPED     ((XAuint32) 0x00000008)
65#define XA_ANDROIDBUFFERQUEUEEVENT_ERROR       ((XAuint32) 0x00000010)
66#define XA_ANDROIDBUFFERQUEUEEVENT_CONTENT_END ((XAuint32) 0x00000020)
67
68typedef struct XAAndroidBufferItem_ {
69    XAuint32 itemKey;  // identifies the item
70    XAuint32 itemSize;
71    XAuint8  itemData[0];
72} XAAndroidBufferItem;
73
74typedef XAresult (XAAPIENTRY *xaAndroidBufferQueueCallback)(
75    XAAndroidBufferQueueItf caller,/* input */
76    void *pCallbackContext,        /* input */
77    void *pBufferContext,          /* input */
78    void *pBufferData,             /* input */
79    XAuint32 dataSize,             /* input */
80    XAuint32 dataUsed,             /* input */
81    const XAAndroidBufferItem *pItems,/* input */
82    XAuint32 itemsLength           /* input */
83);
84
85typedef struct XAAndroidBufferQueueState_ {
86    XAuint32    count;
87    XAuint32    index;
88} XAAndroidBufferQueueState;
89
90struct XAAndroidBufferQueueItf_ {
91    XAresult (*RegisterCallback) (
92        XAAndroidBufferQueueItf self,
93        xaAndroidBufferQueueCallback callback,
94        void* pCallbackContext
95    );
96
97    XAresult (*Clear) (
98        XAAndroidBufferQueueItf self
99    );
100
101    XAresult (*Enqueue) (
102        XAAndroidBufferQueueItf self,
103        void *pBufferContext,
104        void *pData,
105        XAuint32 dataLength,
106        const XAAndroidBufferItem *pItems,
107        XAuint32 itemsLength
108    );
109
110    XAresult (*GetState) (
111        XAAndroidBufferQueueItf self,
112        XAAndroidBufferQueueState *pState
113    );
114
115
116    XAresult (*SetCallbackEventsMask) (
117            XAAndroidBufferQueueItf self,
118            XAuint32 eventFlags
119    );
120
121    XAresult (*GetCallbackEventsMask) (
122            XAAndroidBufferQueueItf self,
123            XAuint32 *pEventFlags
124    );
125};
126
127
128/*---------------------------------------------------------------------------*/
129/* Android Buffer Queue Data Locator                                         */
130/*---------------------------------------------------------------------------*/
131
132/** Addendum to Data locator macros  */
133#define XA_DATALOCATOR_ANDROIDBUFFERQUEUE       ((XAuint32) 0x800007BE)
134
135/** Android Buffer Queue-based data locator definition,
136 *  locatorType must be XA_DATALOCATOR_ANDROIDBUFFERQUEUE */
137typedef struct XADataLocator_AndroidBufferQueue_ {
138    XAuint32    locatorType;
139    XAuint32    numBuffers;
140} XADataLocator_AndroidBufferQueue;
141
142
143/*---------------------------------------------------------------------------*/
144/* Android File Descriptor Data Locator                                      */
145/*---------------------------------------------------------------------------*/
146
147/** Addendum to Data locator macros  */
148#define XA_DATALOCATOR_ANDROIDFD                ((XAuint32) 0x800007BC)
149
150#define XA_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((XAAint64) 0xFFFFFFFFFFFFFFFFll)
151
152/** File Descriptor-based data locator definition, locatorType must be XA_DATALOCATOR_ANDROIDFD */
153typedef struct XADataLocator_AndroidFD_ {
154    XAuint32        locatorType;
155    XAint32         fd;
156    XAAint64        offset;
157    XAAint64        length;
158} XADataLocator_AndroidFD;
159
160#ifdef __cplusplus
161}
162#endif /* __cplusplus */
163
164#endif /* OPENMAX_AL_ANDROID_H_ */
165