OpenMAXAL_Android.h revision af9b87de97356722370d11d2c5797d75cb43969e
1eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi/* 2eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi * Copyright (C) 2010 The Android Open Source Project 3eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi * 4eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi * Licensed under the Apache License, Version 2.0 (the "License"); 5eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi * you may not use this file except in compliance with the License. 6eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi * You may obtain a copy of the License at 7eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi * 8eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi * http://www.apache.org/licenses/LICENSE-2.0 9eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi * 10eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi * Unless required by applicable law or agreed to in writing, software 11eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi * distributed under the License is distributed on an "AS IS" BASIS, 12eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi * See the License for the specific language governing permissions and 14eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi * limitations under the License. 15eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi */ 16eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 17eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi#ifndef OPENMAX_AL_ANDROID_H_ 18eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi#define OPENMAX_AL_ANDROID_H_ 19eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 20eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi#ifdef __cplusplus 21eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Triviextern "C" { 22eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi#endif 23eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 24eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi/*---------------------------------------------------------------------------*/ 25eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi/* Android common types */ 26eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi/*---------------------------------------------------------------------------*/ 27eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 28e9236d046fdb5cac0696c42e03443a2439188146Jean-Michel Trivitypedef xa_int64_t XAAint64; /* 64 bit signed integer */ 2997876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi 30e9236d046fdb5cac0696c42e03443a2439188146Jean-Michel Trivitypedef xa_uint64_t XAAuint64; /* 64 bit unsigned integer */ 31eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 32eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi/*---------------------------------------------------------------------------*/ 336e7e174807fc639c49125ced8962aa369370fbf0Jean-Michel Trivi/* Android common types */ 346e7e174807fc639c49125ced8962aa369370fbf0Jean-Michel Trivi/*---------------------------------------------------------------------------*/ 356e7e174807fc639c49125ced8962aa369370fbf0Jean-Michel Trivi 366e7e174807fc639c49125ced8962aa369370fbf0Jean-Michel Trivi#define XA_ANDROID_VIDEOCODEC_VP8 ((XAuint32) 0x00000006) 376e7e174807fc639c49125ced8962aa369370fbf0Jean-Michel Trivi 386e7e174807fc639c49125ced8962aa369370fbf0Jean-Michel Trivi#define XA_ANDROID_VIDEOPROFILE_VP8_MAIN ((XAuint32) 0x00000001) 396e7e174807fc639c49125ced8962aa369370fbf0Jean-Michel Trivi 406e7e174807fc639c49125ced8962aa369370fbf0Jean-Michel Trivi#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION0 ((XAuint32) 0x00000001) 416e7e174807fc639c49125ced8962aa369370fbf0Jean-Michel Trivi#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION1 ((XAuint32) 0x00000002) 426e7e174807fc639c49125ced8962aa369370fbf0Jean-Michel Trivi#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION2 ((XAuint32) 0x00000003) 436e7e174807fc639c49125ced8962aa369370fbf0Jean-Michel Trivi#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION3 ((XAuint32) 0x00000004) 446e7e174807fc639c49125ced8962aa369370fbf0Jean-Michel Trivi 456e7e174807fc639c49125ced8962aa369370fbf0Jean-Michel Trivi/*---------------------------------------------------------------------------*/ 46d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi/* Android Buffer Queue Interface */ 47eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi/*---------------------------------------------------------------------------*/ 48eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 4960ca9f9ef02f6e486c3338cb811f603dd7825c05Glenn Kastenextern XA_API const XAInterfaceID XA_IID_ANDROIDBUFFERQUEUESOURCE; 50eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 51eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivistruct XAAndroidBufferQueueItf_; 52eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivitypedef const struct XAAndroidBufferQueueItf_ * const * XAAndroidBufferQueueItf; 53eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 541c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi#define XA_ANDROID_ITEMKEY_NONE ((XAuint32) 0x00000000) 551c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi#define XA_ANDROID_ITEMKEY_EOS ((XAuint32) 0x00000001) 561c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi#define XA_ANDROID_ITEMKEY_DISCONTINUITY ((XAuint32) 0x00000002) 571c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi#define XA_ANDROID_ITEMKEY_BUFFERQUEUEEVENT ((XAuint32) 0x00000003) 586f0f5640d190b0187c356eb53bd96d9f9e49da60Jean-Michel Trivi#define XA_ANDROID_ITEMKEY_FORMAT_CHANGE ((XAuint32) 0x00000004) 591c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi 60af9b87de97356722370d11d2c5797d75cb43969eJean-Michel Trivi// optional data for XA_ANDROID_ITEMKEY_FORMAT_CHANGE, used when only one stream changes format, 61af9b87de97356722370d11d2c5797d75cb43969eJean-Michel Trivi// and the others remain continuous (i.e. no temporal discontinuity is introduced for them) 62af9b87de97356722370d11d2c5797d75cb43969eJean-Michel Trivi// candidate for being exposed in NDK 63af9b87de97356722370d11d2c5797d75cb43969eJean-Michel Trivi#define XA_ANDROID_FORMATCHANGE_ITEMDATA_VIDEO ((XAuint32) 0x00000001) 64af9b87de97356722370d11d2c5797d75cb43969eJean-Michel Trivi// not supported at this stage, for illustration purposes only 65af9b87de97356722370d11d2c5797d75cb43969eJean-Michel Trivi//#define XA_ANDROID_FORMATCHANGE_ITEMDATA_AUDIO ((XAuint32) 0x00000002) 66af9b87de97356722370d11d2c5797d75cb43969eJean-Michel Trivi 6723fc68ef3d6b7c5e6ceaf530fc9522c109f3a43eGlenn Kasten#define XA_ANDROIDBUFFERQUEUEEVENT_NONE ((XAuint32) 0x00000000) 6823fc68ef3d6b7c5e6ceaf530fc9522c109f3a43eGlenn Kasten#define XA_ANDROIDBUFFERQUEUEEVENT_PROCESSED ((XAuint32) 0x00000001) 69c3b82a293ed06001ba6d50f111608160c6065ef2Glenn Kasten#if 0 // reserved for future use 7023fc68ef3d6b7c5e6ceaf530fc9522c109f3a43eGlenn Kasten#define XA_ANDROIDBUFFERQUEUEEVENT_UNREALIZED ((XAuint32) 0x00000002) 7123fc68ef3d6b7c5e6ceaf530fc9522c109f3a43eGlenn Kasten#define XA_ANDROIDBUFFERQUEUEEVENT_CLEARED ((XAuint32) 0x00000004) 7223fc68ef3d6b7c5e6ceaf530fc9522c109f3a43eGlenn Kasten#define XA_ANDROIDBUFFERQUEUEEVENT_STOPPED ((XAuint32) 0x00000008) 7323fc68ef3d6b7c5e6ceaf530fc9522c109f3a43eGlenn Kasten#define XA_ANDROIDBUFFERQUEUEEVENT_ERROR ((XAuint32) 0x00000010) 7423fc68ef3d6b7c5e6ceaf530fc9522c109f3a43eGlenn Kasten#define XA_ANDROIDBUFFERQUEUEEVENT_CONTENT_END ((XAuint32) 0x00000020) 75c3b82a293ed06001ba6d50f111608160c6065ef2Glenn Kasten#endif 76d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi 77d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivitypedef struct XAAndroidBufferItem_ { 78d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi XAuint32 itemKey; // identifies the item 79d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi XAuint32 itemSize; 80d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi XAuint8 itemData[0]; 81d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi} XAAndroidBufferItem; 82eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 83ebc8fd365b402e498d499fa8737a7591c290347cGlenn Kastentypedef XAresult (XAAPIENTRY *xaAndroidBufferQueueCallback)( 84eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi XAAndroidBufferQueueItf caller,/* input */ 8537dc2fccf3f122b79ebd554de209d0a3c94ae161Jean-Michel Trivi void *pCallbackContext, /* input */ 8637dc2fccf3f122b79ebd554de209d0a3c94ae161Jean-Michel Trivi void *pBufferContext, /* input */ 8737dc2fccf3f122b79ebd554de209d0a3c94ae161Jean-Michel Trivi void *pBufferData, /* input */ 88d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi XAuint32 dataSize, /* input */ 89d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi XAuint32 dataUsed, /* input */ 90d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi const XAAndroidBufferItem *pItems,/* input */ 91d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi XAuint32 itemsLength /* input */ 92eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi); 93eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 94d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivitypedef struct XAAndroidBufferQueueState_ { 95d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi XAuint32 count; 96d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi XAuint32 index; 97d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi} XAAndroidBufferQueueState; 98d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi 99eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivistruct XAAndroidBufferQueueItf_ { 100eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi XAresult (*RegisterCallback) ( 101eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi XAAndroidBufferQueueItf self, 102eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi xaAndroidBufferQueueCallback callback, 10337dc2fccf3f122b79ebd554de209d0a3c94ae161Jean-Michel Trivi void* pCallbackContext 104eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi ); 105eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 106eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi XAresult (*Clear) ( 107eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi XAAndroidBufferQueueItf self 108eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi ); 109eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 110eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi XAresult (*Enqueue) ( 111eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi XAAndroidBufferQueueItf self, 11237dc2fccf3f122b79ebd554de209d0a3c94ae161Jean-Michel Trivi void *pBufferContext, 11337dc2fccf3f122b79ebd554de209d0a3c94ae161Jean-Michel Trivi void *pData, 114d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi XAuint32 dataLength, 115d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi const XAAndroidBufferItem *pItems, 116d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi XAuint32 itemsLength 117eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi ); 118e7bfcdc183454ec959ff51342f0973cabba219b2Jean-Michel Trivi 119e7bfcdc183454ec959ff51342f0973cabba219b2Jean-Michel Trivi XAresult (*GetState) ( 120e7bfcdc183454ec959ff51342f0973cabba219b2Jean-Michel Trivi XAAndroidBufferQueueItf self, 121e7bfcdc183454ec959ff51342f0973cabba219b2Jean-Michel Trivi XAAndroidBufferQueueState *pState 122e7bfcdc183454ec959ff51342f0973cabba219b2Jean-Michel Trivi ); 1231c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi 1241c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi 1251c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi XAresult (*SetCallbackEventsMask) ( 1261c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi XAAndroidBufferQueueItf self, 1271c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi XAuint32 eventFlags 1281c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi ); 1291c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi 1301c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi XAresult (*GetCallbackEventsMask) ( 1311c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi XAAndroidBufferQueueItf self, 1321c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi XAuint32 *pEventFlags 1331c853a41d9d9886e60618a7c878ce3912f46bf3cJean-Michel Trivi ); 134eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi}; 135eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 136eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 137eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi/*---------------------------------------------------------------------------*/ 138eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi/* Android Buffer Queue Data Locator */ 139eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi/*---------------------------------------------------------------------------*/ 140eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 141eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi/** Addendum to Data locator macros */ 142eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi#define XA_DATALOCATOR_ANDROIDBUFFERQUEUE ((XAuint32) 0x800007BE) 143eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 144eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi/** Android Buffer Queue-based data locator definition, 145eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi * locatorType must be XA_DATALOCATOR_ANDROIDBUFFERQUEUE */ 146eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivitypedef struct XADataLocator_AndroidBufferQueue_ { 147eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi XAuint32 locatorType; 148d158d31a6bbb06426b71c3d097b7768bc3fb79a3Jean-Michel Trivi XAuint32 numBuffers; 149eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi} XADataLocator_AndroidBufferQueue; 150eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 15197876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi 15297876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi/*---------------------------------------------------------------------------*/ 15397876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi/* Android File Descriptor Data Locator */ 15497876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi/*---------------------------------------------------------------------------*/ 15597876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi 15697876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi/** Addendum to Data locator macros */ 157ad1ab1d13a9b043202b9d5cdc1d8c4ef66cbbca8Glenn Kasten#define XA_DATALOCATOR_ANDROIDFD ((XAuint32) 0x800007BC) 15897876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi 159ad1ab1d13a9b043202b9d5cdc1d8c4ef66cbbca8Glenn Kasten#define XA_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((XAAint64) 0xFFFFFFFFFFFFFFFFll) 16097876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi 16197876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi/** File Descriptor-based data locator definition, locatorType must be XA_DATALOCATOR_ANDROIDFD */ 16297876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivitypedef struct XADataLocator_AndroidFD_ { 16397876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi XAuint32 locatorType; 16497876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi XAint32 fd; 16597876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi XAAint64 offset; 16697876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi XAAint64 length; 16797876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi} XADataLocator_AndroidFD; 16897876858aa17c7f24c6a1d60be09a57bc1824ba3Jean-Michel Trivi 169c3b82a293ed06001ba6d50f111608160c6065ef2Glenn Kasten/** 170c3b82a293ed06001ba6d50f111608160c6065ef2Glenn Kasten * MIME types required for data in Android Buffer Queues 171c3b82a293ed06001ba6d50f111608160c6065ef2Glenn Kasten */ 172c3b82a293ed06001ba6d50f111608160c6065ef2Glenn Kasten#define XA_ANDROID_MIME_MP2TS ((XAchar *) "video/mp2ts") 173c3b82a293ed06001ba6d50f111608160c6065ef2Glenn Kasten 174eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi#ifdef __cplusplus 175eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi} 176eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi#endif /* __cplusplus */ 177eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi 178eae4df541ba1d46f65d37e959baf2127aa632c93Jean-Michel Trivi#endif /* OPENMAX_AL_ANDROID_H_ */ 179