|
1 /* |
|
2 * Copyright (c) 2004-2006 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 #include <pv_plugin_interfaces.h> |
|
20 #include "mvtprotocolhandler.h" |
|
21 #include "cdatasourceproxy.h" |
|
22 |
|
23 #ifdef _DEBUG |
|
24 # define __IF_DEBUG(t) {RDebug::t;} |
|
25 #else |
|
26 # define __IF_DEBUG(t) |
|
27 #endif |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CPVCameraSourceNodeProxy::CPVCameraSourceNodeProxy |
|
31 // Constructor. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CPVCameraSourceNodeProxy::CPVCameraSourceNodeProxy() : MVTVideoSink(KNullUid) |
|
35 { |
|
36 } |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CPVCameraSourceNodeProxy::SetConsumer |
|
40 // Set consumer object. |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 void CPVCameraSourceNodeProxy::SetConsumer(MPVDataSinkBase* aConsumer) |
|
44 { |
|
45 __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::SetConsumer<"))); |
|
46 iConsumer = aConsumer; |
|
47 __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::SetConsumer>"))); |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CPVCameraSourceNodeProxy::BufferFilledL |
|
52 // Method called by a data source to pass back an filled buffer to the sink. |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 void CPVCameraSourceNodeProxy::BufferFilledL(CMMFBuffer* aBuffer) |
|
56 { |
|
57 __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::BufferFilledL<"))); |
|
58 iConsumer->BufferFilledL(aBuffer); |
|
59 __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::BufferFilledL>"))); |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CPVCameraSourceNodeProxy::SendEventToClient |
|
64 // Send event to client. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 TInt CPVCameraSourceNodeProxy::SendEventToClient(const TMMFEvent &aEvent) |
|
68 { |
|
69 __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::SendEventToClient<"))); |
|
70 MAsyncEventHandler* eventHandler = dynamic_cast<MAsyncEventHandler*>(iConsumer); |
|
71 TInt result = eventHandler->SendEventToClient(aEvent); |
|
72 __IF_DEBUG(Print(_L("VTProto: CPVCameraSourceNodeProxy::SendEventToClient>"))); |
|
73 return result; |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CVideoSourceProxy::CVideoSourceProxy |
|
78 // Constructor. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 CVideoSourceProxy::CVideoSourceProxy(MVTVideoSource* aDataSource) : MPVDataSource(KNullUid), iVideoSource(aDataSource) |
|
82 { |
|
83 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CVideoSourceProxy<"))); |
|
84 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CVideoSourceProxy iVideoSource %d>"), iVideoSource)); |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CVideoSourceProxy::ConstructL |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 void CVideoSourceProxy::ConstructL() |
|
92 { |
|
93 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::ConstructL<"))); |
|
94 iCameraSourceNodeProxy = new (ELeave) CPVCameraSourceNodeProxy(); |
|
95 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::ConstructL>"))); |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CVideoSourceProxy::NewL |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 CVideoSourceProxy* CVideoSourceProxy::NewL(MVTVideoSource* aDataSource) |
|
103 { |
|
104 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::NewL<"))); |
|
105 CVideoSourceProxy* self = new (ELeave)CVideoSourceProxy(aDataSource); |
|
106 CleanupStack::PushL(self); |
|
107 self->ConstructL(); |
|
108 CleanupStack::Pop(); |
|
109 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::NewL>"))); |
|
110 return self; |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CVideoSourceProxy::QueryInterface |
|
115 // This API is to allow for extensibility of the plugin interface. |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 void CVideoSourceProxy::QueryInterface( const TPVUuid& aUuid, TPVInterfacePtr& aInterfacePtr ) |
|
119 { |
|
120 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::QueryInterface<"))); |
|
121 if ( aUuid == KPVUidVideoInputInterface ) |
|
122 { |
|
123 MPVVideoInput* interfaceP = (MPVVideoInput*) this; |
|
124 aInterfacePtr = (TPVInterfacePtr) interfaceP; |
|
125 } |
|
126 else |
|
127 { |
|
128 aInterfacePtr = NULL; |
|
129 } |
|
130 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::QueryInterface aInterfacePtr %d<"), aInterfacePtr)); |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CVideoSourceProxy::GetMultimediaTypesL |
|
135 // This API returns multimedias type supported by the data source/sink. |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 const RArray<TPVMIMEType *>& CVideoSourceProxy::GetMultimediaTypesL() const |
|
139 { |
|
140 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::GetMultimediaTypesL iVideoSource %d"), iVideoSource)); |
|
141 const RArray<TPVMIMEType *>& multimediaType = iVideoSource->GetMultimediaTypesL(); |
|
142 return multimediaType; |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CVideoSourceProxy::QueryUUID |
|
147 // This API is to allow for extensibility of the plugin interface. |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 void CVideoSourceProxy::QueryUUID( const TPVMIMEType& aMimeType, RArray<TPVUuid>& aUuids, bool aExactUuidsOnly) |
|
151 { |
|
152 } |
|
153 |
|
154 // ----------------------------------------------------------------------------- |
|
155 // CVideoSourceProxy::SetTimebaseL |
|
156 // This API is used to provide a timebase for plugins that deal with synchronized media data. |
|
157 // ----------------------------------------------------------------------------- |
|
158 // |
|
159 void CVideoSourceProxy::SetTimebaseL(MPVSymbianTimebaseInterface* aTimebase) |
|
160 { |
|
161 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetTimebaseL<"))); |
|
162 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetTimebaseL>"))); |
|
163 } |
|
164 |
|
165 // ----------------------------------------------------------------------------- |
|
166 // CVideoSourceProxy::FillBufferL |
|
167 // Method called by a MDataSink to request the data source to fill aBuffer with data. |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 void CVideoSourceProxy::FillBufferL(CMMFBuffer* aBuffer, MPVDataSinkBase* aConsumer, TMediaId aMediaId ) |
|
171 { |
|
172 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::FillBufferL<"))); |
|
173 iCameraSourceNodeProxy->SetConsumer(aConsumer); |
|
174 iVideoSource->FillBufferL(aBuffer, iCameraSourceNodeProxy, aMediaId); |
|
175 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::FillBufferL>"))); |
|
176 } |
|
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // CVideoSourceProxy::CreateSourceBufferL |
|
180 // Returns a buffer created by the data source. |
|
181 // ----------------------------------------------------------------------------- |
|
182 // |
|
183 CMMFBuffer* CVideoSourceProxy::CreateSourceBufferL(TMediaId aMediaId, TBool &aReference ) |
|
184 { |
|
185 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CreateSourceBufferL"))); |
|
186 return iVideoSource->CreateSourceBufferL(aMediaId, aReference); |
|
187 } |
|
188 |
|
189 // ----------------------------------------------------------------------------- |
|
190 // CVideoSourceProxy::CreateSourceBufferL |
|
191 // Returns a buffer created by the data source. |
|
192 // ----------------------------------------------------------------------------- |
|
193 // |
|
194 CMMFBuffer* CVideoSourceProxy::CreateSourceBufferL(TMediaId aMediaId, CMMFBuffer &aSinkBuffer, TBool &aReference) |
|
195 { |
|
196 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CreateSourceBufferL"))); |
|
197 return iVideoSource->CreateSourceBufferL(aMediaId, aSinkBuffer, aReference); |
|
198 } |
|
199 |
|
200 // ----------------------------------------------------------------------------- |
|
201 // CVideoSourceProxy::SourceThreadLogon |
|
202 // Method to 'logon' the data source to the same thread that source will be supplying data in. |
|
203 // ----------------------------------------------------------------------------- |
|
204 // |
|
205 TInt CVideoSourceProxy::SourceThreadLogon( MAsyncEventHandler& aEventHandler ) |
|
206 { |
|
207 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourceThreadLogon"))); |
|
208 return iVideoSource->SourceThreadLogon(aEventHandler); |
|
209 } |
|
210 |
|
211 // ----------------------------------------------------------------------------- |
|
212 // CVideoSourceProxy::SourceThreadLogoff |
|
213 // Method to 'logoff' the data source from the same thread that source supplies data in. |
|
214 // ----------------------------------------------------------------------------- |
|
215 // |
|
216 void CVideoSourceProxy::SourceThreadLogoff() |
|
217 { |
|
218 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourceThreadLogoff<"))); |
|
219 iVideoSource->SourceThreadLogoff(); |
|
220 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourceThreadLogoff>"))); |
|
221 } |
|
222 |
|
223 // ----------------------------------------------------------------------------- |
|
224 // CVideoSourceProxy::SourcePrimeL |
|
225 // Method to 'prime' the data source. |
|
226 // ----------------------------------------------------------------------------- |
|
227 // |
|
228 TInt CVideoSourceProxy::SourcePrimeL() |
|
229 { |
|
230 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourcePrimeL<"))); |
|
231 return iVideoSource->SourcePrimeL(); |
|
232 } |
|
233 |
|
234 // ----------------------------------------------------------------------------- |
|
235 // CVideoSourceProxy::SourcePlayL |
|
236 // Method to 'play' the data source. |
|
237 // ----------------------------------------------------------------------------- |
|
238 // |
|
239 TInt CVideoSourceProxy::SourcePlayL() |
|
240 { |
|
241 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourcePlayL"))); |
|
242 return iVideoSource->SourcePlayL(); |
|
243 } |
|
244 |
|
245 // ----------------------------------------------------------------------------- |
|
246 // CVideoSourceProxy::SourcePauseL |
|
247 // Method to 'pause' the data source. |
|
248 // ----------------------------------------------------------------------------- |
|
249 // |
|
250 TInt CVideoSourceProxy::SourcePauseL() |
|
251 { |
|
252 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourcePauseL"))); |
|
253 return iVideoSource->SourcePauseL(); |
|
254 } |
|
255 |
|
256 // ----------------------------------------------------------------------------- |
|
257 // CVideoSourceProxy::SourceStopL |
|
258 // Method to 'stop' the data source. |
|
259 // ----------------------------------------------------------------------------- |
|
260 // |
|
261 TInt CVideoSourceProxy::SourceStopL() |
|
262 { |
|
263 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SourceStopL"))); |
|
264 return iVideoSource->SourceStopL(); |
|
265 } |
|
266 |
|
267 // ----------------------------------------------------------------------------- |
|
268 // CVideoSourceProxy::BufferEmptiedL |
|
269 // Method called by a data sink to pass back an emptied buffer to the source. |
|
270 // ----------------------------------------------------------------------------- |
|
271 // |
|
272 void CVideoSourceProxy::BufferEmptiedL(CMMFBuffer* aBuffer) |
|
273 { |
|
274 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::BufferEmptiedL"))); |
|
275 iVideoSource->BufferEmptiedL(aBuffer); |
|
276 } |
|
277 |
|
278 // ----------------------------------------------------------------------------- |
|
279 // CVideoSourceProxy::CanCreateSourceBuffer |
|
280 // Method to indicate whether the data source can create a buffer. |
|
281 // ----------------------------------------------------------------------------- |
|
282 // |
|
283 TBool CVideoSourceProxy::CanCreateSourceBuffer() |
|
284 { |
|
285 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::CanCreateSourceBuffer"))); |
|
286 return iVideoSource->CanCreateSourceBuffer(); |
|
287 } |
|
288 |
|
289 // ----------------------------------------------------------------------------- |
|
290 // CVideoSourceProxy::SetFormatL |
|
291 // Set the video frame format. This must be from the list of supported formats. |
|
292 // ----------------------------------------------------------------------------- |
|
293 // |
|
294 void CVideoSourceProxy::SetFormatL(const TDesC8& aFormat) |
|
295 { |
|
296 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetFormatL"))); |
|
297 iVideoSource->SetFormatL(aFormat); |
|
298 } |
|
299 |
|
300 // ----------------------------------------------------------------------------- |
|
301 // CVideoSourceProxy::SetFrameRateL |
|
302 // Set the video frame rate. This must be within the range of supported frame rates. |
|
303 // ----------------------------------------------------------------------------- |
|
304 // |
|
305 void CVideoSourceProxy::SetFrameRateL(TReal32 aFrameRate) |
|
306 { |
|
307 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetFrameRateL"))); |
|
308 iVideoSource->SetFrameRateL(aFrameRate); |
|
309 } |
|
310 |
|
311 // ----------------------------------------------------------------------------- |
|
312 // CVideoSourceProxy::SetVideoFrameSizeL |
|
313 // Set the video frame size. |
|
314 // ----------------------------------------------------------------------------- |
|
315 // |
|
316 void CVideoSourceProxy::SetVideoFrameSizeL(const TSize& aSize) |
|
317 { |
|
318 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetVideoFrameSizeL <"))); |
|
319 iVideoSource->SetVideoFrameSizeL(aSize); |
|
320 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::SetVideoFrameSizeL >"))); |
|
321 } |
|
322 |
|
323 // ----------------------------------------------------------------------------- |
|
324 // CVideoSourceProxy::GetVideoFrameSizeL |
|
325 // Get the video frame size. |
|
326 // ----------------------------------------------------------------------------- |
|
327 // |
|
328 void CVideoSourceProxy::GetVideoFrameSizeL(TSize& aSize) const |
|
329 { |
|
330 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::GetVideoFrameSizeL<"))); |
|
331 iVideoSource->GetVideoFrameSizeL(aSize); |
|
332 __IF_DEBUG(Print(_L("VTProto: CVideoSourceProxy::GetVideoFrameSizeL>"))); |
|
333 } |
|
334 // End of File |