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