|
1 /* |
|
2 * Copyright (c) 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: Display Sink subsystem. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "CDisplaySink.h" |
|
22 #include "CDisplaySinkDP.h" |
|
23 #include "CDisplaySinkDSA.h" |
|
24 #include "CDisplaySinkNGA.h" |
|
25 #include <mmffourcc.h> |
|
26 #include <featmgr.h> |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // MACROS |
|
31 |
|
32 #ifdef _DEBUG |
|
33 #include <e32debug.h> |
|
34 #define PRINT RDebug::Print |
|
35 #define _IFDBG(a) a |
|
36 #else |
|
37 #define PRINT |
|
38 #define _IFDBG(a) |
|
39 #endif |
|
40 |
|
41 // ============================ MEMBER FUNCTIONS =============================== |
|
42 |
|
43 // ============================= CVtFrameQueue ================================= |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CVtFrameQueue::CVtFrameQueue |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 CVtFrameQueue::CVtFrameQueue() : CActive( EPriorityNormal ) |
|
50 { |
|
51 _IFDBG(PRINT( _L( "CVtFrameQueue::CVtFrameQueue<" ) )); |
|
52 _IFDBG(PRINT( _L( "CVtFrameQueue::CVtFrameQueue>" ) )); |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CVtFrameQueue::ThreadLogon |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 TInt CVtFrameQueue::ThreadLogon() |
|
60 { |
|
61 _IFDBG(PRINT( _L( "CVtFrameQueue::ThreadLogon<" ) )); |
|
62 if ( !IsAdded() ) |
|
63 { |
|
64 CActiveScheduler::Add( this ); |
|
65 } |
|
66 TInt result( iThread.Open( RThread().Id() ) ); |
|
67 _IFDBG(PRINT( _L( "CVtFrameQueue::ThreadLogon %d >" ), result )); |
|
68 return result; |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // CVtFrameQueue::SinkStoppedL |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 void CVtFrameQueue::SinkStoppedL() |
|
76 { |
|
77 _IFDBG(PRINT( _L( "CVtFrameQueue::SinkStoppedL<" ) )); |
|
78 DoReleaseBufferL( iBuffer ); |
|
79 DoReleaseBufferL( iReleaseBuffer ); |
|
80 _IFDBG(PRINT( _L( "CVtFrameQueue::SinkStoppedL>" ) )); |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CVtFrameQueue::ThreadLogoff |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 void CVtFrameQueue::ThreadLogoff() |
|
88 { |
|
89 _IFDBG(PRINT( _L( "CVtFrameQueue::ThreadLogoff<" ) )); |
|
90 if ( IsAdded() ) |
|
91 { |
|
92 Deque(); |
|
93 } |
|
94 _IFDBG(PRINT( _L( "CVtFrameQueue::ThreadLogoff>" ) )); |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CVtFrameQueue::Store |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 void CVtFrameQueue::Store( MVTVideoSource& aSupplier, |
|
102 CMMFDataBuffer* aBuffer, |
|
103 TSize aFrameSize, |
|
104 TPtr8& aPtr ) |
|
105 { |
|
106 _IFDBG(PRINT( _L( "CVtFrameQueue::Store<" ) )); |
|
107 iSupplier = &aSupplier; |
|
108 iBuffer = aBuffer; |
|
109 iFrameSize = aFrameSize; |
|
110 iPtr = &aPtr; |
|
111 _IFDBG(PRINT( _L( "CVtFrameQueue::Store>" ) )); |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CVtFrameQueue::IsStored |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 TBool CVtFrameQueue::IsStored() const |
|
119 { |
|
120 _IFDBG(PRINT( _L( "CVtFrameQueue::IsStored<" ) )); |
|
121 _IFDBG(PRINT( _L( "CVtFrameQueue::IsStored %d>" ), |
|
122 ( iBuffer != NULL ) )); |
|
123 return ( iBuffer != NULL ); |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CVtFrameQueue::Buffer |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 TVtMMFDataBuffer CVtFrameQueue::Buffer() |
|
131 { |
|
132 _IFDBG(PRINT( _L( "CVtFrameQueue::Buffer<" ) )); |
|
133 _IFDBG(PRINT( _L( "CVtFrameQueue::Buffer %d>" ), |
|
134 reinterpret_cast< TUint >( iBuffer ) )); |
|
135 return TVtMMFDataBuffer(iBuffer, iFrameSize, *iPtr); |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CVtFrameQueue::Release |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 void CVtFrameQueue::Release() |
|
143 { |
|
144 _IFDBG(PRINT( _L( "CVtFrameQueue::Release<" ) )); |
|
145 if ( !IsActive() && IsStored() ) |
|
146 { |
|
147 iReleaseBuffer = iBuffer; |
|
148 iBuffer = NULL; |
|
149 iStatus = KRequestPending; |
|
150 TRequestStatus* pStatus = &iStatus; |
|
151 SetActive(); |
|
152 iThread.RequestComplete( pStatus, KErrNone ); |
|
153 _IFDBG(PRINT( _L( "CVtFrameQueue::Release -done-" ) )); |
|
154 } |
|
155 _IFDBG(PRINT( _L( "CVtFrameQueue::Release>" ) )); |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CVtFrameQueue::RunL |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 void CVtFrameQueue::RunL() |
|
163 { |
|
164 _IFDBG(PRINT( _L( "CVtFrameQueue::RunL<" ) )); |
|
165 DoReleaseBufferL( iReleaseBuffer ); |
|
166 _IFDBG(PRINT( _L( "CVtFrameQueue::RunL>" ) )); |
|
167 } |
|
168 |
|
169 // ----------------------------------------------------------------------------- |
|
170 // CVtFrameQueue::DoReleaseBufferL |
|
171 // ----------------------------------------------------------------------------- |
|
172 // |
|
173 void CVtFrameQueue::DoReleaseBufferL( CMMFDataBuffer*& aBuffer ) |
|
174 { |
|
175 _IFDBG(PRINT( _L( "CVtFrameQueue::DoReleaseBufferL<" ) )); |
|
176 if ( aBuffer && iSupplier ) |
|
177 { |
|
178 iSupplier->BufferEmptiedL( aBuffer ); |
|
179 aBuffer = NULL; |
|
180 } |
|
181 _IFDBG(PRINT( _L( "CVtFrameQueue::DoReleaseBufferL>" ) )); |
|
182 } |
|
183 |
|
184 // ----------------------------------------------------------------------------- |
|
185 // CVtFrameQueue::DoCancel |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 void CVtFrameQueue::DoCancel() |
|
189 { |
|
190 // nothing to do |
|
191 } |
|
192 |
|
193 // ============================ CVtCallback ================================= |
|
194 |
|
195 // ----------------------------------------------------------------------------- |
|
196 // CVtCallback::CVtCallback( MDisplaySinkObserver& aObserver ) |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 CVtCallback::CVtCallback( MDisplaySinkObserver& aObserver ) |
|
200 : CActive( EPriorityStandard ), iObserver( &aObserver ) |
|
201 { |
|
202 _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::CVtCallback()<"), RThread().Id().operator TUint())); |
|
203 CActiveScheduler::Add( this ); |
|
204 iOwnThreadId = RThread().Id(); |
|
205 _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::CVtCallback()>"), RThread().Id().operator TUint())); |
|
206 } |
|
207 |
|
208 // ----------------------------------------------------------------------------- |
|
209 // CVtCallback::~CVtCallback() |
|
210 // ----------------------------------------------------------------------------- |
|
211 // |
|
212 CVtCallback::~CVtCallback() |
|
213 { |
|
214 Cancel(); |
|
215 } |
|
216 |
|
217 // ----------------------------------------------------------------------------- |
|
218 // CVtCallback::VideoFrameSizeChangedL( const TSize& aFrom, const TSize& aTo ) |
|
219 // ----------------------------------------------------------------------------- |
|
220 // |
|
221 void CVtCallback::VideoFrameSizeChangedL( const TSize& aFrom, const TSize& aTo ) |
|
222 { |
|
223 _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::VideoFrameSizeChangedL()<"), RThread().Id().operator TUint())); |
|
224 iCallBackType = EVideoFrameSizeChanged; |
|
225 iFrom = aFrom; |
|
226 iTo = aTo; |
|
227 IssueCallbackL(); |
|
228 _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::VideoFrameSizeChangedL()>"), RThread().Id().operator TUint())); |
|
229 } |
|
230 |
|
231 // ----------------------------------------------------------------------------- |
|
232 // CVtCallback::Result() const |
|
233 // ----------------------------------------------------------------------------- |
|
234 // |
|
235 TInt CVtCallback::Result() const |
|
236 { |
|
237 _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::Result()<"), RThread().Id().operator TUint())); |
|
238 _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::Result()>"), RThread().Id().operator TUint())); |
|
239 return iResult; |
|
240 } |
|
241 |
|
242 // ----------------------------------------------------------------------------- |
|
243 // CVtCallback::Completed() const |
|
244 // ----------------------------------------------------------------------------- |
|
245 // |
|
246 TBool CVtCallback::Completed() const |
|
247 { |
|
248 _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::Completed()<"), RThread().Id().operator TUint())); |
|
249 _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::Completed()>"), RThread().Id().operator TUint())); |
|
250 return iCompleted; |
|
251 } |
|
252 |
|
253 // ----------------------------------------------------------------------------- |
|
254 // CVtCallback::IssueCallbackL() |
|
255 // ----------------------------------------------------------------------------- |
|
256 // |
|
257 void CVtCallback::IssueCallbackL() |
|
258 { |
|
259 _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::IssueCallbackL()<"), RThread().Id().operator TUint())); |
|
260 iCompleted = EFalse; |
|
261 TRequestStatus* pStatus = &iStatus; |
|
262 RThread thread; |
|
263 if( thread.Id() == iOwnThreadId ) |
|
264 { |
|
265 SetActive(); |
|
266 User::RequestComplete( pStatus, KErrNone ); |
|
267 } |
|
268 else |
|
269 { |
|
270 User::LeaveIfError( thread.Open( iOwnThreadId ) ); |
|
271 SetActive(); |
|
272 *pStatus = KRequestPending; |
|
273 thread.RequestComplete( pStatus, KErrNone ); |
|
274 thread.Close(); |
|
275 } |
|
276 _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::IssueCallbackL()>"), RThread().Id().operator TUint())); |
|
277 } |
|
278 |
|
279 // ----------------------------------------------------------------------------- |
|
280 // CVtCallback::RunL() |
|
281 // ----------------------------------------------------------------------------- |
|
282 // |
|
283 void CVtCallback::RunL() |
|
284 { |
|
285 _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::RunL()<"), RThread().Id().operator TUint())); |
|
286 |
|
287 iResult = KErrNone; |
|
288 |
|
289 switch( iCallBackType ) |
|
290 { |
|
291 case EVideoFrameSizeChanged: |
|
292 iObserver->VideoFrameSizeChangedL( iFrom, iTo ); |
|
293 break; |
|
294 |
|
295 default: |
|
296 User::Leave( KErrArgument ); |
|
297 } |
|
298 |
|
299 iCompleted = ETrue; |
|
300 |
|
301 _IFDBG(PRINT(_L("VideoSource[%d]: CVtCallback::RunL()>"), RThread().Id().operator TUint())); |
|
302 } |
|
303 |
|
304 // ----------------------------------------------------------------------------- |
|
305 // CVtCallback::DoCancel() |
|
306 // ----------------------------------------------------------------------------- |
|
307 // |
|
308 void CVtCallback::DoCancel() |
|
309 { |
|
310 // do nothing! |
|
311 } |
|
312 |
|
313 // ----------------------------------------------------------------------------- |
|
314 // CVtCallback::RunError( TInt aError ) |
|
315 // ----------------------------------------------------------------------------- |
|
316 // |
|
317 TInt CVtCallback::RunError( TInt aError ) |
|
318 { |
|
319 iCompleted = ETrue; |
|
320 iResult = aError; |
|
321 return KErrNone; |
|
322 } |
|
323 |
|
324 // ========================== TDisplaySinkParams =============================== |
|
325 |
|
326 // ----------------------------------------------------------------------------- |
|
327 // TDisplaySinkParams::TDisplaySinkParams |
|
328 // ----------------------------------------------------------------------------- |
|
329 // |
|
330 EXPORT_C TDisplaySinkParams::TDisplaySinkParams() : |
|
331 iFrameRateLimit( EFrameRateLimitNone ) |
|
332 { |
|
333 } |
|
334 |
|
335 |
|
336 // ============================ CDisplaySink =================================== |
|
337 |
|
338 // ----------------------------------------------------------------------------- |
|
339 // CDisplaySink::~CDisplaySink |
|
340 // ----------------------------------------------------------------------------- |
|
341 // |
|
342 CDisplaySink::~CDisplaySink() |
|
343 { |
|
344 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::~CDisplaySink()<"), RThread().Id().operator TUint())); |
|
345 delete iVideoFrameQueue; |
|
346 iBitmapCS.Close(); |
|
347 delete iVTSignaller; |
|
348 iVTMimeTypes.Reset(); |
|
349 iVTMimeTypes.Close(); |
|
350 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::~CDisplaySink()>"), RThread().Id().operator TUint())); |
|
351 } |
|
352 |
|
353 // ----------------------------------------------------------------------------- |
|
354 // CDisplaySink::ConstructL |
|
355 // ----------------------------------------------------------------------------- |
|
356 // |
|
357 void CDisplaySink::ConstructL( TDisplaySinkParams& aParams, |
|
358 const TDesC8& aInitData ) |
|
359 { |
|
360 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ConstructL()<"), RThread().Id().operator TUint())); |
|
361 iDSFlags = aParams.iFlags; |
|
362 iYuv420PlanarDesc.Delete( 0, iYuv420PlanarDesc.Length() ); |
|
363 iYuv420PlanarDesc.Append( KVtVideoMIMETypeYUV420 ); |
|
364 User::LeaveIfError( iVTMimeTypes.Append( &iYuv420PlanarDesc ) ); |
|
365 iVideoFrameQueue = new ( ELeave ) CVtFrameQueue(); |
|
366 iVTSignaller = new ( ELeave ) CVtCallback( *aParams.iObserver ); |
|
367 BitmapEntry( EFirstBitmap ).iIsFree = EFalse; |
|
368 BitmapEntry( ESecondBitmap ).iIsFree = EFalse; |
|
369 iThreadId = aParams.iThreadId; |
|
370 iRequestStatusPtr = aParams.iRequestStatusPtr; |
|
371 iFrameSize = QCIF; |
|
372 SetFrameRateLimit( aParams.iFrameRateLimit ); |
|
373 User::LeaveIfError( iBitmapCS.CreateLocal() ); |
|
374 BaseConstructL( aParams, aInitData ); |
|
375 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ConstructL()>"), RThread().Id().operator TUint())); |
|
376 } |
|
377 |
|
378 // ----------------------------------------------------------------------------- |
|
379 // CDisplaySink::Destroy |
|
380 // ----------------------------------------------------------------------------- |
|
381 // |
|
382 void CDisplaySink::Destroy() |
|
383 { |
|
384 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Destroy()<"), RThread().Id().operator TUint())); |
|
385 delete this; |
|
386 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Destroy()>"), RThread().Id().operator TUint())); |
|
387 } |
|
388 |
|
389 // ----------------------------------------------------------------------------- |
|
390 // CDisplaySink::SetBitmapAvailable( TBitmapNo aBitmapNo ) |
|
391 // ----------------------------------------------------------------------------- |
|
392 // |
|
393 void CDisplaySink::SetBitmapAvailable( TBitmapNo aBitmapNo ) |
|
394 { |
|
395 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetBitmapAvailable()<"), RThread().Id().operator TUint())); |
|
396 iBitmapCS.Wait(); |
|
397 BitmapEntry( aBitmapNo ).iIsFree = ETrue; |
|
398 BaseSetBitmapAvailable( aBitmapNo ); |
|
399 iBitmapCS.Signal(); |
|
400 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetBitmapAvailable()>"), RThread().Id().operator TUint())); |
|
401 } |
|
402 |
|
403 // ----------------------------------------------------------------------------- |
|
404 // CDisplaySink::Release |
|
405 // ----------------------------------------------------------------------------- |
|
406 // |
|
407 void CDisplaySink::Release() |
|
408 { |
|
409 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Release()<"), RThread().Id().operator TUint())); |
|
410 iBitmapCS.Wait(); |
|
411 if( !iReleased ) |
|
412 { |
|
413 iReleased = ETrue; |
|
414 if( iRequestStatusPtr != NULL && |
|
415 (*iRequestStatusPtr) == KRequestPending ) |
|
416 { |
|
417 RThread thread; |
|
418 TInt err = thread.Open( iThreadId ); |
|
419 if( err == KErrNone ) |
|
420 { |
|
421 *iRequestStatusPtr = KRequestPending; |
|
422 TRequestStatus* statusP = iRequestStatusPtr; |
|
423 thread.RequestComplete( statusP, KErrCancel ); |
|
424 thread.Close(); |
|
425 } |
|
426 } |
|
427 } |
|
428 iVideoFrameQueue->Release(); |
|
429 iBitmapCS.Signal(); |
|
430 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Release()>"), RThread().Id().operator TUint())); |
|
431 } |
|
432 |
|
433 // ----------------------------------------------------------------------------- |
|
434 // CDisplaySink::UpdateSinkParamsL( const TDisplaySinkParams& aParams, |
|
435 // TBool& aUpdated ) |
|
436 // ----------------------------------------------------------------------------- |
|
437 // |
|
438 void CDisplaySink::UpdateSinkParamsL( |
|
439 const TDisplaySinkParams& aParams, TBool& aUpdated ) |
|
440 { |
|
441 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::UpdateSinkParamsL()<"), RThread().Id().operator TUint())); |
|
442 // This modification was requested by the VT engine team |
|
443 iReleased = EFalse; |
|
444 // This modification was requested by the VT engine team |
|
445 iBitmapCS.Wait(); |
|
446 BaseUpdateSinkParamsL( aParams ); |
|
447 aUpdated = EFalse; |
|
448 iParamsUpdated = &aUpdated; |
|
449 iDSFlags = aParams.iFlags; |
|
450 BitmapEntry( EFirstBitmap ).iIsFree = EFalse; |
|
451 BitmapEntry( ESecondBitmap ).iIsFree = EFalse; |
|
452 iVideoFrameQueue->Release(); |
|
453 iBitmapCS.Signal(); |
|
454 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::UpdateSinkParamsL()>"), RThread().Id().operator TUint())); |
|
455 } |
|
456 |
|
457 // ----------------------------------------------------------------------------- |
|
458 // CDisplaySink::Pause() |
|
459 // ----------------------------------------------------------------------------- |
|
460 // |
|
461 void CDisplaySink::Pause() |
|
462 { |
|
463 iBitmapCS.Wait(); |
|
464 iPaused = ETrue; |
|
465 iVideoFrameQueue->Release(); |
|
466 iBitmapCS.Signal(); |
|
467 } |
|
468 |
|
469 // ----------------------------------------------------------------------------- |
|
470 // CDisplaySink::Resume() |
|
471 // ----------------------------------------------------------------------------- |
|
472 // |
|
473 void CDisplaySink::Resume() |
|
474 { |
|
475 iBitmapCS.Wait(); |
|
476 iPaused = EFalse; |
|
477 iBitmapCS.Signal(); |
|
478 } |
|
479 |
|
480 // ----------------------------------------------------------------------------- |
|
481 // CDisplaySink::operator MVTVideoSink&() |
|
482 // ----------------------------------------------------------------------------- |
|
483 // |
|
484 CDisplaySink::operator MVTVideoSink&() |
|
485 { |
|
486 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::operator MVTVideoSink&()<"), RThread().Id().operator TUint())); |
|
487 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::operator MVTVideoSink&()>"), RThread().Id().operator TUint())); |
|
488 return *this; |
|
489 } |
|
490 |
|
491 // ----------------------------------------------------------------------------- |
|
492 // CDisplaySink::NextFrame |
|
493 // ----------------------------------------------------------------------------- |
|
494 // |
|
495 void CDisplaySink::NextFrame() |
|
496 { |
|
497 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::NextFrame()<"), RThread().Id().operator TUint())); |
|
498 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::NextFrame()>"), RThread().Id().operator TUint())); |
|
499 } |
|
500 |
|
501 // ----------------------------------------------------------------------------- |
|
502 // CDisplaySink::GetMultimediaTypesL() const |
|
503 // ----------------------------------------------------------------------------- |
|
504 // |
|
505 const RArray<TDesC8* >& CDisplaySink::GetMultimediaTypesL() const |
|
506 { |
|
507 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::GetMultimediaTypeL()<"), RThread().Id().operator TUint())); |
|
508 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::GetMultimediaTypeL()>"), RThread().Id().operator TUint())); |
|
509 return iVTMimeTypes; |
|
510 } |
|
511 |
|
512 |
|
513 |
|
514 // ----------------------------------------------------------------------------- |
|
515 // CDisplaySink::SetFormatL |
|
516 // ----------------------------------------------------------------------------- |
|
517 // |
|
518 void CDisplaySink::SetFormatL( const TDesC8& aFormat ) |
|
519 { |
|
520 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetFormatL()<"), RThread().Id().operator TUint())); |
|
521 if ( aFormat != KVtVideoMIMETypeYUV420 ) |
|
522 { |
|
523 User::Leave( KErrNotSupported ); |
|
524 } |
|
525 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetFormatL()>"), RThread().Id().operator TUint())); |
|
526 } |
|
527 |
|
528 // ----------------------------------------------------------------------------- |
|
529 // CDisplaySink::SetVideoFrameSizeL |
|
530 // ----------------------------------------------------------------------------- |
|
531 // |
|
532 void CDisplaySink::SetVideoFrameSizeL( const TSize& aSize ) |
|
533 { |
|
534 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetVideoFrameSizeL()<"), RThread().Id().operator TUint())); |
|
535 if ( iInitFlags & ESinkThreadLogonCalled ) |
|
536 { |
|
537 SinkThreadLogonL(); |
|
538 } |
|
539 if ( iInitFlags & EFbsSessionConnected ) |
|
540 { |
|
541 TSize size( aSize ); |
|
542 BaseSetVideoFrameSizeL( aSize ); |
|
543 iFrameSize = aSize; |
|
544 } |
|
545 else |
|
546 { |
|
547 User::Leave( KErrNotReady ); |
|
548 } |
|
549 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetVideoFrameSizeL()>"), RThread().Id().operator TUint())); |
|
550 } |
|
551 |
|
552 // ----------------------------------------------------------------------------- |
|
553 // CDisplaySink::GetVideoFrameSizeL |
|
554 // ----------------------------------------------------------------------------- |
|
555 // |
|
556 void CDisplaySink::GetVideoFrameSizeL( TSize& aSize ) const |
|
557 { |
|
558 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::GetVideoFrameSizeL()<"), RThread().Id().operator TUint())); |
|
559 aSize = iFrameSize; |
|
560 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::GetVideoFrameSizeL()>"), RThread().Id().operator TUint())); |
|
561 } |
|
562 |
|
563 // ----------------------------------------------------------------------------- |
|
564 // CDisplaySink::EmptyBufferL |
|
565 // ----------------------------------------------------------------------------- |
|
566 // |
|
567 void CDisplaySink::EmptyBufferL( |
|
568 TVtMMFDataBuffer aDataBuffer, |
|
569 MVTVideoSource* aSupplier, |
|
570 TMediaId /*aMediaId*/ ) |
|
571 { |
|
572 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL()<"), RThread().Id().operator TUint())); |
|
573 if ( aDataBuffer.GetMMFBuffer() == NULL || aSupplier == NULL ) |
|
574 { |
|
575 User::Leave( KErrArgument ); |
|
576 } |
|
577 if ( iReleased ) |
|
578 { |
|
579 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL(): sink released, just return buffer"), RThread().Id().operator TUint())); |
|
580 aSupplier->BufferEmptiedL( aDataBuffer.GetMMFBuffer() ); |
|
581 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL()>"), RThread().Id().operator TUint())); |
|
582 return; |
|
583 } |
|
584 else if ( iInitFlags & ESinkThreadLogonCalled ) |
|
585 { |
|
586 TRAPD( result, SinkThreadLogonL() ); |
|
587 if ( result != KErrNone ) |
|
588 { |
|
589 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL(): SinkThreadLogonL failed %d"), RThread().Id().operator TUint(), result)); |
|
590 aSupplier->BufferEmptiedL( aDataBuffer.GetMMFBuffer() ); |
|
591 User::Leave( result ); |
|
592 } |
|
593 } |
|
594 if ( aDataBuffer.GetMMFBuffer()->Type() != KVTUidYUVFrameBuffer ) |
|
595 { |
|
596 User::Leave( KErrArgument ); |
|
597 } |
|
598 if ( iState != EPlaying ) |
|
599 { |
|
600 User::Leave( KErrNotReady ); |
|
601 } |
|
602 iBitmapCS.Wait(); |
|
603 |
|
604 CleanupSignalPushL( iBitmapCS ); |
|
605 iBuffer = aDataBuffer.GetMMFBuffer(); |
|
606 iSupplier = aSupplier; |
|
607 if ( IsOkToSendFrame() ) |
|
608 { |
|
609 // Waiting for frame size update? |
|
610 if ( iWaitingForUpdate ) |
|
611 { |
|
612 // Update completed? |
|
613 if ( iVTSignaller->Completed() ) |
|
614 { |
|
615 // YES: If it failed then Leave |
|
616 if ( iVTSignaller->Result() != KErrNone ) |
|
617 { |
|
618 iSupplier->BufferEmptiedL( iBuffer ); |
|
619 User::Leave( iVTSignaller->Result() ); |
|
620 } |
|
621 } |
|
622 else |
|
623 { |
|
624 // NO: Report buffer emptied and return |
|
625 iSupplier->BufferEmptiedL( iBuffer ); |
|
626 CleanupStack::PopAndDestroy(); // iBitmapCS.Signal(); |
|
627 return; |
|
628 } |
|
629 } |
|
630 |
|
631 // Is param update pending? |
|
632 if ( iParamsUpdated ) |
|
633 { |
|
634 // YES: set new params |
|
635 BaseDoUpdateParamsL(); |
|
636 *iParamsUpdated = ETrue; |
|
637 iParamsUpdated = 0; |
|
638 iWaitingForUpdate = EFalse; |
|
639 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL(): params update finished"), RThread().Id().operator TUint())); |
|
640 } |
|
641 |
|
642 // Update YUV data descriptor size based on resolution info. |
|
643 TSize size( aDataBuffer.GetFrameSize() ); |
|
644 TInt length( ( size.iWidth * size.iHeight * 12 ) / 8 ); |
|
645 aDataBuffer.Data().Set( const_cast<TUint8*>( aDataBuffer.Data().Ptr() ), length, length ); |
|
646 // Expected frame size same as received size? |
|
647 if ( !BaseSizesMatch( size ) ) |
|
648 { |
|
649 if ( !iWaitingForUpdate ) |
|
650 { |
|
651 iVTSignaller->VideoFrameSizeChangedL( iExpectedFrameSize, |
|
652 aDataBuffer.GetFrameSize() ); |
|
653 BaseVideoFrameSizeChangedL( aDataBuffer.GetFrameSize() ); |
|
654 iWaitingForUpdate = ETrue; |
|
655 } |
|
656 CleanupStack::PopAndDestroy(); // iBitmapCS.Signal(); |
|
657 iSupplier->BufferEmptiedL( iBuffer ); |
|
658 return; |
|
659 } |
|
660 // All validation done, now it is ok to do implementation specific |
|
661 // empty buffer. |
|
662 BaseEmptyBufferL( aDataBuffer ); |
|
663 |
|
664 // debugging |
|
665 // debugging |
|
666 // debugging |
|
667 |
|
668 //iFC.PrintStatus(); |
|
669 |
|
670 // debugging |
|
671 // debugging |
|
672 // debugging |
|
673 |
|
674 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL()>"), RThread().Id().operator TUint())); |
|
675 // No CleanupStack::PopAndDestroy() here, because cleanup is done in |
|
676 // BaseEmptyBufferL(). Reason behind this decission is that certain |
|
677 // things have to be handled either before or after cleanup and thus |
|
678 // single cleanup here is not enough. |
|
679 return; |
|
680 } |
|
681 else |
|
682 { |
|
683 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL(): dropping frame %d < %d"), RThread().Id().operator TUint(), iMilliSecondsSinceLastFrame, iFrameRateInterval )); |
|
684 iSupplier->BufferEmptiedL( iBuffer ); |
|
685 } |
|
686 CleanupStack::PopAndDestroy(); // iBitmapCS.Signal() |
|
687 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::EmptyBufferL()>"), RThread().Id().operator TUint())); |
|
688 } |
|
689 |
|
690 // ----------------------------------------------------------------------------- |
|
691 // CDisplaySink::BufferFilledL |
|
692 // ----------------------------------------------------------------------------- |
|
693 // |
|
694 void CDisplaySink::BufferFilledL( CMMFBuffer* /*aBuffer*/ ) |
|
695 { |
|
696 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::BufferFilledL()<"), RThread().Id().operator TUint())); |
|
697 User::Leave( KErrNotSupported ); |
|
698 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::BufferFilledL()>"), RThread().Id().operator TUint())); |
|
699 } |
|
700 |
|
701 // ----------------------------------------------------------------------------- |
|
702 // CDisplaySink::CanCreateSinkBuffer |
|
703 // ----------------------------------------------------------------------------- |
|
704 // |
|
705 TBool CDisplaySink::CanCreateSinkBuffer() |
|
706 { |
|
707 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::CanCreateSinkBuffer()<"), RThread().Id().operator TUint())); |
|
708 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::CanCreateSinkBuffer()>"), RThread().Id().operator TUint())); |
|
709 return EFalse; |
|
710 } |
|
711 |
|
712 // ----------------------------------------------------------------------------- |
|
713 // CDisplaySink::CreateSinkBufferL |
|
714 // ----------------------------------------------------------------------------- |
|
715 // |
|
716 CMMFBuffer* CDisplaySink::CreateSinkBufferL( |
|
717 TMediaId /*aMediaId*/, |
|
718 TBool& /*aReference*/ ) |
|
719 { |
|
720 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::CreateSinkBufferL()<"), RThread().Id().operator TUint())); |
|
721 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::CreateSinkBufferL()>"), RThread().Id().operator TUint())); |
|
722 return NULL; |
|
723 } |
|
724 |
|
725 // ----------------------------------------------------------------------------- |
|
726 // CDisplaySink::SinkThreadLogon |
|
727 // ----------------------------------------------------------------------------- |
|
728 // |
|
729 TInt CDisplaySink::SinkThreadLogon( MAsyncEventHandler& /*aEventHandler*/ ) |
|
730 { |
|
731 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogon()<"), RThread().Id().operator TUint())); |
|
732 iInitFlags |= ESinkThreadLogonCalled; |
|
733 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogon()>"), RThread().Id().operator TUint())); |
|
734 return KErrNone; |
|
735 } |
|
736 |
|
737 // ----------------------------------------------------------------------------- |
|
738 // CDisplaySink::SinkThreadLogonL |
|
739 // ----------------------------------------------------------------------------- |
|
740 // |
|
741 void CDisplaySink::SinkThreadLogonL() |
|
742 { |
|
743 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogonL()<"), RThread().Id().operator TUint())); |
|
744 TInt result( FbsStartup() ); |
|
745 if ( result == KErrNone ) |
|
746 { |
|
747 CleanupStack::PushL( TCleanupItem( &SinkThreadLogonCleanup, this ) ); |
|
748 FbsConnectL(); |
|
749 ThreadOpenL(); |
|
750 User::LeaveIfError( iVideoFrameQueue->ThreadLogon() ); |
|
751 BaseSinkThreadLogonL(); |
|
752 iInitFlags &= ~ESinkThreadLogonCalled; |
|
753 CleanupStack::Pop(); // TCleanupItem( &SinkThreadLogonCleanup, this ) |
|
754 } |
|
755 User::LeaveIfError( result ); |
|
756 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogonL()>"), RThread().Id().operator TUint())); |
|
757 } |
|
758 |
|
759 // ----------------------------------------------------------------------------- |
|
760 // CDisplaySink::SinkThreadLogoff |
|
761 // ----------------------------------------------------------------------------- |
|
762 // |
|
763 void CDisplaySink::SinkThreadLogoff() |
|
764 { |
|
765 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogoff()<"), RThread().Id().operator TUint())); |
|
766 BaseSinkThreadLogoff(); |
|
767 iVideoFrameQueue->ThreadLogoff(); |
|
768 ThreadClose(); |
|
769 FbsDisconnect(); |
|
770 iInitFlags = 0; |
|
771 iExpectedFrameSize = TSize(); |
|
772 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogoff()>"), RThread().Id().operator TUint())); |
|
773 } |
|
774 |
|
775 // ----------------------------------------------------------------------------- |
|
776 // CDisplaySink::SinkPrimeL |
|
777 // ----------------------------------------------------------------------------- |
|
778 // |
|
779 TInt CDisplaySink::SinkPrimeL() |
|
780 { |
|
781 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPrimeL()<"), RThread().Id().operator TUint())); |
|
782 if ( iState != EStopped ) |
|
783 { |
|
784 return KErrNone; |
|
785 } |
|
786 iState = EPrimed; |
|
787 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPrimeL()>"), RThread().Id().operator TUint())); |
|
788 return KErrNone; |
|
789 } |
|
790 |
|
791 // ----------------------------------------------------------------------------- |
|
792 // CDisplaySink::SinkPlayL |
|
793 // ----------------------------------------------------------------------------- |
|
794 // |
|
795 TInt CDisplaySink::SinkPlayL() |
|
796 { |
|
797 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPlayL()<"), RThread().Id().operator TUint())); |
|
798 if ( iState != EPrimed ) |
|
799 { |
|
800 User::Leave( KErrNotReady ); |
|
801 } |
|
802 ResetFrameRateLimitter(); |
|
803 iState = EPlaying; |
|
804 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPlayL()>"), RThread().Id().operator TUint())); |
|
805 return KErrNone; |
|
806 } |
|
807 |
|
808 // ----------------------------------------------------------------------------- |
|
809 // CDisplaySink::SinkPauseL |
|
810 // ----------------------------------------------------------------------------- |
|
811 // |
|
812 TInt CDisplaySink::SinkPauseL() |
|
813 { |
|
814 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPauseL()<"), RThread().Id().operator TUint())); |
|
815 if ( iState != EPlaying ) |
|
816 { |
|
817 return KErrNone; |
|
818 } |
|
819 iState = EPrimed; |
|
820 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkPauseL()>"), RThread().Id().operator TUint())); |
|
821 return KErrNone; |
|
822 } |
|
823 |
|
824 // ----------------------------------------------------------------------------- |
|
825 // CDisplaySink::SinkStopL |
|
826 // ----------------------------------------------------------------------------- |
|
827 // |
|
828 TInt CDisplaySink::SinkStopL() |
|
829 { |
|
830 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkStopL()<"), RThread().Id().operator TUint())); |
|
831 if ( iState == EStopped ) |
|
832 { |
|
833 return KErrNone; |
|
834 } |
|
835 iBitmapCS.Wait(); |
|
836 iVideoFrameQueue->SinkStoppedL(); |
|
837 iBitmapCS.Signal(); |
|
838 iState = EStopped; |
|
839 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkStopL()>"), RThread().Id().operator TUint())); |
|
840 return KErrNone; |
|
841 } |
|
842 |
|
843 |
|
844 // ----------------------------------------------------------------------------- |
|
845 // CDisplaySink::CDisplaySink |
|
846 // ----------------------------------------------------------------------------- |
|
847 // |
|
848 CDisplaySink::CDisplaySink() : MVTVideoSink( KNullUid ), |
|
849 iSinkFourCC( 0 ), iState( EStopped ) |
|
850 { |
|
851 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Ctor()<"), RThread().Id().operator TUint())); |
|
852 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::Ctor()>"), RThread().Id().operator TUint())); |
|
853 } |
|
854 |
|
855 // ----------------------------------------------------------------------------- |
|
856 // CDisplaySink::SetFrameRateLimit( |
|
857 // TDisplaySinkParams::TFrameRateLimit aFrameRateLimit ) |
|
858 // ----------------------------------------------------------------------------- |
|
859 // |
|
860 void CDisplaySink::SetFrameRateLimit( |
|
861 TDisplaySinkParams::TFrameRateLimit aFrameRateLimit ) |
|
862 { |
|
863 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetFrameRateLimit()<"), RThread().Id().operator TUint())); |
|
864 iFrameRateInterval = TInt( aFrameRateLimit ); |
|
865 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SetFrameRateLimit()>"), RThread().Id().operator TUint())); |
|
866 } |
|
867 |
|
868 // ----------------------------------------------------------------------------- |
|
869 // CDisplaySink::ResetFrameRateLimitter() |
|
870 // ----------------------------------------------------------------------------- |
|
871 // |
|
872 void CDisplaySink::ResetFrameRateLimitter() |
|
873 { |
|
874 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ResetFrameRateLimitter()<"), RThread().Id().operator TUint())); |
|
875 iMilliSecondsSinceLastFrame = 0; |
|
876 iLastFrameTime = Time::NullTTime(); |
|
877 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ResetFrameRateLimitter()>"), RThread().Id().operator TUint())); |
|
878 } |
|
879 |
|
880 // ----------------------------------------------------------------------------- |
|
881 // CDisplaySink::BufferFilledL |
|
882 // ----------------------------------------------------------------------------- |
|
883 // |
|
884 TBool CDisplaySink::IsOkToSendFrame() |
|
885 { |
|
886 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::IsOkToSendFrame()<"), RThread().Id().operator TUint())); |
|
887 TBool isOkToSendFrame( EFalse ); |
|
888 if( iPaused ) |
|
889 { |
|
890 // nothing to do here because okToSendFrame defaults to EFalse |
|
891 } |
|
892 else if( iFrameRateInterval == TDisplaySinkParams::EFrameRateLimitNone ) |
|
893 { |
|
894 // If no limitation is set -> send frame |
|
895 isOkToSendFrame = ETrue; |
|
896 } |
|
897 else if( iLastFrameTime == Time::NullTTime() ) |
|
898 { |
|
899 // EmptyBufferL() is being called the first time after SinkPlayL() -> |
|
900 // send frame |
|
901 iLastFrameTime.HomeTime(); |
|
902 isOkToSendFrame = ETrue; |
|
903 } |
|
904 else |
|
905 { |
|
906 // Check if enough time has passed since previous frame sent |
|
907 TTime now; |
|
908 now.HomeTime(); |
|
909 TTimeIntervalMicroSeconds interval( |
|
910 now.MicroSecondsFrom( iLastFrameTime ) ); |
|
911 iMilliSecondsSinceLastFrame += I64INT( interval.Int64() ) / 1000; |
|
912 iLastFrameTime = now; |
|
913 if( iMilliSecondsSinceLastFrame >= iFrameRateInterval ) |
|
914 { |
|
915 // Enough time passed -> send frame |
|
916 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::IsOkToSendFrame(): sending frame %d >= %d"), RThread().Id().operator TUint(), iMilliSecondsSinceLastFrame, iFrameRateInterval )); |
|
917 isOkToSendFrame = ETrue; |
|
918 while( iMilliSecondsSinceLastFrame >= iFrameRateInterval ) |
|
919 { |
|
920 iMilliSecondsSinceLastFrame -= iFrameRateInterval; |
|
921 } |
|
922 } |
|
923 } |
|
924 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::IsOkToSendFrame() %d>"), RThread().Id().operator TUint(), isOkToSendFrame)); |
|
925 return isOkToSendFrame; |
|
926 } |
|
927 |
|
928 // ----------------------------------------------------------------------------- |
|
929 // CDisplaySink::FbsConnectL |
|
930 // ----------------------------------------------------------------------------- |
|
931 // |
|
932 void CDisplaySink::FbsConnectL() |
|
933 { |
|
934 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::FbsConnectL()<"), RThread().Id().operator TUint())); |
|
935 if ( !( iInitFlags & EFbsSessionConnected ) ) |
|
936 { |
|
937 User::LeaveIfError( RFbsSession::Connect() ); |
|
938 iInitFlags |= EFbsSessionConnected; |
|
939 } |
|
940 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::FbsConnectL()>"), RThread().Id().operator TUint())); |
|
941 } |
|
942 |
|
943 // ----------------------------------------------------------------------------- |
|
944 // CDisplaySink::ThreadOpenL |
|
945 // ----------------------------------------------------------------------------- |
|
946 // |
|
947 void CDisplaySink::ThreadOpenL() |
|
948 { |
|
949 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ThreadOpenL()<"), RThread().Id().operator TUint())); |
|
950 if ( !( iInitFlags & EThreadOpened ) ) |
|
951 { |
|
952 User::LeaveIfError( iThread.Open( iThreadId ) ); |
|
953 iInitFlags |= EThreadOpened; |
|
954 } |
|
955 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ThreadOpenL()>"), RThread().Id().operator TUint())); |
|
956 } |
|
957 |
|
958 // ----------------------------------------------------------------------------- |
|
959 // CDisplaySink::FbsDisconnect |
|
960 // ----------------------------------------------------------------------------- |
|
961 // |
|
962 void CDisplaySink::FbsDisconnect() |
|
963 { |
|
964 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::FbsDisconnect()<"), RThread().Id().operator TUint())); |
|
965 if ( iInitFlags & EFbsSessionConnected ) |
|
966 { |
|
967 RFbsSession::Disconnect(); |
|
968 iInitFlags &= ~EFbsSessionConnected; |
|
969 } |
|
970 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::FbsDisconnect()>"), RThread().Id().operator TUint())); |
|
971 } |
|
972 |
|
973 // ----------------------------------------------------------------------------- |
|
974 // CDisplaySink::ThreadClose |
|
975 // ----------------------------------------------------------------------------- |
|
976 // |
|
977 void CDisplaySink::ThreadClose() |
|
978 { |
|
979 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ThreadClose()<"), RThread().Id().operator TUint())); |
|
980 if ( iInitFlags & EThreadOpened ) |
|
981 { |
|
982 iThread.Close(); |
|
983 iInitFlags &= ~EThreadOpened; |
|
984 } |
|
985 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::ThreadClose()>"), RThread().Id().operator TUint())); |
|
986 } |
|
987 |
|
988 // ----------------------------------------------------------------------------- |
|
989 // CDisplaySink::SinkThreadLogonCleanup |
|
990 // ----------------------------------------------------------------------------- |
|
991 // |
|
992 void CDisplaySink::SinkThreadLogonCleanup( TAny* aPtr ) |
|
993 { |
|
994 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogonCleanup()<"), RThread().Id().operator TUint())); |
|
995 CDisplaySink* self = reinterpret_cast< CDisplaySink* >( aPtr ); |
|
996 self->iVideoFrameQueue->ThreadLogoff(); |
|
997 self->ThreadClose(); |
|
998 self->FbsDisconnect(); |
|
999 _IFDBG(PRINT(_L("VideoSource[%d]: CDisplaySink::SinkThreadLogonCleanup()>"), RThread().Id().operator TUint())); |
|
1000 } |
|
1001 |
|
1002 // ================= OTHER EXPORTED FUNCTIONS ============== |
|
1003 |
|
1004 // ----------------------------------------------------------------------------- |
|
1005 // CreateSinkL |
|
1006 // ----------------------------------------------------------------------------- |
|
1007 // |
|
1008 EXPORT_C MDisplaySink* CreateSinkL( TDisplaySinkParams& aParams, |
|
1009 const TDesC8& aInitData ) |
|
1010 { |
|
1011 MDisplaySink* sink = NULL; |
|
1012 if (aParams.iFlags & TDisplaySinkParams::EDisplaySinkNGA) |
|
1013 { |
|
1014 sink = CDisplaySinkNGA::NewL( aParams, aInitData ); |
|
1015 } |
|
1016 else if ( FeatureManager::FeatureSupported( KFeatureIdDisplayPost ) && |
|
1017 ( aParams.iFlags & TDisplaySinkParams::EDisplaySinkDP ) ) |
|
1018 { |
|
1019 sink = CDisplaySinkDP::NewL( aParams, aInitData ); |
|
1020 } |
|
1021 else |
|
1022 { |
|
1023 sink = CDisplaySinkDSA::NewL( aParams, aInitData ); |
|
1024 } |
|
1025 return sink; |
|
1026 } |
|
1027 |
|
1028 // End of File |
|
1029 |