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