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