1/*
2 *
3 * Copyright 2012 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       Exynos_OMX_Basecomponent.h
20 * @brief
21 * @author     SeungBeom Kim (sbcrux.kim@samsung.com)
22 *             Yunji Kim (yunji.kim@samsung.com)
23 * @version    2.0.0
24 * @history
25 *    2012.02.20 : Create
26 */
27
28#ifndef EXYNOS_OMX_BASECOMP
29#define EXYNOS_OMX_BASECOMP
30
31#include "Exynos_OMX_Def.h"
32#include "OMX_Component.h"
33#include "Exynos_OSAL_Queue.h"
34#include "Exynos_OMX_Baseport.h"
35
36
37typedef struct _EXYNOS_OMX_MESSAGE
38{
39    OMX_U32 messageType;
40    OMX_U32 messageParam;
41    OMX_PTR pCmdData;
42} EXYNOS_OMX_MESSAGE;
43
44/* for Check TimeStamp after Seek */
45typedef struct _EXYNOS_OMX_TIMESTAMP
46{
47    OMX_BOOL  needSetStartTimeStamp;
48    OMX_BOOL  needCheckStartTimeStamp;
49    OMX_TICKS startTimeStamp;
50    OMX_U32   nStartFlags;
51} EXYNOS_OMX_TIMESTAMP;
52
53typedef struct _EXYNOS_OMX_BASECOMPONENT
54{
55    OMX_STRING                  componentName;
56    OMX_VERSIONTYPE             componentVersion;
57    OMX_VERSIONTYPE             specVersion;
58
59    OMX_STATETYPE               currentState;
60    EXYNOS_OMX_TRANS_STATETYPE  transientState;
61    OMX_BOOL                    abendState;
62    OMX_HANDLETYPE              abendStateEvent;
63
64    EXYNOS_CODEC_TYPE           codecType;
65    EXYNOS_OMX_PRIORITYMGMTTYPE compPriority;
66    OMX_MARKTYPE                propagateMarkType;
67    OMX_HANDLETYPE              compMutex;
68
69    OMX_HANDLETYPE              hComponentHandle;
70
71    /* Message Handler */
72    OMX_BOOL                    bExitMessageHandlerThread;
73    OMX_HANDLETYPE              hMessageHandler;
74    OMX_HANDLETYPE              msgSemaphoreHandle;
75    EXYNOS_QUEUE                messageQ;
76
77    /* Port */
78    OMX_PORT_PARAM_TYPE         portParam;
79    EXYNOS_OMX_BASEPORT        *pExynosPort;
80
81    OMX_HANDLETYPE              pauseEvent;
82
83    /* Callback function */
84    OMX_CALLBACKTYPE           *pCallbacks;
85    OMX_PTR                     callbackData;
86
87    /* Save Timestamp */
88    OMX_TICKS                   timeStamp[MAX_TIMESTAMP];
89    EXYNOS_OMX_TIMESTAMP        checkTimeStamp;
90
91    /* Save Flags */
92    OMX_U32                     nFlags[MAX_FLAGS];
93
94    OMX_BOOL                    getAllDelayBuffer;
95    OMX_BOOL                    reInputData;
96
97    OMX_BOOL bUseFlagEOF;
98    OMX_BOOL bSaveFlagEOS;    //bSaveFlagEOS is OMX_TRUE, if EOS flag is incoming.
99    OMX_BOOL bBehaviorEOS;    //bBehaviorEOS is OMX_TRUE, if EOS flag with Data are incoming.
100
101    /* Check for Old & New OMX Process type switch */
102    OMX_BOOL bMultiThreadProcess;
103
104    OMX_ERRORTYPE (*exynos_codec_componentInit)(OMX_COMPONENTTYPE *pOMXComponent);
105    OMX_ERRORTYPE (*exynos_codec_componentTerminate)(OMX_COMPONENTTYPE *pOMXComponent);
106
107    OMX_ERRORTYPE (*exynos_AllocateTunnelBuffer)(EXYNOS_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex);
108    OMX_ERRORTYPE (*exynos_FreeTunnelBuffer)(EXYNOS_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex);
109    OMX_ERRORTYPE (*exynos_BufferProcessCreate)(OMX_COMPONENTTYPE *pOMXComponent);
110    OMX_ERRORTYPE (*exynos_BufferProcessTerminate)(OMX_COMPONENTTYPE *pOMXComponent);
111    OMX_ERRORTYPE (*exynos_BufferFlush)(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex, OMX_BOOL bEvent);
112} EXYNOS_OMX_BASECOMPONENT;
113
114OMX_ERRORTYPE Exynos_OMX_GetParameter(
115    OMX_IN OMX_HANDLETYPE hComponent,
116    OMX_IN OMX_INDEXTYPE  nParamIndex,
117    OMX_INOUT OMX_PTR     ComponentParameterStructure);
118
119OMX_ERRORTYPE Exynos_OMX_SetParameter(
120    OMX_IN OMX_HANDLETYPE hComponent,
121    OMX_IN OMX_INDEXTYPE  nIndex,
122    OMX_IN OMX_PTR        ComponentParameterStructure);
123
124OMX_ERRORTYPE Exynos_OMX_GetConfig(
125    OMX_IN OMX_HANDLETYPE hComponent,
126    OMX_IN OMX_INDEXTYPE  nIndex,
127    OMX_INOUT OMX_PTR     pComponentConfigStructure);
128
129OMX_ERRORTYPE Exynos_OMX_SetConfig(
130    OMX_IN OMX_HANDLETYPE hComponent,
131    OMX_IN OMX_INDEXTYPE  nIndex,
132    OMX_IN OMX_PTR        pComponentConfigStructure);
133
134OMX_ERRORTYPE Exynos_OMX_GetExtensionIndex(
135    OMX_IN OMX_HANDLETYPE  hComponent,
136    OMX_IN OMX_STRING      cParameterName,
137    OMX_OUT OMX_INDEXTYPE *pIndexType);
138
139OMX_ERRORTYPE Exynos_OMX_BaseComponent_Constructor(OMX_IN OMX_HANDLETYPE hComponent);
140OMX_ERRORTYPE Exynos_OMX_BaseComponent_Destructor(OMX_IN OMX_HANDLETYPE hComponent);
141
142#ifdef __cplusplus
143extern "C" {
144#endif
145
146    OMX_ERRORTYPE Exynos_OMX_Check_SizeVersion(OMX_PTR header, OMX_U32 size);
147
148
149#ifdef __cplusplus
150};
151#endif
152
153#endif
154