153 const_cast<OMX_PTR>(apComponentParameterStructure), |
153 const_cast<OMX_PTR>(apComponentParameterStructure), |
154 sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE)))) |
154 sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE)))) |
155 { |
155 { |
156 return omxRetValue; |
156 return omxRetValue; |
157 } |
157 } |
158 |
158 |
159 const OMX_VIDEO_PARAM_PORTFORMATTYPE *componentParameterStructure = static_cast<const OMX_VIDEO_PARAM_PORTFORMATTYPE*>(apComponentParameterStructure); |
159 const OMX_VIDEO_PARAM_PORTFORMATTYPE *componentParameterStructure = static_cast<const OMX_VIDEO_PARAM_PORTFORMATTYPE*>(apComponentParameterStructure); |
160 |
160 |
161 if(OMX_VIDEO_CodingUnused == componentParameterStructure->eCompressionFormat) |
161 if (!UpdateColorFormat(iParamVideoPortFormat.eColorFormat, componentParameterStructure->eColorFormat, aUpdateProcessingFunction)) |
162 { |
162 { |
163 if(OMX_COLOR_FormatUnused == componentParameterStructure->eColorFormat) |
163 return OMX_ErrorUnsupportedSetting; |
164 { |
164 } |
165 // Both Compression Format and Color can not be Unused at the same time. |
165 |
166 return OMX_ErrorBadParameter; |
166 if (!UpdateCodingType(iParamVideoPortFormat.eCompressionFormat, componentParameterStructure->eCompressionFormat, aUpdateProcessingFunction)) |
167 } |
167 { |
168 |
168 return OMX_ErrorUnsupportedSetting; |
169 if(iParamVideoPortFormat.eColorFormat != componentParameterStructure->eColorFormat) |
169 } |
170 { |
170 |
171 if(KErrNotFound == iSupportedColorFormats.Find(componentParameterStructure->eColorFormat)) |
171 if(iParamVideoPortFormat.eCompressionFormat == OMX_VIDEO_CodingUnused) |
172 { |
172 { |
173 return OMX_ErrorUnsupportedSetting; |
|
174 } |
|
175 else |
|
176 { |
|
177 iParamVideoPortFormat.eColorFormat = componentParameterStructure->eColorFormat; |
|
178 } |
|
179 aUpdateProcessingFunction = ETrue; |
|
180 } |
|
181 |
|
182 if(iParamVideoPortFormat.xFramerate != componentParameterStructure->xFramerate) |
173 if(iParamVideoPortFormat.xFramerate != componentParameterStructure->xFramerate) |
183 { |
174 { |
184 iParamVideoPortFormat.xFramerate = componentParameterStructure->xFramerate; |
175 iParamVideoPortFormat.xFramerate = componentParameterStructure->xFramerate; |
185 aUpdateProcessingFunction = ETrue; |
176 aUpdateProcessingFunction = ETrue; |
186 } |
177 } |
187 } |
178 } |
188 else |
|
189 { |
|
190 // Data is compressed. Change relevant variables. |
|
191 if (OMX_COLOR_FormatUnused != componentParameterStructure->eColorFormat) |
|
192 { |
|
193 // Both Compression Format and Color can not be Unused at the same time. |
|
194 return OMX_ErrorBadParameter; |
|
195 } |
|
196 |
|
197 if (iParamVideoPortFormat.eCompressionFormat != componentParameterStructure->eCompressionFormat) |
|
198 { |
|
199 if(KErrNotFound == iSupportedVideoFormats.Find(componentParameterStructure->eCompressionFormat)) |
|
200 { |
|
201 return OMX_ErrorUnsupportedSetting; |
|
202 } |
|
203 else |
|
204 { |
|
205 iParamVideoPortFormat.eCompressionFormat = componentParameterStructure->eCompressionFormat; |
|
206 aUpdateProcessingFunction = ETrue; |
|
207 } |
|
208 } |
|
209 } |
|
210 break; |
179 break; |
211 } |
180 } |
212 default: |
181 default: |
213 { |
182 { |
214 // Try the parent's indexes |
183 // Try the parent's indexes |
215 return COmxILPort::SetParameter(aParamIndex, apComponentParameterStructure, aUpdateProcessingFunction); |
184 return COmxILPort::SetParameter(aParamIndex, apComponentParameterStructure, aUpdateProcessingFunction); |
216 } |
185 } |
217 }; |
186 }; |
218 return OMX_ErrorNone; |
187 return OMX_ErrorNone; |
219 } |
188 } |
|
189 |
|
190 EXPORT_C TBool COmxILVideoPort::UpdateColorFormat(OMX_COLOR_FORMATTYPE& aOldColor, OMX_COLOR_FORMATTYPE aNewColor, TBool& aUpdated) |
|
191 { |
|
192 if (aNewColor != aOldColor) |
|
193 { |
|
194 if(iSupportedColorFormats.Find(aNewColor) == KErrNotFound) |
|
195 { |
|
196 return EFalse; |
|
197 } |
|
198 aOldColor = aNewColor; |
|
199 aUpdated = ETrue; |
|
200 } |
|
201 |
|
202 return ETrue; |
|
203 } |
|
204 |
|
205 EXPORT_C TBool COmxILVideoPort::UpdateCodingType(OMX_VIDEO_CODINGTYPE& aOldCodingType, OMX_VIDEO_CODINGTYPE aNewCodingType, TBool& aUpdated) |
|
206 { |
|
207 if (aNewCodingType != aOldCodingType) |
|
208 { |
|
209 if(iSupportedVideoFormats.Find(aNewCodingType) == KErrNotFound) |
|
210 { |
|
211 return EFalse; |
|
212 } |
|
213 aOldCodingType = aNewCodingType; |
|
214 aUpdated = ETrue; |
|
215 } |
|
216 |
|
217 return ETrue; |
|
218 } |