OpenMAXAL_Android.h revision 97876858aa17c7f24c6a1d60be09a57bc1824ba3
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/* Android Simple Buffer Queue Interface                                     */
34/*---------------------------------------------------------------------------*/
35#if 0
36extern XA_API const SLInterfaceID XA_IID_ANDROIDSIMPLEBUFFERQUEUE;
37
38struct XAAndroidSimpleBufferQueueItf_;
39typedef const struct XAAndroidSimpleBufferQueueItf_ * const * XAAndroidSimpleBufferQueueItf;
40
41typedef void (XAAPIENTRY *xaAndroidSimpleBufferQueueCallback)(
42    xaAndroidSimpleBufferQueueItf caller,
43    void *pContext
44);
45
46/** Android simple buffer queue state **/
47
48typedef struct XAAndroidSimpleBufferQueueState_ {
49    SLuint32    count;
50    SLuint32    index;
51} XAAndroidSimpleBufferQueueState;
52
53
54struct XAAndroidSimpleBufferQueueItf_ {
55    XAresult (*Enqueue) (
56        XAAndroidSimpleBufferQueueItf self,
57        const void *pBuffer,
58        XAuint32 size
59    );
60    XAresult (*Clear) (
61        XAAndroidSimpleBufferQueueItf self
62    );
63    XAresult (*GetState) (
64        XAAndroidSimpleBufferQueueItf self,
65        XAAndroidSimpleBufferQueueState *pState
66    );
67    XAresult (*RegisterCallback) (
68        XAAndroidSimpleBufferQueueItf self,
69        xaAndroidSimpleBufferQueueCallback callback,
70        void* pContext
71    );
72};
73#endif
74
75/*---------------------------------------------------------------------------*/
76/* Android Buffer Queue Interface                                           */
77/*---------------------------------------------------------------------------*/
78
79extern XA_API const XAInterfaceID XA_IID_ANDROIDBUFFERQUEUE;
80
81struct XAAndroidBufferQueueItf_;
82typedef const struct XAAndroidBufferQueueItf_ * const * XAAndroidBufferQueueItf;
83
84#define XA_ANDROIDBUFFERQUEUE_EVENT_NONE              ((XAuint32) 0x00000000)
85#define XA_ANDROIDBUFFERQUEUE_EVENT_EOS               ((XAuint32) 0x00000001)
86#define XA_ANDROIDBUFFERQUEUE_EVENT_DISCONTINUITY     ((XAuint32) 0x00000002)
87
88typedef XAresult (XAAPIENTRY *xaAndroidBufferQueueCallback)(
89    XAAndroidBufferQueueItf caller,/* input */
90    void *pContext,                /* input */
91    XAuint32 bufferId,             /* input */
92    XAuint32 bufferLength,         /* input */
93    void *pBufferDataLocation      /* input */
94);
95
96struct XAAndroidBufferQueueItf_ {
97    XAresult (*RegisterCallback) (
98        XAAndroidBufferQueueItf self,
99        xaAndroidBufferQueueCallback callback,
100        void* pContext
101    );
102
103    XAresult (*Clear) (
104        XAAndroidBufferQueueItf self
105    );
106
107    XAresult (*Enqueue) (
108        XAAndroidBufferQueueItf self,
109        XAuint32 bufferId,
110        XAuint32 length,
111        XAAbufferQueueEvent event,
112        void *pData // FIXME ignored for now, subject to change
113    );
114};
115
116
117/*---------------------------------------------------------------------------*/
118/* Android Buffer Queue Data Locator                                         */
119/*---------------------------------------------------------------------------*/
120
121/** Addendum to Data locator macros  */
122#define XA_DATALOCATOR_ANDROIDBUFFERQUEUE       ((XAuint32) 0x800007BE)
123
124/** Android Buffer Queue-based data locator definition,
125 *  locatorType must be XA_DATALOCATOR_ANDROIDBUFFERQUEUE */
126typedef struct XADataLocator_AndroidBufferQueue_ {
127    XAuint32    locatorType;
128    XAuint32    numBuffers;  // FIXME ignored for now, subject to change
129    XAuint32    queueSize;   // FIXME ignored for now, subject to change
130} XADataLocator_AndroidBufferQueue;
131
132
133/*---------------------------------------------------------------------------*/
134/* Android File Descriptor Data Locator                                      */
135/*---------------------------------------------------------------------------*/
136
137/** Addendum to Data locator macros  */
138#define XA_DATALOCATOR_ANDROIDFD                ((SLuint32) 0x800007BC)
139
140#define XA_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((SLAint64) 0xFFFFFFFFFFFFFFFFll)
141
142/** File Descriptor-based data locator definition, locatorType must be XA_DATALOCATOR_ANDROIDFD */
143typedef struct XADataLocator_AndroidFD_ {
144    XAuint32        locatorType;
145    XAint32         fd;
146    XAAint64        offset;
147    XAAint64        length;
148} XADataLocator_AndroidFD;
149
150#ifdef __cplusplus
151}
152#endif /* __cplusplus */
153
154#endif /* OPENMAX_AL_ANDROID_H_ */
155