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 common types */ 34/*---------------------------------------------------------------------------*/ 35 36#define XA_ANDROID_VIDEOCODEC_VP8 ((XAuint32) 0x00000006) 37 38#define XA_ANDROID_VIDEOPROFILE_VP8_MAIN ((XAuint32) 0x00000001) 39 40#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION0 ((XAuint32) 0x00000001) 41#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION1 ((XAuint32) 0x00000002) 42#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION2 ((XAuint32) 0x00000003) 43#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION3 ((XAuint32) 0x00000004) 44 45/*---------------------------------------------------------------------------*/ 46/* Android Buffer Queue Interface */ 47/*---------------------------------------------------------------------------*/ 48 49extern XA_API const XAInterfaceID XA_IID_ANDROIDBUFFERQUEUESOURCE; 50 51struct XAAndroidBufferQueueItf_; 52typedef const struct XAAndroidBufferQueueItf_ * const * XAAndroidBufferQueueItf; 53 54#define XA_ANDROID_ITEMKEY_NONE ((XAuint32) 0x00000000) 55#define XA_ANDROID_ITEMKEY_EOS ((XAuint32) 0x00000001) 56#define XA_ANDROID_ITEMKEY_DISCONTINUITY ((XAuint32) 0x00000002) 57#define XA_ANDROID_ITEMKEY_BUFFERQUEUEEVENT ((XAuint32) 0x00000003) 58#define XA_ANDROID_ITEMKEY_FORMAT_CHANGE ((XAuint32) 0x00000004) 59 60// optional data for XA_ANDROID_ITEMKEY_FORMAT_CHANGE, used when only one stream changes format, 61// and the others remain continuous (i.e. no temporal discontinuity is introduced for them) 62// candidate for being exposed in NDK 63#define XA_ANDROID_FORMATCHANGE_ITEMDATA_VIDEO ((XAuint32) 0x00000001) 64// not supported at this stage, for illustration purposes only 65//#define XA_ANDROID_FORMATCHANGE_ITEMDATA_AUDIO ((XAuint32) 0x00000002) 66 67#define XA_ANDROIDBUFFERQUEUEEVENT_NONE ((XAuint32) 0x00000000) 68#define XA_ANDROIDBUFFERQUEUEEVENT_PROCESSED ((XAuint32) 0x00000001) 69#if 0 // reserved for future use 70#define XA_ANDROIDBUFFERQUEUEEVENT_UNREALIZED ((XAuint32) 0x00000002) 71#define XA_ANDROIDBUFFERQUEUEEVENT_CLEARED ((XAuint32) 0x00000004) 72#define XA_ANDROIDBUFFERQUEUEEVENT_STOPPED ((XAuint32) 0x00000008) 73#define XA_ANDROIDBUFFERQUEUEEVENT_ERROR ((XAuint32) 0x00000010) 74#define XA_ANDROIDBUFFERQUEUEEVENT_CONTENT_END ((XAuint32) 0x00000020) 75#endif 76 77typedef struct XAAndroidBufferItem_ { 78 XAuint32 itemKey; // identifies the item 79 XAuint32 itemSize; 80 XAuint8 itemData[0]; 81} XAAndroidBufferItem; 82 83typedef XAresult (XAAPIENTRY *xaAndroidBufferQueueCallback)( 84 XAAndroidBufferQueueItf caller,/* input */ 85 void *pCallbackContext, /* input */ 86 void *pBufferContext, /* input */ 87 void *pBufferData, /* input */ 88 XAuint32 dataSize, /* input */ 89 XAuint32 dataUsed, /* input */ 90 const XAAndroidBufferItem *pItems,/* input */ 91 XAuint32 itemsLength /* input */ 92); 93 94typedef struct XAAndroidBufferQueueState_ { 95 XAuint32 count; 96 XAuint32 index; 97} XAAndroidBufferQueueState; 98 99struct XAAndroidBufferQueueItf_ { 100 XAresult (*RegisterCallback) ( 101 XAAndroidBufferQueueItf self, 102 xaAndroidBufferQueueCallback callback, 103 void* pCallbackContext 104 ); 105 106 XAresult (*Clear) ( 107 XAAndroidBufferQueueItf self 108 ); 109 110 XAresult (*Enqueue) ( 111 XAAndroidBufferQueueItf self, 112 void *pBufferContext, 113 void *pData, 114 XAuint32 dataLength, 115 const XAAndroidBufferItem *pItems, 116 XAuint32 itemsLength 117 ); 118 119 XAresult (*GetState) ( 120 XAAndroidBufferQueueItf self, 121 XAAndroidBufferQueueState *pState 122 ); 123 124 125 XAresult (*SetCallbackEventsMask) ( 126 XAAndroidBufferQueueItf self, 127 XAuint32 eventFlags 128 ); 129 130 XAresult (*GetCallbackEventsMask) ( 131 XAAndroidBufferQueueItf self, 132 XAuint32 *pEventFlags 133 ); 134}; 135 136 137/*---------------------------------------------------------------------------*/ 138/* Android Buffer Queue Data Locator */ 139/*---------------------------------------------------------------------------*/ 140 141/** Addendum to Data locator macros */ 142#define XA_DATALOCATOR_ANDROIDBUFFERQUEUE ((XAuint32) 0x800007BE) 143 144/** Android Buffer Queue-based data locator definition, 145 * locatorType must be XA_DATALOCATOR_ANDROIDBUFFERQUEUE */ 146typedef struct XADataLocator_AndroidBufferQueue_ { 147 XAuint32 locatorType; 148 XAuint32 numBuffers; 149} XADataLocator_AndroidBufferQueue; 150 151 152/*---------------------------------------------------------------------------*/ 153/* Android File Descriptor Data Locator */ 154/*---------------------------------------------------------------------------*/ 155 156/** Addendum to Data locator macros */ 157#define XA_DATALOCATOR_ANDROIDFD ((XAuint32) 0x800007BC) 158 159#define XA_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((XAAint64) 0xFFFFFFFFFFFFFFFFll) 160 161/** File Descriptor-based data locator definition, locatorType must be XA_DATALOCATOR_ANDROIDFD */ 162typedef struct XADataLocator_AndroidFD_ { 163 XAuint32 locatorType; 164 XAint32 fd; 165 XAAint64 offset; 166 XAAint64 length; 167} XADataLocator_AndroidFD; 168 169/** 170 * MIME types required for data in Android Buffer Queues 171 */ 172#define XA_ANDROID_MIME_MP2TS ((XAchar *) "video/mp2ts") 173 174#ifdef __cplusplus 175} 176#endif /* __cplusplus */ 177 178#endif /* OPENMAX_AL_ANDROID_H_ */ 179