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