|
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 "cdatasinkproxy.h" |
|
22 |
|
23 #ifdef _DEBUG |
|
24 # define __IF_DEBUG(t) {RDebug::t;} |
|
25 #else |
|
26 # define __IF_DEBUG(t) |
|
27 #endif |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CPVDisplaySinkNodeProxy::SetSupplier |
|
31 // Set new supplier . |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 void CPVDisplaySinkNodeProxy::SetSupplier(MPVDataSourceBase* aSupplier) |
|
35 { |
|
36 __IF_DEBUG(Print(_L("VTProto: CPVDisplaySinkNodeProxy::SetSupplier<"))); |
|
37 iSupplier = aSupplier; |
|
38 __IF_DEBUG(Print( _L( "VTProto: CPVDisplaySinkNodeProxy::SetSupplier>" ) )); |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CPVDisplaySinkNodeProxy::BufferEmptiedL |
|
43 // Method called by a data sink to pass back an emptied buffer to the source. |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 void CPVDisplaySinkNodeProxy::BufferEmptiedL(CMMFBuffer* aBuffer) |
|
47 { |
|
48 __IF_DEBUG(Print( _L( "VTProto: CPVDisplaySinkNodeProxy::BufferEmptiedL<" ) )); |
|
49 iSupplier->BufferEmptiedL(aBuffer); //call actually PV code |
|
50 __IF_DEBUG(Print( _L( "VTProto: CPVDisplaySinkNodeProxy::BufferEmptiedL>" ) )); |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CPVDisplaySinkNodeProxy::CPVDisplaySinkNodeProxy |
|
55 // Constructor. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CPVDisplaySinkNodeProxy::CPVDisplaySinkNodeProxy() : MVTVideoSource(KNullUid) |
|
59 { |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CDisplaySinkProxy::CDisplaySinkProxy |
|
64 // Constructor. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CDisplaySinkProxy::CDisplaySinkProxy(MVTVideoSink* aDisplaySink) : MPVDataSink(KNullUid), iDisplaySink(aDisplaySink) |
|
68 { |
|
69 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CDisplaySinkProxy<" ) )); |
|
70 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CDisplaySinkProxy iDisplaySink %d>" ), iDisplaySink)); |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CDisplaySinkProxy::ConstructL |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 void CDisplaySinkProxy::ConstructL() |
|
78 { |
|
79 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::ConstructL<" ) )); |
|
80 iDSNodeProxy = new (ELeave)CPVDisplaySinkNodeProxy(); |
|
81 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::ConstructL>" ) )); |
|
82 } |
|
83 |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CDisplaySinkProxy::NewL |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 CDisplaySinkProxy* CDisplaySinkProxy::NewL(MVTVideoSink* aDisplaySink) |
|
90 { |
|
91 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::NewL<" ) )); |
|
92 CDisplaySinkProxy* self = new (ELeave)CDisplaySinkProxy(aDisplaySink); |
|
93 CleanupStack::PushL(self); |
|
94 self->ConstructL(); |
|
95 CleanupStack::Pop(); |
|
96 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::NewL>" ) )); |
|
97 return self; |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CDisplaySinkProxy::QueryInterface |
|
102 // This API is to allow for extensibility of the plugin interface. |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CDisplaySinkProxy::QueryInterface( const TPVUuid& aUuid, TPVInterfacePtr& aInterfacePtr ) |
|
106 { |
|
107 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::QueryInterface<" ) )); |
|
108 if ( aUuid == KPVUidVideoOutputInterface ) |
|
109 { |
|
110 MPVVideoInput* interfaceP = (MPVVideoInput*) this; |
|
111 aInterfacePtr = (TPVInterfacePtr) interfaceP; |
|
112 } |
|
113 else |
|
114 { |
|
115 aInterfacePtr = NULL; |
|
116 } |
|
117 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::QueryInterface aInterfacePtr %d>" ), aInterfacePtr )); |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CDisplaySinkProxy::GetMultimediaTypesL |
|
122 // This API returns multimedias type supported by the data source/sink. |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 const RArray<TPVMIMEType *>& CDisplaySinkProxy::GetMultimediaTypesL() const |
|
126 { |
|
127 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::GetMultimediaTypesL" ) )); |
|
128 return iDisplaySink->GetMultimediaTypesL(); |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CDisplaySinkProxy::QueryUUID |
|
133 // This API is to allow for extensibility of the plugin interface. |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 void CDisplaySinkProxy::QueryUUID( const TPVMIMEType& aMimeType, RArray<TPVUuid>& aUuids, bool aExactUuidsOnly) |
|
137 { |
|
138 } |
|
139 |
|
140 // ----------------------------------------------------------------------------- |
|
141 // CDisplaySinkProxy::SetTimebaseL |
|
142 // This API is used to provide a timebase for plugins that deal with synchronized media data. |
|
143 // ----------------------------------------------------------------------------- |
|
144 // |
|
145 void CDisplaySinkProxy::SetTimebaseL(MPVSymbianTimebaseInterface* aTimebase) |
|
146 { |
|
147 } |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CDisplaySinkProxy::EmptyBufferL |
|
151 // Method called by a MDataSource to request the data sink to empty aBuffer of data. |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 void CDisplaySinkProxy::EmptyBufferL(CMMFBuffer *aBuffer, MPVDataSourceBase* aSupplier, TMediaId) |
|
155 { |
|
156 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::EmptyBufferL<" ) )); |
|
157 iDSNodeProxy->SetSupplier(aSupplier); |
|
158 CPVMMFPointerBuffer& pvMMFBuffer = *static_cast< CPVMMFPointerBuffer* >( aBuffer ); |
|
159 TVtMMFDataBuffer mmfDataBuffer(aBuffer, pvMMFBuffer.GetFrameSize(), static_cast<TPtr8&>(pvMMFBuffer.Data())); |
|
160 iDisplaySink->EmptyBufferL(mmfDataBuffer, iDSNodeProxy, TMediaId()); |
|
161 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::EmptyBufferL>" ) )); |
|
162 } |
|
163 |
|
164 // ----------------------------------------------------------------------------- |
|
165 // CDisplaySinkProxy::BufferFilledL |
|
166 // Method called by a data source to pass back an filled buffer to the sink. |
|
167 // ----------------------------------------------------------------------------- |
|
168 // |
|
169 void CDisplaySinkProxy::BufferFilledL(CMMFBuffer* aBuffer) |
|
170 { |
|
171 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::BufferFilledL" ) )); |
|
172 return iDisplaySink->BufferFilledL(aBuffer); |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CDisplaySinkProxy::CanCreateSinkBuffer |
|
177 // Method to indicate whether the data sink can create a buffer. |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 TBool CDisplaySinkProxy::CanCreateSinkBuffer() |
|
181 { |
|
182 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CanCreateSinkBuffer" ) )); |
|
183 return iDisplaySink->CanCreateSinkBuffer(); |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // CDisplaySinkProxy::CreateSinkBufferL |
|
188 // Returns a buffer created by the data sink |
|
189 // ----------------------------------------------------------------------------- |
|
190 // |
|
191 CMMFBuffer* CDisplaySinkProxy::CreateSinkBufferL(TMediaId aMediaId, TBool &aReference ) |
|
192 { |
|
193 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::CreateSinkBufferL" ) )); |
|
194 return iDisplaySink->CreateSinkBufferL(aMediaId, aReference); |
|
195 } |
|
196 |
|
197 // ----------------------------------------------------------------------------- |
|
198 // CDisplaySinkProxy::SinkThreadLogon |
|
199 // Method to 'logon' the data sink to the same thread that sink will be consuming data in. |
|
200 // ----------------------------------------------------------------------------- |
|
201 // |
|
202 TInt CDisplaySinkProxy::SinkThreadLogon( MAsyncEventHandler& aEventHandler ) |
|
203 { |
|
204 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkThreadLogon" ) )); |
|
205 return iDisplaySink->SinkThreadLogon(aEventHandler); |
|
206 } |
|
207 |
|
208 // ----------------------------------------------------------------------------- |
|
209 // CDisplaySinkProxy::SinkThreadLogoff |
|
210 // Method to 'logoff' the data sink from the same thread that sink consumes data in. |
|
211 // ----------------------------------------------------------------------------- |
|
212 // |
|
213 void CDisplaySinkProxy::SinkThreadLogoff() |
|
214 { |
|
215 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkThreadLogoff" ) )); |
|
216 iDisplaySink->SinkThreadLogoff(); |
|
217 } |
|
218 |
|
219 // ----------------------------------------------------------------------------- |
|
220 // CDisplaySinkProxy::SinkPrimeL |
|
221 // Method to 'prime' the data sink. |
|
222 // ----------------------------------------------------------------------------- |
|
223 // |
|
224 TInt CDisplaySinkProxy::SinkPrimeL() |
|
225 { |
|
226 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkPrimeL" ) )); |
|
227 return iDisplaySink->SinkPrimeL(); |
|
228 } |
|
229 |
|
230 // ----------------------------------------------------------------------------- |
|
231 // CDisplaySinkProxy::SinkPlayL |
|
232 // Method to 'play' the data sink. |
|
233 // ----------------------------------------------------------------------------- |
|
234 // |
|
235 TInt CDisplaySinkProxy::SinkPlayL() |
|
236 { |
|
237 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkPlayL" ) )); |
|
238 return iDisplaySink->SinkPlayL(); |
|
239 } |
|
240 |
|
241 // ----------------------------------------------------------------------------- |
|
242 // CDisplaySinkProxy::SinkPauseL |
|
243 // Method to 'pause' the data sink. |
|
244 // ----------------------------------------------------------------------------- |
|
245 // |
|
246 TInt CDisplaySinkProxy::SinkPauseL() |
|
247 { |
|
248 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkPauseL" ) )); |
|
249 return iDisplaySink->SinkPauseL(); |
|
250 } |
|
251 |
|
252 // ----------------------------------------------------------------------------- |
|
253 // CDisplaySinkProxy::SinkStopL |
|
254 // Method to 'stop' the data sink. |
|
255 // ----------------------------------------------------------------------------- |
|
256 // |
|
257 TInt CDisplaySinkProxy::SinkStopL() |
|
258 { |
|
259 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SinkStopL" ) )); |
|
260 return iDisplaySink->SinkStopL(); |
|
261 } |
|
262 |
|
263 // ----------------------------------------------------------------------------- |
|
264 // CDisplaySinkProxy::SetFormatL |
|
265 // Set the video frame format. This must be from the list of supported formats. |
|
266 // ----------------------------------------------------------------------------- |
|
267 // |
|
268 void CDisplaySinkProxy::SetFormatL(const TDesC8& aFormat) |
|
269 { |
|
270 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SetFormatL" ) )); |
|
271 iDisplaySink->SetFormatL(aFormat); |
|
272 } |
|
273 |
|
274 // ----------------------------------------------------------------------------- |
|
275 // CDisplaySinkProxy::SetVideoFrameSizeL |
|
276 // Set the video frame size. |
|
277 // ----------------------------------------------------------------------------- |
|
278 // |
|
279 void CDisplaySinkProxy::SetVideoFrameSizeL(const TSize& aSize) |
|
280 { |
|
281 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::SetVideoFrameSizeL" ) )); |
|
282 iDisplaySink->SetVideoFrameSizeL(aSize); |
|
283 } |
|
284 |
|
285 // ----------------------------------------------------------------------------- |
|
286 // CDisplaySinkProxy::GetVideoFrameSizeL |
|
287 // Get the video frame size. |
|
288 // ----------------------------------------------------------------------------- |
|
289 // |
|
290 void CDisplaySinkProxy::GetVideoFrameSizeL(TSize& aSize) const |
|
291 { |
|
292 __IF_DEBUG(Print( _L( "VTProto: CDisplaySinkProxy::GetVideoFrameSizeL" ) )); |
|
293 iDisplaySink->GetVideoFrameSizeL(aSize); |
|
294 } |
|
295 // End of File |