|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 |
|
25 #include <openmax/il/common/omxilspecversion.h> |
|
26 #include <openmax/il/loader/omxilcomponentif.h> |
|
27 #include <openmax/il/loader/omxilsymbiancomponentif.h> |
|
28 |
|
29 #include "comxil3gpdemuxer.h" |
|
30 #include "comxil3gpdemuxertimeinputport.h" |
|
31 #include "comxil3gpdemuxeraudiooutputport.h" |
|
32 #include "comxil3gpdemuxervideooutputport.h" |
|
33 #include "comxil3gpdemuxerprocessingfunction.h" |
|
34 #include "comxil3gpdemuxerconfigmanager.h" |
|
35 #include "omxil3gpdemuxer.hrh" |
|
36 |
|
37 _LIT8(KSymbianOmxIL3gpDemuxerName, "OMX.SYMBIAN.OTHER.CONTAINER_DEMUXER.3GP"); |
|
38 _LIT8(KSymbianOmxIL3gpDemuxerRole, "container_demuxer"); |
|
39 |
|
40 OMXIL_COMPONENT_ECOM_ENTRYPOINT(KUidSymbianOmxIL3gpDemuxer); |
|
41 |
|
42 OMX_ERRORTYPE SymbianErrorToOmx(TInt aError); |
|
43 |
|
44 // Component Entry Point |
|
45 OMX_ERRORTYPE OMX_ComponentInit(OMX_HANDLETYPE aComponent) |
|
46 { |
|
47 TInt err = COmxIL3GPDemuxer::CreateComponent(aComponent); |
|
48 return SymbianErrorToOmx(err); |
|
49 } |
|
50 |
|
51 TInt COmxIL3GPDemuxer::CreateComponent(OMX_HANDLETYPE hComponent) |
|
52 { |
|
53 COmxIL3GPDemuxer* self = new COmxIL3GPDemuxer(); |
|
54 |
|
55 if (!self) |
|
56 { |
|
57 return KErrNoMemory; |
|
58 } |
|
59 |
|
60 TRAPD(err, self->ConstructL(hComponent)); |
|
61 if(err) |
|
62 { |
|
63 delete self; |
|
64 } |
|
65 return err; |
|
66 } |
|
67 |
|
68 COmxIL3GPDemuxer::COmxIL3GPDemuxer() |
|
69 { |
|
70 // nothing to do |
|
71 } |
|
72 |
|
73 void COmxIL3GPDemuxer::ConstructL(OMX_HANDLETYPE hComponent) |
|
74 { |
|
75 COmxILComponent::ConstructL(hComponent); |
|
76 MOmxILCallbackNotificationIf* callbackNotificationIf=CreateCallbackManagerL(COmxILComponent::EOutofContext); |
|
77 |
|
78 COmxIL3GPDemuxerProcessingFunction* pProcessingFunction = COmxIL3GPDemuxerProcessingFunction::NewL(*callbackNotificationIf); |
|
79 RegisterProcessingFunction(pProcessingFunction); |
|
80 |
|
81 CreatePortManagerL(COmxILComponent::ENonBufferSharingPortManager, |
|
82 TOmxILSpecVersion(), // Component's OMX Version |
|
83 1, // The number of audio ports in this component |
|
84 0, // The starting audio port index |
|
85 0, // The number of image ports in this component |
|
86 0, // The starting image port index |
|
87 1, // The number of video ports in this component |
|
88 1, // The starting video port index |
|
89 1, // The number of other ports in this component |
|
90 2 // The starting other port index |
|
91 ); |
|
92 |
|
93 RPointerArray<TDesC8> roleList; |
|
94 CleanupClosePushL(roleList); |
|
95 roleList.AppendL(&KSymbianOmxIL3gpDemuxerRole); |
|
96 COmxIL3GPDemuxerConfigManager* configManager = COmxIL3GPDemuxerConfigManager::NewL(KSymbianOmxIL3gpDemuxerName, TOmxILSpecVersion(), roleList, *(static_cast<COmxIL3GPDemuxerProcessingFunction*>(pProcessingFunction))); |
|
97 RegisterConfigurationManager(configManager); |
|
98 CleanupStack::PopAndDestroy(&roleList); |
|
99 |
|
100 static_cast<COmxIL3GPDemuxerProcessingFunction*>(pProcessingFunction)->SetConfigManager(*configManager); |
|
101 |
|
102 AddAudioOutputPortL(); |
|
103 AddVideoOutputPortL(); |
|
104 AddTimeInputPortL(); |
|
105 |
|
106 InitComponentL(); |
|
107 } |
|
108 |
|
109 COmxIL3GPDemuxer::~COmxIL3GPDemuxer() |
|
110 { |
|
111 } |
|
112 |
|
113 void COmxIL3GPDemuxer::AddTimeInputPortL() |
|
114 { |
|
115 TOmxILSpecVersion specVersion; |
|
116 |
|
117 TOmxILCommonPortData portData( |
|
118 specVersion, |
|
119 EPortIndexTimeInput, |
|
120 OMX_DirInput, |
|
121 1, // minimum number of buffers |
|
122 0, // minimum buffer size, in bytes |
|
123 OMX_PortDomainOther, |
|
124 OMX_TRUE, // contigious buffers |
|
125 4, // 4-byte alignment |
|
126 OMX_BufferSupplyUnspecified, |
|
127 COmxILPort::KBufferMarkPropagationPortNotNeeded |
|
128 ); |
|
129 |
|
130 RArray<OMX_OTHER_FORMATTYPE> supportedOtherFormats; |
|
131 |
|
132 CleanupClosePushL(supportedOtherFormats); |
|
133 supportedOtherFormats.Append(OMX_OTHER_FormatTime); |
|
134 |
|
135 COmxIL3GPDemuxerTimeInputPort* timeInputPort = COmxIL3GPDemuxerTimeInputPort::NewL(portData, supportedOtherFormats, |
|
136 *(static_cast<COmxIL3GPDemuxerProcessingFunction*>(GetProcessingFunction()))); |
|
137 |
|
138 CleanupStack::PopAndDestroy(&supportedOtherFormats); |
|
139 CleanupStack::PushL(timeInputPort); |
|
140 User::LeaveIfError(AddPort(timeInputPort, OMX_DirInput)); |
|
141 CleanupStack::Pop();//timeInputPort |
|
142 } |
|
143 |
|
144 void COmxIL3GPDemuxer::AddAudioOutputPortL() |
|
145 { |
|
146 TOmxILSpecVersion specVersion; |
|
147 |
|
148 TOmxILCommonPortData portData( |
|
149 specVersion, |
|
150 EPortIndexAudioOutput, |
|
151 OMX_DirOutput, |
|
152 1, // minimum number of buffers |
|
153 1600, // minimum buffer size, in bytes |
|
154 OMX_PortDomainAudio, |
|
155 OMX_FALSE, // do not need contigious buffers |
|
156 4, // 4-byte alignment |
|
157 OMX_BufferSupplyUnspecified, |
|
158 EPortIndexAudioOutput |
|
159 ); |
|
160 |
|
161 COmxIL3GPDemuxerAudioOutputPort* audioOutputPort = COmxIL3GPDemuxerAudioOutputPort::NewL(portData, *(static_cast<COmxIL3GPDemuxerProcessingFunction*>(GetProcessingFunction()))); |
|
162 CleanupStack::PushL(audioOutputPort); |
|
163 User::LeaveIfError(AddPort(audioOutputPort, OMX_DirOutput)); |
|
164 CleanupStack::Pop();//audioOutputPort |
|
165 |
|
166 static_cast<COmxIL3GPDemuxerProcessingFunction*>(GetProcessingFunction())->SetAudioPort(*audioOutputPort); |
|
167 } |
|
168 |
|
169 void COmxIL3GPDemuxer::AddVideoOutputPortL() |
|
170 { |
|
171 TOmxILSpecVersion specVersion; |
|
172 |
|
173 TOmxILCommonPortData portData( |
|
174 specVersion, |
|
175 EPortIndexVideoOutput, |
|
176 OMX_DirOutput, |
|
177 1, // minimum number of buffers, we don't need buffers for format detection |
|
178 62400, // minimum buffer size, in bytes, TODO autodetect this |
|
179 OMX_PortDomainVideo, |
|
180 OMX_FALSE, // do not need contigious buffers |
|
181 4, // 4-byte alignment |
|
182 OMX_BufferSupplyUnspecified, |
|
183 EPortIndexVideoOutput |
|
184 ); |
|
185 |
|
186 COmxIL3GPDemuxerVideoOutputPort* videoOutputPort = COmxIL3GPDemuxerVideoOutputPort::NewL(portData, *(static_cast<COmxIL3GPDemuxerProcessingFunction*>(GetProcessingFunction()))); |
|
187 CleanupStack::PushL(videoOutputPort); |
|
188 User::LeaveIfError(AddPort(videoOutputPort, OMX_DirOutput)); |
|
189 CleanupStack::Pop();//videoOutputPort |
|
190 static_cast<COmxIL3GPDemuxerProcessingFunction*>(GetProcessingFunction())->SetVideoPort(*videoOutputPort); |
|
191 } |
|
192 |
|
193 OMX_ERRORTYPE SymbianErrorToOmx(TInt aError) |
|
194 { |
|
195 switch(aError) |
|
196 { |
|
197 case KErrNone: |
|
198 return OMX_ErrorNone; |
|
199 case KErrNoMemory: |
|
200 return OMX_ErrorInsufficientResources; |
|
201 default: |
|
202 return OMX_ErrorUndefined; |
|
203 } |
|
204 } |