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