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