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