OpenMAXAL_Android.h revision 70c49ae2867094072a4365423417ea452bf82231
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
30
31/*---------------------------------------------------------------------------*/
32/* Android Buffer Queue Interface                                            */
33/*---------------------------------------------------------------------------*/
34
35extern XA_API const XAInterfaceID XA_IID_ANDROIDBUFFERQUEUE;
36
37struct XAAndroidBufferQueueItf_;
38typedef const struct XAAndroidBufferQueueItf_ * const * XAAndroidBufferQueueItf;
39
40#define XA_ANDROID_ITEMKEY_NONE          ((XAuint32) 0x00000000)
41#define XA_ANDROID_ITEMKEY_EOS           ((XAuint32) 0x00000001)
42#define XA_ANDROID_ITEMKEY_DISCONTINUITY ((XAuint32) 0x00000002)
43
44typedef struct XAAndroidBufferItem_ {
45    XAuint32 itemKey;  // identifies the item
46    XAuint32 itemSize;
47    XAuint8  itemData[0];
48} XAAndroidBufferItem;
49
50typedef XAresult (XAAPIENTRY *xaAndroidBufferQueueCallback)(
51    XAAndroidBufferQueueItf caller,/* input */
52    void *pContext,                /* input */
53    const void *pBufferData,       /* input */
54    XAuint32 dataSize,             /* input */
55    XAuint32 dataUsed,             /* input */
56    const XAAndroidBufferItem *pItems,/* input */
57    XAuint32 itemsLength           /* input */
58);
59
60typedef struct XAAndroidBufferQueueState_ {
61    XAuint32    count;
62    XAuint32    index;
63} XAAndroidBufferQueueState;
64
65struct XAAndroidBufferQueueItf_ {
66    XAresult (*RegisterCallback) (
67        XAAndroidBufferQueueItf self,
68        xaAndroidBufferQueueCallback callback,
69        void* pContext
70    );
71
72    XAresult (*Clear) (
73        XAAndroidBufferQueueItf self
74    );
75
76    XAresult (*Enqueue) (
77        XAAndroidBufferQueueItf self,
78        const void *pData,
79        XAuint32 dataLength,
80        const XAAndroidBufferItem *pItems,
81        XAuint32 itemsLength
82    );
83};
84
85
86/*---------------------------------------------------------------------------*/
87/* Android Buffer Queue Data Locator                                         */
88/*---------------------------------------------------------------------------*/
89
90/** Addendum to Data locator macros  */
91#define XA_DATALOCATOR_ANDROIDBUFFERQUEUE       ((XAuint32) 0x800007BE)
92
93/** Android Buffer Queue-based data locator definition,
94 *  locatorType must be XA_DATALOCATOR_ANDROIDBUFFERQUEUE */
95typedef struct XADataLocator_AndroidBufferQueue_ {
96    XAuint32    locatorType;
97    XAuint32    numBuffers;
98} XADataLocator_AndroidBufferQueue;
99
100
101/*---------------------------------------------------------------------------*/
102/* Android File Descriptor Data Locator                                      */
103/*---------------------------------------------------------------------------*/
104
105/** Addendum to Data locator macros  */
106#define XA_DATALOCATOR_ANDROIDFD                ((XAuint32) 0x800007BC)
107
108#define XA_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((XAAint64) 0xFFFFFFFFFFFFFFFFll)
109
110/** File Descriptor-based data locator definition, locatorType must be XA_DATALOCATOR_ANDROIDFD */
111typedef struct XADataLocator_AndroidFD_ {
112    XAuint32        locatorType;
113    XAint32         fd;
114    XAAint64        offset;
115    XAAint64        length;
116} XADataLocator_AndroidFD;
117
118#ifdef __cplusplus
119}
120#endif /* __cplusplus */
121
122#endif /* OPENMAX_AL_ANDROID_H_ */
123