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#include "OpenMAXAL.h" 25 26/*---------------------------------------------------------------------------*/ 27/* Android common types */ 28/*---------------------------------------------------------------------------*/ 29 30typedef xa_int64_t XAAint64; /* 64 bit signed integer */ 31 32typedef 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 51extern XA_API const XAInterfaceID XA_IID_ANDROIDBUFFERQUEUESOURCE; 52 53struct XAAndroidBufferQueueItf_; 54typedef 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#define XA_ANDROIDBUFFERQUEUEEVENT_NONE ((XAuint32) 0x00000000) 63#define XA_ANDROIDBUFFERQUEUEEVENT_PROCESSED ((XAuint32) 0x00000001) 64#if 0 // reserved for future use 65#define XA_ANDROIDBUFFERQUEUEEVENT_UNREALIZED ((XAuint32) 0x00000002) 66#define XA_ANDROIDBUFFERQUEUEEVENT_CLEARED ((XAuint32) 0x00000004) 67#define XA_ANDROIDBUFFERQUEUEEVENT_STOPPED ((XAuint32) 0x00000008) 68#define XA_ANDROIDBUFFERQUEUEEVENT_ERROR ((XAuint32) 0x00000010) 69#define XA_ANDROIDBUFFERQUEUEEVENT_CONTENT_END ((XAuint32) 0x00000020) 70#endif 71 72typedef struct XAAndroidBufferItem_ { 73 XAuint32 itemKey; // identifies the item 74 XAuint32 itemSize; 75 XAuint8 itemData[0]; 76} XAAndroidBufferItem; 77 78typedef XAresult (XAAPIENTRY *xaAndroidBufferQueueCallback)( 79 XAAndroidBufferQueueItf caller,/* input */ 80 void *pCallbackContext, /* input */ 81 void *pBufferContext, /* input */ 82 void *pBufferData, /* input */ 83 XAuint32 dataSize, /* input */ 84 XAuint32 dataUsed, /* input */ 85 const XAAndroidBufferItem *pItems,/* input */ 86 XAuint32 itemsLength /* input */ 87); 88 89typedef struct XAAndroidBufferQueueState_ { 90 XAuint32 count; 91 XAuint32 index; 92} XAAndroidBufferQueueState; 93 94struct XAAndroidBufferQueueItf_ { 95 XAresult (*RegisterCallback) ( 96 XAAndroidBufferQueueItf self, 97 xaAndroidBufferQueueCallback callback, 98 void* pCallbackContext 99 ); 100 101 XAresult (*Clear) ( 102 XAAndroidBufferQueueItf self 103 ); 104 105 XAresult (*Enqueue) ( 106 XAAndroidBufferQueueItf self, 107 void *pBufferContext, 108 void *pData, 109 XAuint32 dataLength, 110 const XAAndroidBufferItem *pItems, 111 XAuint32 itemsLength 112 ); 113 114 XAresult (*GetState) ( 115 XAAndroidBufferQueueItf self, 116 XAAndroidBufferQueueState *pState 117 ); 118 119 120 XAresult (*SetCallbackEventsMask) ( 121 XAAndroidBufferQueueItf self, 122 XAuint32 eventFlags 123 ); 124 125 XAresult (*GetCallbackEventsMask) ( 126 XAAndroidBufferQueueItf self, 127 XAuint32 *pEventFlags 128 ); 129}; 130 131 132/*---------------------------------------------------------------------------*/ 133/* Android Buffer Queue Data Locator */ 134/*---------------------------------------------------------------------------*/ 135 136/** Addendum to Data locator macros */ 137#define XA_DATALOCATOR_ANDROIDBUFFERQUEUE ((XAuint32) 0x800007BE) 138 139/** Android Buffer Queue-based data locator definition, 140 * locatorType must be XA_DATALOCATOR_ANDROIDBUFFERQUEUE */ 141typedef struct XADataLocator_AndroidBufferQueue_ { 142 XAuint32 locatorType; 143 XAuint32 numBuffers; 144} XADataLocator_AndroidBufferQueue; 145 146 147/*---------------------------------------------------------------------------*/ 148/* Android File Descriptor Data Locator */ 149/*---------------------------------------------------------------------------*/ 150 151/** Addendum to Data locator macros */ 152#define XA_DATALOCATOR_ANDROIDFD ((XAuint32) 0x800007BC) 153 154#define XA_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((XAAint64) 0xFFFFFFFFFFFFFFFFll) 155 156/** File Descriptor-based data locator definition, locatorType must be XA_DATALOCATOR_ANDROIDFD */ 157typedef struct XADataLocator_AndroidFD_ { 158 XAuint32 locatorType; 159 XAint32 fd; 160 XAAint64 offset; 161 XAAint64 length; 162} XADataLocator_AndroidFD; 163 164/** 165 * MIME types required for data in Android Buffer Queues 166 */ 167#define XA_ANDROID_MIME_MP2TS ((XAchar *) "video/mp2ts") 168 169#ifdef __cplusplus 170} 171#endif /* __cplusplus */ 172 173#endif /* OPENMAX_AL_ANDROID_H_ */ 174