|
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 "omxilotherport.h" |
|
23 #include "omxilutil.h" |
|
24 |
|
25 EXPORT_C COmxILOtherPort::COmxILOtherPort(const TOmxILCommonPortData& aCommonPortData) |
|
26 : COmxILPort(aCommonPortData) |
|
27 { |
|
28 iParamOtherPortFormat.nSize = sizeof(OMX_OTHER_PARAM_PORTFORMATTYPE); |
|
29 iParamOtherPortFormat.nVersion = aCommonPortData.iOmxVersion; |
|
30 iParamOtherPortFormat.nPortIndex = aCommonPortData.iPortIndex; |
|
31 iParamOtherPortFormat.nIndex = 0; |
|
32 } |
|
33 |
|
34 // [YYC]: proposal for deep copy, virtual & called from derived CostructL |
|
35 EXPORT_C void COmxILOtherPort::ConstructL(const RArray<OMX_OTHER_FORMATTYPE>& aSupportedOtherFormats) |
|
36 { |
|
37 TUint count = aSupportedOtherFormats.Count(); |
|
38 for (TInt i = 0; i < count; i++) |
|
39 { |
|
40 iSupportedOtherFormats.AppendL(aSupportedOtherFormats[i]); |
|
41 } |
|
42 iParamOtherPortFormat.eFormat = count ? iSupportedOtherFormats[0] : OMX_OTHER_FormatMax; |
|
43 } |
|
44 |
|
45 EXPORT_C COmxILOtherPort::~COmxILOtherPort() |
|
46 { |
|
47 iSupportedOtherFormats.Close(); |
|
48 } |
|
49 |
|
50 EXPORT_C OMX_ERRORTYPE COmxILOtherPort::GetLocalOmxParamIndexes(RArray<TUint>& aIndexArray) const |
|
51 { |
|
52 // Always collect local indexes from parent |
|
53 OMX_ERRORTYPE omxRetValue = COmxILPort::GetLocalOmxParamIndexes(aIndexArray); |
|
54 if (omxRetValue != OMX_ErrorNone) |
|
55 { |
|
56 return omxRetValue; |
|
57 } |
|
58 |
|
59 TInt err = aIndexArray.InsertInOrder(OMX_IndexParamOtherPortFormat); |
|
60 // Note that index duplication is OK |
|
61 if (err != KErrNone && err != KErrAlreadyExists) |
|
62 { |
|
63 return OMX_ErrorInsufficientResources; |
|
64 } |
|
65 |
|
66 return OMX_ErrorNone; |
|
67 } |
|
68 |
|
69 EXPORT_C OMX_ERRORTYPE COmxILOtherPort::GetLocalOmxConfigIndexes(RArray<TUint>& aIndexArray) const |
|
70 { |
|
71 // Always collect local indexes from parent |
|
72 return COmxILPort::GetLocalOmxConfigIndexes(aIndexArray); |
|
73 } |
|
74 |
|
75 EXPORT_C OMX_ERRORTYPE COmxILOtherPort::GetParameter(OMX_INDEXTYPE aParamIndex, |
|
76 TAny* apComponentParameterStructure) const |
|
77 { |
|
78 switch(aParamIndex) |
|
79 { |
|
80 case OMX_IndexParamOtherPortFormat: |
|
81 { |
|
82 OMX_ERRORTYPE omxRetValue = TOmxILUtil::CheckOmxStructSizeAndVersion(apComponentParameterStructure, |
|
83 sizeof(OMX_OTHER_PARAM_PORTFORMATTYPE)); |
|
84 |
|
85 if (omxRetValue != OMX_ErrorNone) |
|
86 { |
|
87 return omxRetValue; |
|
88 } |
|
89 |
|
90 OMX_OTHER_PARAM_PORTFORMATTYPE* pParamOtherPortFormat = |
|
91 static_cast<OMX_OTHER_PARAM_PORTFORMATTYPE*>(apComponentParameterStructure); |
|
92 |
|
93 if (pParamOtherPortFormat->nIndex >= iSupportedOtherFormats.Count()) |
|
94 { |
|
95 return OMX_ErrorNoMore; |
|
96 } |
|
97 |
|
98 pParamOtherPortFormat->eFormat = iSupportedOtherFormats[pParamOtherPortFormat->nIndex]; |
|
99 } |
|
100 break; |
|
101 default: |
|
102 { |
|
103 // Try the parent's indexes |
|
104 return COmxILPort::GetParameter(aParamIndex, apComponentParameterStructure); |
|
105 } |
|
106 }; |
|
107 |
|
108 return OMX_ErrorNone; |
|
109 } |
|
110 |
|
111 EXPORT_C OMX_ERRORTYPE COmxILOtherPort::SetParameter(OMX_INDEXTYPE aParamIndex, |
|
112 const TAny* apComponentParameterStructure, |
|
113 TBool& aUpdateProcessingFunction) |
|
114 { |
|
115 aUpdateProcessingFunction = EFalse; |
|
116 |
|
117 switch(aParamIndex) |
|
118 { |
|
119 case OMX_IndexParamOtherPortFormat: |
|
120 { |
|
121 OMX_ERRORTYPE omxRetValue = TOmxILUtil::CheckOmxStructSizeAndVersion(const_cast<OMX_PTR>(apComponentParameterStructure), |
|
122 sizeof(OMX_OTHER_PARAM_PORTFORMATTYPE)); |
|
123 |
|
124 if (omxRetValue != OMX_ErrorNone) |
|
125 { |
|
126 return omxRetValue; |
|
127 } |
|
128 |
|
129 const OMX_OTHER_PARAM_PORTFORMATTYPE* pParamOtherPortFormat = |
|
130 static_cast<const OMX_OTHER_PARAM_PORTFORMATTYPE*>(apComponentParameterStructure); |
|
131 |
|
132 // Check in case the specified format is not actually supported by this |
|
133 // port |
|
134 OMX_OTHER_FORMATTYPE newFormatType = pParamOtherPortFormat->eFormat; |
|
135 |
|
136 // OMX_OTHER_FormatVendorReserved is the last of the supported values as of |
|
137 // v1.1.1 |
|
138 if (newFormatType > OMX_OTHER_FormatVendorReserved) |
|
139 { |
|
140 return OMX_ErrorBadParameter; |
|
141 } |
|
142 |
|
143 if (KErrNotFound == iSupportedOtherFormats.Find(newFormatType)) |
|
144 { |
|
145 return OMX_ErrorUnsupportedSetting; |
|
146 } |
|
147 |
|
148 // Set the new default format, but check first that we are actually |
|
149 // changing something... |
|
150 if (iParamOtherPortFormat.eFormat != newFormatType) |
|
151 { |
|
152 iParamOtherPortFormat.eFormat = newFormatType; |
|
153 |
|
154 // This is an indication to the PortManager that the processing |
|
155 // function needs to get updated |
|
156 // |
|
157 aUpdateProcessingFunction = ETrue; |
|
158 } |
|
159 } |
|
160 break; |
|
161 default: |
|
162 { |
|
163 // Try the parent's indexes |
|
164 return COmxILPort::SetParameter(aParamIndex, |
|
165 apComponentParameterStructure, |
|
166 aUpdateProcessingFunction); |
|
167 } |
|
168 }; |
|
169 |
|
170 return OMX_ErrorNone; |
|
171 } |