Home | History | Annotate | Download | only in common
      1 /*
      2  *
      3  * Copyright 2010 Samsung Electronics S.LSI Co. LTD
      4  *
      5  * Licensed under the Apache License, Version 2.0 (the "License");
      6  * you may not use this file except in compliance with the License.
      7  * You may obtain a copy of the License at
      8  *
      9  *      http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 /*
     19  * @file       SEC_OMX_Basecomponent.h
     20  * @brief
     21  * @author     SeungBeom Kim (sbcrux.kim (at) samsung.com)
     22  *             Yunji Kim (yunji.kim (at) samsung.com)
     23  * @version    1.0
     24  * @history
     25  *    2010.7.15 : Create
     26  */
     27 
     28 #ifndef SEC_OMX_BASECOMP
     29 #define SEC_OMX_BASECOMP
     30 
     31 #include "SEC_OMX_Def.h"
     32 #include "OMX_Component.h"
     33 #include "SEC_OSAL_Queue.h"
     34 #include "SEC_OMX_Baseport.h"
     35 
     36 
     37 typedef struct _SEC_OMX_MESSAGE
     38 {
     39     OMX_U32 messageType;
     40     OMX_U32 messageParam;
     41     OMX_PTR pCmdData;
     42 } SEC_OMX_MESSAGE;
     43 
     44 typedef struct _SEC_OMX_DATABUFFER
     45 {
     46     OMX_HANDLETYPE        bufferMutex;
     47     OMX_BUFFERHEADERTYPE* bufferHeader;
     48     OMX_BOOL              dataValid;
     49     OMX_U32               allocSize;
     50     OMX_U32               dataLen;
     51     OMX_U32               usedDataLen;
     52     OMX_U32               remainDataLen;
     53     OMX_U32               nFlags;
     54     OMX_TICKS             timeStamp;
     55 } SEC_OMX_DATABUFFER;
     56 
     57 typedef struct _SEC_BUFFER_HEADER{
     58     void *YPhyAddr; // [IN/OUT] physical address of Y
     59     void *CPhyAddr; // [IN/OUT] physical address of CbCr
     60     void *YVirAddr; // [IN/OUT] virtual address of Y
     61     void *CVirAddr; // [IN/OUT] virtual address of CbCr
     62     int YSize;      // [IN/OUT] input size of Y data
     63     int CSize;      // [IN/OUT] input size of CbCr data
     64 } SEC_BUFFER_HEADER;
     65 
     66 typedef struct _SEC_OMX_DATA
     67 {
     68     OMX_BYTE  dataBuffer;
     69     OMX_U32   allocSize;
     70     OMX_U32   dataLen;
     71     OMX_U32   usedDataLen;
     72     OMX_U32   remainDataLen;
     73     OMX_U32   previousDataLen;
     74     OMX_U32   nFlags;
     75     OMX_TICKS timeStamp;
     76     SEC_BUFFER_HEADER specificBufferHeader;
     77 } SEC_OMX_DATA;
     78 
     79 /* for Check TimeStamp after Seek */
     80 typedef struct _SEC_OMX_TIMESTAPM
     81 {
     82     OMX_BOOL  needSetStartTimeStamp;
     83     OMX_BOOL  needCheckStartTimeStamp;
     84     OMX_TICKS startTimeStamp;
     85     OMX_U32   nStartFlags;
     86 } SEC_OMX_TIMESTAMP;
     87 
     88 typedef struct _SEC_OMX_BASECOMPONENT
     89 {
     90     OMX_STRING               componentName;
     91     OMX_VERSIONTYPE          componentVersion;
     92     OMX_VERSIONTYPE          specVersion;
     93 
     94     OMX_STATETYPE            currentState;
     95     SEC_OMX_TRANS_STATETYPE  transientState;
     96 
     97     SEC_CODEC_TYPE           codecType;
     98     SEC_OMX_PRIORITYMGMTTYPE compPriority;
     99     OMX_MARKTYPE             propagateMarkType;
    100     OMX_HANDLETYPE           compMutex;
    101 
    102     OMX_HANDLETYPE           hCodecHandle;
    103 
    104     /* Message Handler */
    105     OMX_BOOL                 bExitMessageHandlerThread;
    106     OMX_HANDLETYPE           hMessageHandler;
    107     OMX_HANDLETYPE           msgSemaphoreHandle;
    108     SEC_QUEUE                messageQ;
    109 
    110     /* Buffer Process */
    111     OMX_BOOL                 bExitBufferProcessThread;
    112     OMX_HANDLETYPE           hBufferProcess;
    113 
    114     /* Buffer */
    115     SEC_OMX_DATABUFFER       secDataBuffer[2];
    116 
    117     /* Data */
    118     SEC_OMX_DATA             processData[2];
    119 
    120     /* Port */
    121     OMX_PORT_PARAM_TYPE      portParam;
    122     SEC_OMX_BASEPORT        *pSECPort;
    123 
    124     OMX_HANDLETYPE           pauseEvent;
    125 
    126     /* Callback function */
    127     OMX_CALLBACKTYPE        *pCallbacks;
    128     OMX_PTR                  callbackData;
    129 
    130     /* Save Timestamp */
    131     OMX_TICKS                timeStamp[MAX_TIMESTAMP];
    132     SEC_OMX_TIMESTAMP        checkTimeStamp;
    133 
    134     /* Save Flags */
    135     OMX_U32                  nFlags[MAX_FLAGS];
    136 
    137     OMX_BOOL                 getAllDelayBuffer;
    138     OMX_BOOL                 remainOutputData;
    139     OMX_BOOL                 reInputData;
    140 
    141     /* Android CapabilityFlags */
    142     OMXComponentCapabilityFlagsType capabilityFlags;
    143 
    144     OMX_BOOL bUseFlagEOF;
    145     OMX_BOOL bSaveFlagEOS;
    146 
    147     OMX_ERRORTYPE (*sec_mfc_componentInit)(OMX_COMPONENTTYPE *pOMXComponent);
    148     OMX_ERRORTYPE (*sec_mfc_componentTerminate)(OMX_COMPONENTTYPE *pOMXComponent);
    149     OMX_ERRORTYPE (*sec_mfc_bufferProcess) (OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData);
    150 
    151     OMX_ERRORTYPE (*sec_AllocateTunnelBuffer)(SEC_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex);
    152     OMX_ERRORTYPE (*sec_FreeTunnelBuffer)(SEC_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex);
    153     OMX_ERRORTYPE (*sec_BufferProcess)(OMX_HANDLETYPE hComponent);
    154     OMX_ERRORTYPE (*sec_BufferReset)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex);
    155     OMX_ERRORTYPE (*sec_InputBufferReturn)(OMX_COMPONENTTYPE *pOMXComponent);
    156     OMX_ERRORTYPE (*sec_OutputBufferReturn)(OMX_COMPONENTTYPE *pOMXComponent);
    157 
    158     int (*sec_checkInputFrame)(unsigned char *pInputStream, int buffSize, OMX_U32 flag, OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame);
    159 
    160 } SEC_OMX_BASECOMPONENT;
    161 
    162 
    163 #ifdef __cplusplus
    164 extern "C" {
    165 #endif
    166 
    167     OMX_ERRORTYPE SEC_OMX_Check_SizeVersion(OMX_PTR header, OMX_U32 size);
    168 
    169 
    170 #ifdef __cplusplus
    171 };
    172 #endif
    173 
    174 #endif
    175