|
1 // Copyright (c) 2010 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 /** |
|
19 * @file |
|
20 * @internalTechnology |
|
21 */ |
|
22 |
|
23 #include "omxilimagefilesourceipb0port.h" |
|
24 #include "omxilfilesourceprocessingfunction.h" |
|
25 #include <string.h> |
|
26 #include <uri8.h> |
|
27 |
|
28 COmxILImageFileSourceIPB0Port* COmxILImageFileSourceIPB0Port::NewL(const TOmxILCommonPortData& aCommonPortData, |
|
29 const RArray<OMX_IMAGE_CODINGTYPE>& aSupportedImageFormats, |
|
30 const RArray<OMX_COLOR_FORMATTYPE>& aSupportedColorFormats, |
|
31 const COmxILFileSourceProcessingFunction& aFileSourcePF) |
|
32 { |
|
33 COmxILImageFileSourceIPB0Port* self = new (ELeave) COmxILImageFileSourceIPB0Port(aFileSourcePF); |
|
34 CleanupStack::PushL(self); |
|
35 self->ConstructL(aCommonPortData, aSupportedImageFormats, aSupportedColorFormats); |
|
36 CleanupStack::Pop(self); |
|
37 return self; |
|
38 } |
|
39 |
|
40 void COmxILImageFileSourceIPB0Port::ConstructL(const TOmxILCommonPortData& aCommonPortData, |
|
41 const RArray<OMX_IMAGE_CODINGTYPE>& aSupportedImageFormats, |
|
42 const RArray<OMX_COLOR_FORMATTYPE>& aSupportedColorFormats) |
|
43 { |
|
44 COmxILImagePort::ConstructL(aCommonPortData, aSupportedImageFormats, aSupportedColorFormats); |
|
45 GetSupportedImageFormats().AppendL(OMX_IMAGE_CodingUnused); |
|
46 GetParamPortDefinition().eDomain = OMX_PortDomainImage; |
|
47 } |
|
48 |
|
49 COmxILImageFileSourceIPB0Port::COmxILImageFileSourceIPB0Port(const COmxILFileSourceProcessingFunction& aFileSourcePF) |
|
50 : iFileSourcePF(aFileSourcePF) |
|
51 { |
|
52 } |
|
53 |
|
54 COmxILImageFileSourceIPB0Port::~COmxILImageFileSourceIPB0Port() |
|
55 { |
|
56 iMimeType.Close(); |
|
57 CleanUpPort(); |
|
58 } |
|
59 |
|
60 OMX_ERRORTYPE COmxILImageFileSourceIPB0Port::GetLocalOmxParamIndexes(RArray<TUint>& aIndexArray) const |
|
61 { |
|
62 return COmxILImagePort::GetLocalOmxParamIndexes(aIndexArray); |
|
63 } |
|
64 |
|
65 OMX_ERRORTYPE COmxILImageFileSourceIPB0Port::GetLocalOmxConfigIndexes(RArray<TUint>& aIndexArray) const |
|
66 { |
|
67 return COmxILImagePort::GetLocalOmxConfigIndexes(aIndexArray); |
|
68 } |
|
69 |
|
70 OMX_ERRORTYPE COmxILImageFileSourceIPB0Port::GetParameter(OMX_INDEXTYPE aParamIndex, |
|
71 TAny* apComponentParameterStructure) const |
|
72 { |
|
73 return COmxILImagePort::GetParameter(aParamIndex, apComponentParameterStructure); |
|
74 } |
|
75 |
|
76 OMX_ERRORTYPE COmxILImageFileSourceIPB0Port::SetParameter(OMX_INDEXTYPE aParamIndex, |
|
77 const TAny* apComponentParameterStructure, |
|
78 TBool& aUpdateProcessingFunction) |
|
79 { |
|
80 return COmxILImagePort::SetParameter(aParamIndex, |
|
81 apComponentParameterStructure, |
|
82 aUpdateProcessingFunction); |
|
83 } |
|
84 |
|
85 OMX_ERRORTYPE COmxILImageFileSourceIPB0Port::SetFormatInPortDefinition(const OMX_PARAM_PORTDEFINITIONTYPE& aPortDefinition, |
|
86 TBool& /*aUpdateProcessingFunction*/) |
|
87 { |
|
88 OMX_ERRORTYPE omxErr = OMX_ErrorNone; |
|
89 if (aPortDefinition.format.image.eCompressionFormat == OMX_IMAGE_CodingUnused) |
|
90 { |
|
91 OMX_STRING ptempMIMEType = GetParamPortDefinition().format.image.cMIMEType; |
|
92 GetParamPortDefinition().format.image = aPortDefinition.format.image; |
|
93 |
|
94 GetParamPortDefinition().format.image.cMIMEType = ptempMIMEType; |
|
95 if(aPortDefinition.format.image.cMIMEType) |
|
96 { |
|
97 TInt len= strlen (aPortDefinition.format.image.cMIMEType); |
|
98 if(len > 0) |
|
99 { |
|
100 TPtrC8 mimetype(reinterpret_cast<const TUint8 *>(aPortDefinition.format.image.cMIMEType), len +1 ); |
|
101 HBufC8 *pHBuf = mimetype.Alloc(); |
|
102 if(pHBuf != NULL ) |
|
103 { |
|
104 iMimeType.Close(); |
|
105 iMimeType.Assign(pHBuf ); |
|
106 TUint8* pTempBuff = const_cast<TUint8*>(iMimeType.PtrZ() ); |
|
107 GetParamPortDefinition().format.image.cMIMEType = reinterpret_cast<OMX_STRING>(pTempBuff ); |
|
108 } |
|
109 } |
|
110 } |
|
111 } |
|
112 else |
|
113 { |
|
114 omxErr = OMX_ErrorUnsupportedSetting; |
|
115 } |
|
116 |
|
117 return omxErr; |
|
118 } |
|
119 |
|
120 TBool COmxILImageFileSourceIPB0Port::IsTunnelledPortCompatible(const OMX_PARAM_PORTDEFINITIONTYPE& aPortDefinition) const |
|
121 { |
|
122 if(aPortDefinition.eDomain != GetParamPortDefinition().eDomain) |
|
123 { |
|
124 return EFalse; |
|
125 } |
|
126 |
|
127 if (aPortDefinition.format.image.eCompressionFormat == OMX_IMAGE_CodingMax) |
|
128 { |
|
129 return EFalse; |
|
130 } |
|
131 return ETrue; |
|
132 } |