OpenMAXAL_Android.h revision 37dc2fccf3f122b79ebd554de209d0a3c94ae161
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 *pCallbackContext,        /* input */
53    void *pBufferContext,          /* input */
54    void *pBufferData,             /* input */
55    XAuint32 dataSize,             /* input */
56    XAuint32 dataUsed,             /* input */
57    const XAAndroidBufferItem *pItems,/* input */
58    XAuint32 itemsLength           /* input */
59);
60
61typedef struct XAAndroidBufferQueueState_ {
62    XAuint32    count;
63    XAuint32    index;
64} XAAndroidBufferQueueState;
65
66struct XAAndroidBufferQueueItf_ {
67    XAresult (*RegisterCallback) (
68        XAAndroidBufferQueueItf self,
69        xaAndroidBufferQueueCallback callback,
70        void* pCallbackContext
71    );
72
73    XAresult (*Clear) (
74        XAAndroidBufferQueueItf self
75    );
76
77    XAresult (*Enqueue) (
78        XAAndroidBufferQueueItf self,
79        void *pBufferContext,
80        void *pData,
81        XAuint32 dataLength,
82        const XAAndroidBufferItem *pItems,
83        XAuint32 itemsLength
84    );
85
86    XAresult (*GetState) (
87        XAAndroidBufferQueueItf self,
88        XAAndroidBufferQueueState *pState
89    );
90};
91
92
93/*---------------------------------------------------------------------------*/
94/* Android Buffer Queue Data Locator                                         */
95/*---------------------------------------------------------------------------*/
96
97/** Addendum to Data locator macros  */
98#define XA_DATALOCATOR_ANDROIDBUFFERQUEUE       ((XAuint32) 0x800007BE)
99
100/** Android Buffer Queue-based data locator definition,
101 *  locatorType must be XA_DATALOCATOR_ANDROIDBUFFERQUEUE */
102typedef struct XADataLocator_AndroidBufferQueue_ {
103    XAuint32    locatorType;
104    XAuint32    numBuffers;
105} XADataLocator_AndroidBufferQueue;
106
107
108/*---------------------------------------------------------------------------*/
109/* Android File Descriptor Data Locator                                      */
110/*---------------------------------------------------------------------------*/
111
112/** Addendum to Data locator macros  */
113#define XA_DATALOCATOR_ANDROIDFD                ((XAuint32) 0x800007BC)
114
115#define XA_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((XAAint64) 0xFFFFFFFFFFFFFFFFll)
116
117/** File Descriptor-based data locator definition, locatorType must be XA_DATALOCATOR_ANDROIDFD */
118typedef struct XADataLocator_AndroidFD_ {
119    XAuint32        locatorType;
120    XAint32         fd;
121    XAAint64        offset;
122    XAAint64        length;
123} XADataLocator_AndroidFD;
124
125#ifdef __cplusplus
126}
127#endif /* __cplusplus */
128
129#endif /* OPENMAX_AL_ANDROID_H_ */
130