|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 /** |
|
18 @file |
|
19 @internalComponent |
|
20 */ |
|
21 |
|
22 #include <openmax/il/common/omxilclientclockport.h> |
|
23 #include "log.h" |
|
24 |
|
25 |
|
26 EXPORT_C COmxILClientClockPort* COmxILClientClockPort::NewL(const TOmxILCommonPortData& aCommonPortData, |
|
27 const RArray<OMX_OTHER_FORMATTYPE>& aSupportedOtherFormats) |
|
28 { |
|
29 COmxILClientClockPort* self = new(ELeave) COmxILClientClockPort(); |
|
30 CleanupStack::PushL(self); |
|
31 self->ConstructL(aCommonPortData, aSupportedOtherFormats); |
|
32 CleanupStack::Pop(); |
|
33 return self; |
|
34 } |
|
35 |
|
36 void COmxILClientClockPort::ConstructL(const TOmxILCommonPortData& aCommonPortData, const RArray<OMX_OTHER_FORMATTYPE>& aSupportedOtherFormats) |
|
37 { |
|
38 COmxILOtherPort::ConstructL(aCommonPortData, aSupportedOtherFormats); |
|
39 } |
|
40 |
|
41 COmxILClientClockPort::COmxILClientClockPort() |
|
42 : iSpecVersion(TOmxILSpecVersion()) |
|
43 { |
|
44 DEBUG_PRINTF(_L8("COmxILClientClockPort::COmxILClientClockPort")); |
|
45 } |
|
46 |
|
47 OMX_ERRORTYPE COmxILClientClockPort::GetLocalOmxParamIndexes(RArray<TUint>& aIndexArray) const |
|
48 { |
|
49 DEBUG_PRINTF(_L8("COmxILClientClockPort::GetLocalOmxParamIndexes")); |
|
50 return COmxILOtherPort::GetLocalOmxParamIndexes(aIndexArray); |
|
51 } |
|
52 |
|
53 |
|
54 OMX_ERRORTYPE COmxILClientClockPort::GetLocalOmxConfigIndexes(RArray<TUint>& aIndexArray) const |
|
55 { |
|
56 DEBUG_PRINTF(_L8("COmxILClientClockPort::GetLocalOmxParamIndexes")); |
|
57 return COmxILOtherPort::GetLocalOmxConfigIndexes(aIndexArray); |
|
58 } |
|
59 |
|
60 |
|
61 OMX_ERRORTYPE COmxILClientClockPort::GetParameter(OMX_INDEXTYPE aParamIndex, |
|
62 TAny* apComponentParameterStructure) const |
|
63 { |
|
64 DEBUG_PRINTF(_L8("COmxILClientClockPort::GetParameter")); |
|
65 return COmxILOtherPort::GetParameter(aParamIndex, apComponentParameterStructure); |
|
66 } |
|
67 |
|
68 |
|
69 OMX_ERRORTYPE COmxILClientClockPort::SetParameter(OMX_INDEXTYPE aParamIndex, |
|
70 const TAny* apComponentParameterStructure, |
|
71 TBool& aUpdateProcessingFunction) |
|
72 { |
|
73 DEBUG_PRINTF(_L8("COmxILClientClockPort::SetParameter")); |
|
74 return COmxILOtherPort::SetParameter(aParamIndex, apComponentParameterStructure, aUpdateProcessingFunction); |
|
75 } |
|
76 |
|
77 |
|
78 OMX_ERRORTYPE COmxILClientClockPort::SetFormatInPortDefinition(const OMX_PARAM_PORTDEFINITIONTYPE& /*aPortDefinition*/, |
|
79 TBool& /*aUpdateProcessingFunction*/) |
|
80 { |
|
81 DEBUG_PRINTF(_L8("COmxILClientClockPort::SetFormatInPortDefinition")); |
|
82 return OMX_ErrorNone; |
|
83 } |
|
84 |
|
85 |
|
86 TBool COmxILClientClockPort::IsTunnelledPortCompatible(const OMX_PARAM_PORTDEFINITIONTYPE& aPortDefinition) const |
|
87 { |
|
88 DEBUG_PRINTF(_L8("COmxILClientClockPort::IsTunnelledPortCompatible")); |
|
89 // Domain check |
|
90 if(aPortDefinition.eDomain != GetParamPortDefinition().eDomain) |
|
91 { |
|
92 return EFalse; |
|
93 } |
|
94 |
|
95 // Format check |
|
96 if (aPortDefinition.format.other.eFormat != GetParamPortDefinition().format.other.eFormat) |
|
97 { |
|
98 return EFalse; |
|
99 } |
|
100 |
|
101 return ETrue; |
|
102 } |
|
103 |
|
104 |
|
105 OMX_ERRORTYPE COmxILClientClockPort::GetMediaTime(OMX_TICKS& aMediaTime) const |
|
106 { |
|
107 DEBUG_PRINTF(_L8("COmxILClientClockPort::GetMediaTime")); |
|
108 return GetTime(aMediaTime, OMX_IndexConfigTimeCurrentMediaTime); |
|
109 } |
|
110 |
|
111 |
|
112 OMX_ERRORTYPE COmxILClientClockPort::GetWallTime(OMX_TICKS& aWallTime) const |
|
113 { |
|
114 DEBUG_PRINTF(_L8("COmxILClientClockPort::GetWallTime")); |
|
115 return GetTime(aWallTime, OMX_IndexConfigTimeCurrentWallTime); |
|
116 } |
|
117 |
|
118 |
|
119 OMX_ERRORTYPE COmxILClientClockPort::GetClockState(OMX_TIME_CONFIG_CLOCKSTATETYPE& aClockState) const |
|
120 { |
|
121 DEBUG_PRINTF(_L8("COmxILClientClockPort::GetClockState")); |
|
122 |
|
123 if (IsClockComponentAvailable()) |
|
124 { |
|
125 aClockState.nSize = sizeof(OMX_TIME_CONFIG_CLOCKSTATETYPE); |
|
126 aClockState.nVersion = iSpecVersion; |
|
127 aClockState.eState = OMX_TIME_ClockStateMax; |
|
128 aClockState.nStartTime = 0; |
|
129 aClockState.nOffset = 0; |
|
130 aClockState.nWaitMask = 0; |
|
131 return OMX_GetConfig(GetTunnelledComponent(), OMX_IndexConfigTimeClockState, &aClockState); |
|
132 } |
|
133 |
|
134 return OMX_ErrorIncorrectStateOperation; |
|
135 |
|
136 } |
|
137 |
|
138 OMX_ERRORTYPE COmxILClientClockPort::MediaTimeRequest(const OMX_PTR apPrivate, |
|
139 const OMX_TICKS aMediaTime, |
|
140 const OMX_TICKS aOffset) const |
|
141 { |
|
142 DEBUG_PRINTF(_L8("COmxILClientClockPort::MediaTimeRequest")); |
|
143 OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE timeInfo; |
|
144 timeInfo.nSize = sizeof(timeInfo); |
|
145 timeInfo.nVersion = iSpecVersion; |
|
146 timeInfo.nPortIndex = GetTunnelledPort(); |
|
147 timeInfo.pClientPrivate = apPrivate; |
|
148 timeInfo.nMediaTimestamp = aMediaTime; |
|
149 timeInfo.nOffset = aOffset; |
|
150 |
|
151 if (IsClockComponentAvailable()) |
|
152 { |
|
153 return OMX_SetConfig(GetTunnelledComponent(), OMX_IndexConfigTimeMediaTimeRequest, &timeInfo); |
|
154 } |
|
155 |
|
156 return OMX_ErrorIncorrectStateOperation; |
|
157 } |
|
158 |
|
159 |
|
160 OMX_ERRORTYPE COmxILClientClockPort::SetStartTime(const OMX_TICKS aStartTime) const |
|
161 { |
|
162 DEBUG_PRINTF(_L8("COmxILClientClockPort::SetStartTime")); |
|
163 return SetTime(aStartTime, OMX_IndexConfigTimeClientStartTime); |
|
164 } |
|
165 |
|
166 |
|
167 OMX_ERRORTYPE COmxILClientClockPort::SetVideoReference(const OMX_TICKS aVideoRef) const |
|
168 { |
|
169 DEBUG_PRINTF(_L8("COmxILClientClockPort::SetVideoReference")); |
|
170 return SetTime(aVideoRef, OMX_IndexConfigTimeCurrentVideoReference); |
|
171 } |
|
172 |
|
173 |
|
174 OMX_ERRORTYPE COmxILClientClockPort::SetAudioReference(const OMX_TICKS aAudioRef) const |
|
175 { |
|
176 DEBUG_PRINTF(_L8("COmxILClientClockPort::SetAudioReference")); |
|
177 return SetTime(aAudioRef, OMX_IndexConfigTimeCurrentAudioReference); |
|
178 } |
|
179 |
|
180 OMX_BOOL COmxILClientClockPort::IsClockComponentAvailable() const |
|
181 { |
|
182 if (GetTunnelledComponent() != NULL && GetParamPortDefinition().bEnabled) |
|
183 { |
|
184 return OMX_TRUE; |
|
185 } |
|
186 |
|
187 return OMX_FALSE; |
|
188 } |
|
189 |
|
190 OMX_ERRORTYPE COmxILClientClockPort::GetTime(OMX_TICKS& aWallTime, const OMX_INDEXTYPE aTimeIndex) const |
|
191 { |
|
192 DEBUG_PRINTF(_L8("COmxILClientClockPort::GetTime")); |
|
193 OMX_TIME_CONFIG_TIMESTAMPTYPE timeInfo; |
|
194 timeInfo.nSize = sizeof(timeInfo); |
|
195 timeInfo.nVersion = iSpecVersion; |
|
196 timeInfo.nPortIndex = GetTunnelledPort(); |
|
197 |
|
198 if (!IsClockComponentAvailable()) |
|
199 { |
|
200 return OMX_ErrorIncorrectStateOperation; |
|
201 } |
|
202 |
|
203 OMX_ERRORTYPE error = OMX_GetConfig(GetTunnelledComponent(), aTimeIndex, &timeInfo); |
|
204 |
|
205 if (error == OMX_ErrorNone) |
|
206 { |
|
207 aWallTime = timeInfo.nTimestamp; |
|
208 } |
|
209 |
|
210 return error; |
|
211 } |
|
212 |
|
213 |
|
214 OMX_ERRORTYPE COmxILClientClockPort::SetTime(const OMX_TICKS aStartTime, const OMX_INDEXTYPE aTimeIndex) const |
|
215 { |
|
216 DEBUG_PRINTF(_L8("COmxILClientClockPort::SetTime")); |
|
217 OMX_TIME_CONFIG_TIMESTAMPTYPE timeInfo; |
|
218 timeInfo.nSize = sizeof(timeInfo); |
|
219 timeInfo.nVersion = iSpecVersion; |
|
220 timeInfo.nPortIndex = GetTunnelledPort(); |
|
221 timeInfo.nTimestamp = aStartTime; |
|
222 |
|
223 if (IsClockComponentAvailable()) |
|
224 { |
|
225 return OMX_SetConfig(GetTunnelledComponent(), aTimeIndex, &timeInfo); |
|
226 } |
|
227 |
|
228 return OMX_ErrorIncorrectStateOperation; |
|
229 } |