• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * Copyright 2013 Rockchip Electronics 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       Rockchip_OMX_Basecomponent.h
20  * @brief
21  * @author     csy (csy@rock-chips.com)
22  * @version    1.0.0
23  * @history
24  *    2013.11.26 : Create
25  */
26 
27 #ifndef ROCKCHIP_OMX_BASECOMP
28 #define ROCKCHIP_OMX_BASECOMP
29 
30 #include "Rockchip_OMX_Def.h"
31 #include "OMX_Component.h"
32 #include "Rockchip_OSAL_Queue.h"
33 #include "Rockchip_OMX_Baseport.h"
34 
35 typedef struct _ROCKCHIP_OMX_MESSAGE {
36     OMX_U32 messageType;
37     OMX_U32 messageParam;
38     OMX_PTR pCmdData;
39 } ROCKCHIP_OMX_MESSAGE;
40 
41 /* for Check TimeStamp after Seek */
42 typedef struct _ROCKCHIP_OMX_TIMESTAMP {
43     OMX_BOOL  needSetStartTimeStamp;
44     OMX_BOOL  needCheckStartTimeStamp;
45     OMX_TICKS startTimeStamp;
46     OMX_U32   nStartFlags;
47 } ROCKCHIP_OMX_TIMESTAMP;
48 
49 typedef enum _ROCKCHIP_ON2_FLAGS_MAP {
50     RK_VPU_NEED_FLUSH_ON_SEEK      = 0x01,
51 } ROCKCHIP_ON2_FLAGS_MAP;
52 
53 typedef struct _ROCKCHIP_OMX_BASECOMPONENT {
54     OMX_STRING                      componentName;
55     OMX_STRING                      rkversion;
56     OMX_VERSIONTYPE                 componentVersion;
57     OMX_VERSIONTYPE                 specVersion;
58 
59     OMX_STATETYPE                   currentState;
60     ROCKCHIP_OMX_TRANS_STATETYPE    transientState;
61     OMX_BOOL                        abendState;
62     OMX_HANDLETYPE                  abendStateEvent;
63 
64     ROCKCHIP_CODEC_TYPE             codecType;
65 
66     ROCKCHIP_OMX_PRIORITYMGMTTYPE   compPriority;
67     OMX_MARKTYPE                    propagateMarkType;
68     OMX_HANDLETYPE                  compMutex;
69 
70     OMX_HANDLETYPE                  hComponentHandle;
71 
72     /* Message Handler */
73     OMX_BOOL                        bExitMessageHandlerThread;
74     OMX_HANDLETYPE                  hMessageHandler;
75     OMX_HANDLETYPE                  msgSemaphoreHandle;
76     ROCKCHIP_QUEUE                  messageQ;
77 
78     /* Port */
79     OMX_PORT_PARAM_TYPE             portParam;
80     ROCKCHIP_OMX_BASEPORT           *pRockchipPort;
81 
82     OMX_HANDLETYPE                  pauseEvent;
83 
84     /* Callback function */
85     OMX_CALLBACKTYPE                *pCallbacks;
86     OMX_PTR                         callbackData;
87 
88     /* Save Timestamp */
89     OMX_TICKS                       timeStamp[MAX_TIMESTAMP];
90     ROCKCHIP_OMX_TIMESTAMP          checkTimeStamp;
91 
92     /* Save Flags */
93     OMX_U32                         nFlags[MAX_FLAGS];
94 
95     OMX_BOOL                        getAllDelayBuffer;
96     OMX_BOOL                        reInputData;
97 
98     OMX_BOOL                        bUseFlagEOF;
99     OMX_BOOL                        bSaveFlagEOS;    // bSaveFlagEOS is OMX_TRUE, if EOS flag is incoming.
100     OMX_BOOL                        bBehaviorEOS;    // bBehaviorEOS is OMX_TRUE, if EOS flag with Data are incoming.
101     OMX_U32                         nRkFlags;       // used to set extension flag for control vpu.
102     /* Check for Old & New OMX Process type switch */
103     OMX_BOOL bMultiThreadProcess;
104 
105     OMX_ERRORTYPE (*rockchip_codec_componentInit)(OMX_COMPONENTTYPE *pOMXComponent);
106     OMX_ERRORTYPE (*rockchip_codec_componentTerminate)(OMX_COMPONENTTYPE *pOMXComponent);
107 
108     OMX_ERRORTYPE (*rockchip_AllocateTunnelBuffer)(ROCKCHIP_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex);
109     OMX_ERRORTYPE (*rockchip_FreeTunnelBuffer)(ROCKCHIP_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex);
110     OMX_ERRORTYPE (*rockchip_BufferProcessCreate)(OMX_COMPONENTTYPE *pOMXComponent);
111     OMX_ERRORTYPE (*rockchip_BufferProcessTerminate)(OMX_COMPONENTTYPE *pOMXComponent);
112     OMX_ERRORTYPE (*rockchip_BufferFlush)(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex, OMX_BOOL bEvent);
113 } ROCKCHIP_OMX_BASECOMPONENT;
114 
115 OMX_ERRORTYPE Rockchip_OMX_GetParameter(
116     OMX_IN OMX_HANDLETYPE hComponent,
117     OMX_IN OMX_INDEXTYPE  nParamIndex,
118     OMX_INOUT OMX_PTR     ComponentParameterStructure);
119 
120 OMX_ERRORTYPE Rockchip_OMX_SetParameter(
121     OMX_IN OMX_HANDLETYPE hComponent,
122     OMX_IN OMX_INDEXTYPE  nIndex,
123     OMX_IN OMX_PTR        ComponentParameterStructure);
124 
125 OMX_ERRORTYPE Rockchip_OMX_GetConfig(
126     OMX_IN OMX_HANDLETYPE hComponent,
127     OMX_IN OMX_INDEXTYPE  nIndex,
128     OMX_INOUT OMX_PTR     pComponentConfigStructure);
129 
130 OMX_ERRORTYPE Rockchip_OMX_SetConfig(
131     OMX_IN OMX_HANDLETYPE hComponent,
132     OMX_IN OMX_INDEXTYPE  nIndex,
133     OMX_IN OMX_PTR        pComponentConfigStructure);
134 
135 OMX_ERRORTYPE Rockchip_OMX_GetExtensionIndex(
136     OMX_IN OMX_HANDLETYPE  hComponent,
137     OMX_IN OMX_STRING      cParameterName,
138     OMX_OUT OMX_INDEXTYPE *pIndexType);
139 
140 OMX_ERRORTYPE Rockchip_OMX_BaseComponent_Constructor(OMX_IN OMX_HANDLETYPE hComponent);
141 OMX_ERRORTYPE Rockchip_OMX_BaseComponent_Destructor(OMX_IN OMX_HANDLETYPE hComponent);
142 
143 #ifdef __cplusplus
144 extern "C" {
145 #endif
146 
147 OMX_ERRORTYPE Rockchip_OMX_Check_SizeVersion(OMX_PTR header, OMX_U32 size);
148 
149 #ifdef __cplusplus
150 };
151 #endif
152 #endif