|
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 inline OMX_ERRORTYPE |
|
23 COmxILPortManager::GetPortIndexFromOmxStruct( |
|
24 TAny*& apComponentParameterStructure, |
|
25 OMX_U32& aIndex) const |
|
26 { |
|
27 return GetPortIndexFromOmxStruct( |
|
28 const_cast<const TAny*&>(apComponentParameterStructure), aIndex); |
|
29 } |
|
30 |
|
31 |
|
32 inline OMX_ERRORTYPE |
|
33 COmxILPortManager::GetPortIndexFromOmxStruct( |
|
34 const TAny*& apComponentParameterStructure, |
|
35 OMX_U32& aIndex) const |
|
36 { |
|
37 OMX_U32* const pPortIndex = |
|
38 reinterpret_cast<OMX_U32*>( |
|
39 const_cast<TAny*&>(apComponentParameterStructure)) + |
|
40 sizeof(OMX_U32) / sizeof(OMX_U32) + |
|
41 sizeof(OMX_VERSIONTYPE) / sizeof(OMX_U32); |
|
42 |
|
43 if (OMX_ErrorNone != CheckPortIndex(*pPortIndex)) |
|
44 { |
|
45 return OMX_ErrorBadPortIndex; |
|
46 } |
|
47 |
|
48 aIndex = *pPortIndex; |
|
49 |
|
50 return OMX_ErrorNone; |
|
51 |
|
52 } |
|
53 |
|
54 |
|
55 /** |
|
56 Checks that a port index is consistent with port information found in the |
|
57 port's OMX_PORT_PARAM_TYPE structure, i.e., the number of ports in the |
|
58 component. |
|
59 |
|
60 @param aPortIndex The port index to be checked. |
|
61 |
|
62 @return OMX_ErrorBadPortIndex in case of error. OMX_ErrorNone otherwise. |
|
63 */ |
|
64 inline OMX_ERRORTYPE |
|
65 COmxILPortManager::CheckPortIndex(OMX_U32 aPortIndex) const |
|
66 { |
|
67 |
|
68 if (aPortIndex >= iAllPorts.Count()) |
|
69 { |
|
70 return OMX_ErrorBadPortIndex; |
|
71 } |
|
72 |
|
73 return OMX_ErrorNone; |
|
74 |
|
75 } |
|
76 |