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