OpenMAXAL_Android.h revision 6e7e174807fc639c49125ced8962aa369370fbf0
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
59#define XA_ANDROIDBUFFERQUEUEEVENT_NONE        ((SLuint32) 0x00000000)
60#define XA_ANDROIDBUFFERQUEUEEVENT_PROCESSED   ((SLuint32) 0x00000001)
61#define XA_ANDROIDBUFFERQUEUEEVENT_UNREALIZED  ((SLuint32) 0x00000002)
62#define XA_ANDROIDBUFFERQUEUEEVENT_CLEARED     ((SLuint32) 0x00000004)
63#define XA_ANDROIDBUFFERQUEUEEVENT_STOPPED     ((SLuint32) 0x00000008)
64#define XA_ANDROIDBUFFERQUEUEEVENT_ERROR       ((SLuint32) 0x00000010)
65#define XA_ANDROIDBUFFERQUEUEEVENT_CONTENT_END ((SLuint32) 0x00000020)
66
67typedef struct XAAndroidBufferItem_ {
68    XAuint32 itemKey;  // identifies the item
69    XAuint32 itemSize;
70    XAuint8  itemData[0];
71} XAAndroidBufferItem;
72
73typedef XAresult (XAAPIENTRY *xaAndroidBufferQueueCallback)(
74    XAAndroidBufferQueueItf caller,/* input */
75    void *pCallbackContext,        /* input */
76    void *pBufferContext,          /* input */
77    void *pBufferData,             /* input */
78    XAuint32 dataSize,             /* input */
79    XAuint32 dataUsed,             /* input */
80    const XAAndroidBufferItem *pItems,/* input */
81    XAuint32 itemsLength           /* input */
82);
83
84typedef struct XAAndroidBufferQueueState_ {
85    XAuint32    count;
86    XAuint32    index;
87} XAAndroidBufferQueueState;
88
89struct XAAndroidBufferQueueItf_ {
90    XAresult (*RegisterCallback) (
91        XAAndroidBufferQueueItf self,
92        xaAndroidBufferQueueCallback callback,
93        void* pCallbackContext
94    );
95
96    XAresult (*Clear) (
97        XAAndroidBufferQueueItf self
98    );
99
100    XAresult (*Enqueue) (
101        XAAndroidBufferQueueItf self,
102        void *pBufferContext,
103        void *pData,
104        XAuint32 dataLength,
105        const XAAndroidBufferItem *pItems,
106        XAuint32 itemsLength
107    );
108
109    XAresult (*GetState) (
110        XAAndroidBufferQueueItf self,
111        XAAndroidBufferQueueState *pState
112    );
113
114
115    XAresult (*SetCallbackEventsMask) (
116            XAAndroidBufferQueueItf self,
117            XAuint32 eventFlags
118    );
119
120    XAresult (*GetCallbackEventsMask) (
121            XAAndroidBufferQueueItf self,
122            XAuint32 *pEventFlags
123    );
124};
125
126
127/*---------------------------------------------------------------------------*/
128/* Android Buffer Queue Data Locator                                         */
129/*---------------------------------------------------------------------------*/
130
131/** Addendum to Data locator macros  */
132#define XA_DATALOCATOR_ANDROIDBUFFERQUEUE       ((XAuint32) 0x800007BE)
133
134/** Android Buffer Queue-based data locator definition,
135 *  locatorType must be XA_DATALOCATOR_ANDROIDBUFFERQUEUE */
136typedef struct XADataLocator_AndroidBufferQueue_ {
137    XAuint32    locatorType;
138    XAuint32    numBuffers;
139} XADataLocator_AndroidBufferQueue;
140
141
142/*---------------------------------------------------------------------------*/
143/* Android File Descriptor Data Locator                                      */
144/*---------------------------------------------------------------------------*/
145
146/** Addendum to Data locator macros  */
147#define XA_DATALOCATOR_ANDROIDFD                ((XAuint32) 0x800007BC)
148
149#define XA_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((XAAint64) 0xFFFFFFFFFFFFFFFFll)
150
151/** File Descriptor-based data locator definition, locatorType must be XA_DATALOCATOR_ANDROIDFD */
152typedef struct XADataLocator_AndroidFD_ {
153    XAuint32        locatorType;
154    XAint32         fd;
155    XAAint64        offset;
156    XAAint64        length;
157} XADataLocator_AndroidFD;
158
159#ifdef __cplusplus
160}
161#endif /* __cplusplus */
162
163#endif /* OPENMAX_AL_ANDROID_H_ */
164