|
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: Video Source subsystem. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <e32svr.h> |
|
22 #include <fbs.h> |
|
23 #include "CVSOnboardCameraDataProvider.h" |
|
24 #include "CVSDataSourceImp.h" |
|
25 #include "VSPanic.h" |
|
26 #include "CVSMMFDataBuffer.h" |
|
27 |
|
28 // EXTERNAL FUNCTION PROTOTYPES |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 const TInt KQCIFWidth = 176; |
|
33 const TInt KQCIFHeight = 144; |
|
34 |
|
35 // MACROS |
|
36 #ifdef _DEBUG |
|
37 # define __IF_DEBUG(t) {RDebug::t;} |
|
38 #else |
|
39 # define __IF_DEBUG(t) |
|
40 #endif |
|
41 |
|
42 // ============================ MEMBER FUNCTIONS =============================== |
|
43 |
|
44 // ============================ CProviderErrorNotifierAO ======================= |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CProviderErrorNotifierAO::NewL |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CProviderErrorNotifierAO* CProviderErrorNotifierAO::NewL() |
|
51 { |
|
52 __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::NewL() >>"), RThread().Id().operator TUint())); |
|
53 CProviderErrorNotifierAO* self = new ( ELeave ) CProviderErrorNotifierAO(); |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructL(); |
|
56 CleanupStack::Pop(); // self |
|
57 __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::NewL() <<"), RThread().Id().operator TUint())); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CProviderErrorNotifierAO::~CProviderErrorNotifierAO |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CProviderErrorNotifierAO::~CProviderErrorNotifierAO() |
|
66 { |
|
67 __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::~CProviderErrorNotifierAO() >>"), RThread().Id().operator TUint())); |
|
68 Cancel(); |
|
69 iCS.Close(); |
|
70 __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::~CProviderErrorNotifierAO() <<"), RThread().Id().operator TUint())); |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CProviderErrorNotifierAO::NotifyError |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 void CProviderErrorNotifierAO::NotifyError( |
|
78 MVSDataProviderObserver* aObserver, |
|
79 TInt aError ) |
|
80 { |
|
81 __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::NotifyError() >>"), RThread().Id().operator TUint())); |
|
82 iCS.Wait(); |
|
83 iObserver = aObserver; |
|
84 iError = aError; |
|
85 TRequestStatus* statusP = &iStatus; |
|
86 RThread thread; |
|
87 if( thread.Open( iThreadId ) == KErrNone ) |
|
88 { |
|
89 *statusP = KRequestPending; |
|
90 thread.RequestComplete( statusP, KErrNone ); |
|
91 thread.Close(); |
|
92 } |
|
93 else |
|
94 { |
|
95 Panic( EVSPanicThreadOpenFailure ); |
|
96 } |
|
97 __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::NotifyError() <<"), RThread().Id().operator TUint())); |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CProviderErrorNotifierAO::CProviderErrorNotifierAO |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 CProviderErrorNotifierAO::CProviderErrorNotifierAO() : |
|
105 CActive( EPriorityNormal ) |
|
106 { |
|
107 __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::CProviderErrorNotifierAO() >>"), RThread().Id().operator TUint())); |
|
108 CActiveScheduler::Add( this ); |
|
109 __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::CProviderErrorNotifierAO() <<"), RThread().Id().operator TUint())); |
|
110 } |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // CProviderErrorNotifierAO::ConstructL |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 void CProviderErrorNotifierAO::ConstructL() |
|
117 { |
|
118 __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::ConstructL() >>"), RThread().Id().operator TUint())); |
|
119 iCS.CreateLocal(); |
|
120 iThreadId = RThread().Id(); |
|
121 iStatus = KRequestPending; |
|
122 SetActive(); |
|
123 __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::ConstructL() <<"), RThread().Id().operator TUint())); |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CProviderErrorNotifierAO::DoCancel |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 void CProviderErrorNotifierAO::DoCancel() |
|
131 { |
|
132 __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::DoCancel() >>"), RThread().Id().operator TUint())); |
|
133 if( iStatus == KRequestPending ) |
|
134 { |
|
135 TRequestStatus* status = &iStatus; |
|
136 User::RequestComplete( status, KErrCancel ); |
|
137 } |
|
138 __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::DoCancel() <<"), RThread().Id().operator TUint())); |
|
139 } |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CProviderErrorNotifierAO::RunL |
|
143 // ----------------------------------------------------------------------------- |
|
144 // |
|
145 void CProviderErrorNotifierAO::RunL() |
|
146 { |
|
147 __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::RunL() >>"), RThread().Id().operator TUint())); |
|
148 TInt err = iStatus.Int(); |
|
149 if ( err == KErrCancel ) |
|
150 { |
|
151 return; |
|
152 } |
|
153 if ( iObserver != NULL ) |
|
154 { |
|
155 iObserver->vsProviderError( iError ); |
|
156 } |
|
157 iStatus = KRequestPending; |
|
158 SetActive(); |
|
159 iCS.Signal(); |
|
160 __IF_DEBUG(Print(_L("VideoSource[%d]: CProviderErrorNotifierAO::RunL() <<"), RThread().Id().operator TUint())); |
|
161 } |
|
162 |
|
163 // ============================ CSyncCameraReserve ============================= |
|
164 |
|
165 // ----------------------------------------------------------------------------- |
|
166 // CSyncCameraReserve::CSyncCameraReserve |
|
167 // ----------------------------------------------------------------------------- |
|
168 // |
|
169 CSyncCameraReserve::CSyncCameraReserve() : CActive( EPriorityNormal ) |
|
170 { |
|
171 __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::CSyncCameraReserve() >>"), RThread().Id().operator TUint())); |
|
172 CActiveScheduler::Add( this ); |
|
173 __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::CSyncCameraReserve() <<"), RThread().Id().operator TUint())); |
|
174 } |
|
175 |
|
176 // ----------------------------------------------------------------------------- |
|
177 // CSyncCameraReserve::StartL |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 void CSyncCameraReserve::StartL() |
|
181 { |
|
182 __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::StartL() >>"), RThread().Id().operator TUint())); |
|
183 SetActive(); |
|
184 iStatus = KRequestPending; |
|
185 iWait.Start(); |
|
186 User::LeaveIfError( iStatus.Int() ); |
|
187 __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::StartL() <<"), RThread().Id().operator TUint())); |
|
188 } |
|
189 |
|
190 // ----------------------------------------------------------------------------- |
|
191 // CSyncCameraReserve::NewL |
|
192 // ----------------------------------------------------------------------------- |
|
193 // |
|
194 CSyncCameraReserve* CSyncCameraReserve::NewL() |
|
195 { |
|
196 __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::NewL() >>"), RThread().Id().operator TUint())); |
|
197 CSyncCameraReserve* self = new ( ELeave ) CSyncCameraReserve(); |
|
198 __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::NewL() <<"), RThread().Id().operator TUint())); |
|
199 return self; |
|
200 } |
|
201 |
|
202 // ----------------------------------------------------------------------------- |
|
203 // CSyncCameraReserve::DoCancel |
|
204 // ----------------------------------------------------------------------------- |
|
205 // |
|
206 void CSyncCameraReserve::DoCancel() |
|
207 { |
|
208 __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::DoCancel() >>"), RThread().Id().operator TUint())); |
|
209 __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::DoCancel() <<"), RThread().Id().operator TUint())); |
|
210 } |
|
211 |
|
212 // ----------------------------------------------------------------------------- |
|
213 // CSyncCameraReserve::RunL |
|
214 // ----------------------------------------------------------------------------- |
|
215 // |
|
216 void CSyncCameraReserve::RunL() |
|
217 { |
|
218 __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::RunL() >>"), RThread().Id().operator TUint())); |
|
219 iWait.AsyncStop(); |
|
220 __IF_DEBUG(Print(_L("VideoSource[%d]: CSyncCameraReserve::RunL() <<"), RThread().Id().operator TUint())); |
|
221 } |
|
222 |
|
223 // ============================ CVSOnboardCameraDataProvider =================== |
|
224 |
|
225 // ----------------------------------------------------------------------------- |
|
226 // CVSOnboardCameraDataProvider::CVSOnboardCameraDataProvider |
|
227 // ----------------------------------------------------------------------------- |
|
228 // |
|
229 CVSOnboardCameraDataProvider::CVSOnboardCameraDataProvider( |
|
230 MVSDataProviderObserver* aObserver, MVSBufferPool* aPool ) : |
|
231 CVSCameraDataProvider( aObserver, aPool ),iCameraLost( EFalse ) |
|
232 { |
|
233 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::CVSOnboardCameraDataProvider() >>"), RThread().Id().operator TUint())); |
|
234 iState = EStopped; |
|
235 iFormat = CCamera::EFormatYUV420Planar; |
|
236 iDublicatedBitmap = new CFbsBitmap(); |
|
237 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::CVSOnboardCameraDataProvider() <<"), RThread().Id().operator TUint())); |
|
238 } |
|
239 |
|
240 // ----------------------------------------------------------------------------- |
|
241 // CVSOnboardCameraDataProvider::~CVSOnboardCameraDataProvider |
|
242 // ----------------------------------------------------------------------------- |
|
243 // |
|
244 CVSOnboardCameraDataProvider::~CVSOnboardCameraDataProvider() |
|
245 { |
|
246 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::~CVSOnboardCameraDataProvider() >>"), RThread().Id().operator TUint())); |
|
247 delete iDublicatedBitmap; |
|
248 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::~CVSOnboardCameraDataProvider() <<"), RThread().Id().operator TUint())); |
|
249 } |
|
250 |
|
251 // ----------------------------------------------------------------------------- |
|
252 // CVSOnboardCameraDataProvider::PrimeL |
|
253 // ----------------------------------------------------------------------------- |
|
254 // |
|
255 void CVSOnboardCameraDataProvider::PrimeL() |
|
256 { |
|
257 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::PrimeL() >>"), RThread().Id().operator TUint())); |
|
258 |
|
259 const TBool primeable( iCameraDuplicate && ( iState == EStopped ) ); |
|
260 |
|
261 if ( !primeable ) |
|
262 { |
|
263 User::Leave( KErrNotReady ); |
|
264 } |
|
265 |
|
266 iAsynchronousReserveIssued = EFalse; |
|
267 iCameraDuplicate->Reserve(); |
|
268 iSyncReserve->StartL(); // Returns when from ReserveComplete() has been |
|
269 // signalled iSyncReserve |
|
270 |
|
271 // Reserve ok, prepare capture next |
|
272 iCameraDuplicate->PrepareVideoCaptureL( |
|
273 iFormat, |
|
274 iFrameSizeIndex, |
|
275 iFrameRateIndex, |
|
276 2, |
|
277 1 ); |
|
278 |
|
279 SetVideoFrameSizeL( TSize( KQCIFWidth, KQCIFHeight ) ); |
|
280 |
|
281 iState = EPrimed; |
|
282 |
|
283 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::PrimeL() <<"), RThread().Id().operator TUint())); |
|
284 } |
|
285 |
|
286 // ----------------------------------------------------------------------------- |
|
287 // CVSOnboardCameraDataProvider::FillBufferL |
|
288 // ----------------------------------------------------------------------------- |
|
289 // |
|
290 void CVSOnboardCameraDataProvider::FillBufferL( |
|
291 CMMFBuffer* /*aBuffer*/, |
|
292 MVTVideoSink* /*aConsumer*/, |
|
293 TMediaId /*aMediaId*/ ) |
|
294 { |
|
295 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::FillBufferL() >>"), RThread().Id().operator TUint())); |
|
296 if ( iState != EPlaying ) |
|
297 { |
|
298 User::Leave( KErrNotReady ); |
|
299 } |
|
300 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::FillBufferL() <<"), RThread().Id().operator TUint())); |
|
301 } |
|
302 |
|
303 // ----------------------------------------------------------------------------- |
|
304 // CVSOnboardCameraDataProvider::BufferEmptiedL |
|
305 // ----------------------------------------------------------------------------- |
|
306 // |
|
307 void CVSOnboardCameraDataProvider::BufferEmptiedL( CMMFBuffer* /*aBuffer*/ ) |
|
308 { |
|
309 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::BufferEmptiedL() >>"), RThread().Id().operator TUint())); |
|
310 User::Leave( KErrNotSupported ); |
|
311 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::BufferEmptiedL() <<"), RThread().Id().operator TUint())); |
|
312 } |
|
313 |
|
314 // ----------------------------------------------------------------------------- |
|
315 // CVSOnboardCameraDataProvider::SourceThreadLogon |
|
316 // ----------------------------------------------------------------------------- |
|
317 // |
|
318 TInt CVSOnboardCameraDataProvider::SourceThreadLogon( |
|
319 MAsyncEventHandler& aEventHandler ) |
|
320 { |
|
321 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceThreadLogon() >>"), RThread().Id().operator TUint())); |
|
322 TInt err = KErrNone; |
|
323 iEventHandler = &aEventHandler; |
|
324 if ( iCameraDuplicate ) |
|
325 { |
|
326 Panic( EVSPanicProviderAlreadyInitialized ); |
|
327 } |
|
328 TRAP( err, iCameraDuplicate = |
|
329 CCamera::NewDuplicate2L( (MCameraObserver2&)*this, iCameraHandle) ); |
|
330 |
|
331 if ( err != KErrNone ) |
|
332 { |
|
333 TRAP( err, iCameraDuplicate = |
|
334 CCamera::NewDuplicateL( (MCameraObserver&)*this, iCameraHandle) ); |
|
335 if (err != KErrNone) |
|
336 { |
|
337 return err; |
|
338 } |
|
339 } |
|
340 iCameraLost = EFalse; |
|
341 |
|
342 TCameraInfo info; |
|
343 iCameraDuplicate->CameraInfo( info ); |
|
344 if ( !(info.iOptionsSupported & TCameraInfo::EVideoCaptureSupported) ) |
|
345 { |
|
346 delete iCameraDuplicate; |
|
347 iCameraDuplicate = NULL; |
|
348 return KErrNotSupported; |
|
349 } |
|
350 if ( iSyncReserve == NULL ) |
|
351 { |
|
352 TRAP( err, iSyncReserve = CSyncCameraReserve::NewL() ); |
|
353 if ( err != KErrNone ) |
|
354 { |
|
355 delete iCameraDuplicate; |
|
356 iCameraDuplicate = NULL; |
|
357 } |
|
358 } |
|
359 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceThreadLogon() <<"), RThread().Id().operator TUint())); |
|
360 return err; |
|
361 } |
|
362 |
|
363 // ----------------------------------------------------------------------------- |
|
364 // CVSOnboardCameraDataProvider::SourceThreadLogoff |
|
365 // ----------------------------------------------------------------------------- |
|
366 // |
|
367 void CVSOnboardCameraDataProvider::SourceThreadLogoff() |
|
368 { |
|
369 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceThreadLogoff() >>"), RThread().Id().operator TUint())); |
|
370 delete iCameraDuplicate; |
|
371 iCameraDuplicate = NULL; |
|
372 iState = EStopped; |
|
373 delete iSyncReserve; |
|
374 iSyncReserve = NULL; |
|
375 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceThreadLogoff() <<"), RThread().Id().operator TUint())); |
|
376 } |
|
377 |
|
378 // ----------------------------------------------------------------------------- |
|
379 // CVSOnboardCameraDataProvider::SourcePrimeL |
|
380 // ----------------------------------------------------------------------------- |
|
381 // |
|
382 void CVSOnboardCameraDataProvider::SourcePrimeL() |
|
383 { |
|
384 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePrimeL() >>"), RThread().Id().operator TUint())); |
|
385 const TBool primeable( iCameraDuplicate && ( iState == EStopped ) ); |
|
386 if ( !primeable ) |
|
387 { |
|
388 User::Leave( KErrNotReady ); |
|
389 } |
|
390 iAsynchronousReserveIssued = ETrue; |
|
391 iCameraDuplicate->Reserve(); |
|
392 User::Leave( KRequestPending ); |
|
393 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePrimeL() <<"), RThread().Id().operator TUint())); |
|
394 } |
|
395 |
|
396 // ----------------------------------------------------------------------------- |
|
397 // CVSOnboardCameraDataProvider::SourcePlayL |
|
398 // ----------------------------------------------------------------------------- |
|
399 // |
|
400 void CVSOnboardCameraDataProvider::SourcePlayL() |
|
401 { |
|
402 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePlayL() >>"), RThread().Id().operator TUint())); |
|
403 if ( iState != EPrimed ) |
|
404 { |
|
405 User::Leave( KErrNotReady ); |
|
406 } |
|
407 ResetStartTime(); |
|
408 iCameraDuplicate->StartVideoCapture(); |
|
409 iState = EPlaying; |
|
410 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePlayL() <<"), RThread().Id().operator TUint())); |
|
411 } |
|
412 |
|
413 // ----------------------------------------------------------------------------- |
|
414 // CVSOnboardCameraDataProvider::SourcePauseL |
|
415 // ----------------------------------------------------------------------------- |
|
416 // |
|
417 void CVSOnboardCameraDataProvider::SourcePauseL() |
|
418 { |
|
419 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePauseL() >>"), RThread().Id().operator TUint())); |
|
420 if ( iState != EPlaying ) |
|
421 { |
|
422 return; |
|
423 } |
|
424 iCameraDuplicate->StopVideoCapture(); |
|
425 iState = EPrimed; |
|
426 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourcePauseL() <<"), RThread().Id().operator TUint())); |
|
427 } |
|
428 |
|
429 // ----------------------------------------------------------------------------- |
|
430 // CVSOnboardCameraDataProvider::SourceStopL |
|
431 // ----------------------------------------------------------------------------- |
|
432 // |
|
433 void CVSOnboardCameraDataProvider::SourceStopL() |
|
434 { |
|
435 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceStopL() >>"), RThread().Id().operator TUint())); |
|
436 if ( iState == EStopped ) |
|
437 { |
|
438 return; |
|
439 } |
|
440 SourcePauseL(); |
|
441 iCameraDuplicate->Release(); |
|
442 iState = EStopped; |
|
443 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SourceStopL() <<"), RThread().Id().operator TUint())); |
|
444 } |
|
445 |
|
446 // ----------------------------------------------------------------------------- |
|
447 // CVSOnboardCameraDataProvider::SetFormatL |
|
448 // ----------------------------------------------------------------------------- |
|
449 // |
|
450 void CVSOnboardCameraDataProvider::SetFormatL( const TDesC8& aFormat ) |
|
451 { |
|
452 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetFormatL() >>"), RThread().Id().operator TUint())); |
|
453 if ( !iCameraDuplicate ) |
|
454 { |
|
455 User::Leave( KErrBadHandle ); |
|
456 } |
|
457 TCameraInfo info; |
|
458 iCameraDuplicate->CameraInfo( info ); |
|
459 if ( aFormat == KVtVideoMIMETypeYUV420 ) |
|
460 { |
|
461 if ( info.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar ) |
|
462 { |
|
463 iFormat = CCamera::EFormatYUV420Planar; |
|
464 } |
|
465 else |
|
466 { |
|
467 User::Leave( KErrNotSupported ); |
|
468 } |
|
469 } |
|
470 else |
|
471 { |
|
472 User::Leave( KErrNotSupported ); |
|
473 } |
|
474 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetFormatL() <<"), RThread().Id().operator TUint())); |
|
475 } |
|
476 |
|
477 // ----------------------------------------------------------------------------- |
|
478 // CVSOnboardCameraDataProvider::SetFrameRateL |
|
479 // ----------------------------------------------------------------------------- |
|
480 // |
|
481 void CVSOnboardCameraDataProvider::SetFrameRateL( TReal32 aFrameRate ) |
|
482 { |
|
483 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetFrameRateL() >>"), RThread().Id().operator TUint())); |
|
484 if ( !iCameraDuplicate ) |
|
485 { |
|
486 User::Leave( KErrBadHandle ); |
|
487 } |
|
488 TCameraInfo info; |
|
489 iCameraDuplicate->CameraInfo( info ); |
|
490 TBool found = EFalse; |
|
491 for ( TInt i = 0; i < info.iNumVideoFrameRatesSupported; i++ ) |
|
492 { |
|
493 TReal32 rate = 0; |
|
494 iCameraDuplicate->EnumerateVideoFrameRates( |
|
495 rate, |
|
496 i, |
|
497 iFormat, |
|
498 iFrameSizeIndex ); |
|
499 if ( rate == aFrameRate ) |
|
500 { |
|
501 iFrameRateIndex = i; |
|
502 found = ETrue; |
|
503 break; |
|
504 } |
|
505 } |
|
506 if ( !found ) |
|
507 { |
|
508 User::Leave( KErrNotSupported ); |
|
509 } |
|
510 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetFrameRateL() <<"), RThread().Id().operator TUint())); |
|
511 } |
|
512 |
|
513 // ----------------------------------------------------------------------------- |
|
514 // CVSOnboardCameraDataProvider::SetVideoFrameSizeL |
|
515 // ----------------------------------------------------------------------------- |
|
516 // |
|
517 void CVSOnboardCameraDataProvider::SetVideoFrameSizeL( const TSize& aSize ) |
|
518 { |
|
519 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetVideoFrameSizeL() >>"), RThread().Id().operator TUint())); |
|
520 if ( !iCameraDuplicate ) |
|
521 { |
|
522 User::Leave( KErrBadHandle ); |
|
523 } |
|
524 TCameraInfo info; |
|
525 iCameraDuplicate->CameraInfo( info ); |
|
526 TBool found = EFalse; |
|
527 for ( TInt i = 0; i < info.iNumVideoFrameSizesSupported; i++ ) |
|
528 { |
|
529 TSize size; |
|
530 iCameraDuplicate->EnumerateVideoFrameSizes( size, i, iFormat ); |
|
531 if ( size == aSize ) |
|
532 { |
|
533 iFrameSizeIndex = i; |
|
534 iFrameSize = size; |
|
535 found = ETrue; |
|
536 break; |
|
537 } |
|
538 } |
|
539 if ( !found ) |
|
540 { |
|
541 User::Leave( KErrNotSupported ); |
|
542 } |
|
543 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::SetVideoFrameSizeL() <<"), RThread().Id().operator TUint())); |
|
544 } |
|
545 |
|
546 // ----------------------------------------------------------------------------- |
|
547 // CVSOnboardCameraDataProvider::GetVideoFrameSizeL |
|
548 // ----------------------------------------------------------------------------- |
|
549 // |
|
550 void CVSOnboardCameraDataProvider::GetVideoFrameSizeL( TSize& aSize ) const |
|
551 { |
|
552 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::GetVideoFrameSizeL() >>"), RThread().Id().operator TUint())); |
|
553 aSize = iFrameSize; |
|
554 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::GetVideoFrameSizeL() <<"), RThread().Id().operator TUint())); |
|
555 } |
|
556 |
|
557 // ----------------------------------------------------------------------------- |
|
558 // CVSOnboardCameraDataProvider::ReserveComplete |
|
559 // ----------------------------------------------------------------------------- |
|
560 // |
|
561 void CVSOnboardCameraDataProvider::ReserveComplete( TInt aError ) |
|
562 { |
|
563 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ReserveComplete() >>"), RThread().Id().operator TUint())); |
|
564 if ( !iReserverComplete ) |
|
565 { |
|
566 if ( aError == KErrNone ) |
|
567 { |
|
568 iReserverComplete = ETrue; |
|
569 Camera().PowerOn(); |
|
570 } |
|
571 else |
|
572 { |
|
573 NotifyError( aError ); |
|
574 } |
|
575 } |
|
576 else |
|
577 { |
|
578 if( iAsynchronousReserveIssued ) |
|
579 { |
|
580 iAsynchronousReserveIssued = EFalse; |
|
581 |
|
582 if( aError == KErrNone && iCameraDuplicate ) |
|
583 { |
|
584 // Reserve ok, prepare capture next |
|
585 TRAP( |
|
586 aError, |
|
587 iCameraDuplicate->PrepareVideoCaptureL( |
|
588 iFormat, |
|
589 iFrameSizeIndex, |
|
590 iFrameRateIndex, |
|
591 2, |
|
592 1 ) ); |
|
593 |
|
594 if( aError == KErrNone ) |
|
595 { |
|
596 TRAP( aError, SetVideoFrameSizeL( TSize( KQCIFWidth, KQCIFHeight ) ) ); |
|
597 |
|
598 if( aError == KErrNone ) |
|
599 { |
|
600 // Everything ok in PrimeL() |
|
601 iState = EPrimed; |
|
602 } |
|
603 } |
|
604 } |
|
605 TMMFEvent event( TUid::Uid( KVtUidDataSrcPrime ), aError ); |
|
606 iEventHandler->SendEventToClient( event ); |
|
607 } |
|
608 else |
|
609 { |
|
610 TRequestStatus* statusP = &iSyncReserve->iStatus; |
|
611 User::RequestComplete( statusP, aError ); |
|
612 } |
|
613 } |
|
614 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ReserveComplete() <<"), RThread().Id().operator TUint())); |
|
615 } |
|
616 |
|
617 // ----------------------------------------------------------------------------- |
|
618 // CVSOnboardCameraDataProvider::FrameBufferReady |
|
619 // ----------------------------------------------------------------------------- |
|
620 // |
|
621 void CVSOnboardCameraDataProvider::FrameBufferReady( |
|
622 MFrameBuffer* aFrameBuffer, |
|
623 TInt aError ) |
|
624 { |
|
625 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::FrameBufferReady() >>"), RThread().Id().operator TUint())); |
|
626 |
|
627 iFreezeCS.Wait(); |
|
628 |
|
629 if ( aError == KErrNone ) |
|
630 { |
|
631 if( iFreezePendingFlags & EVideoFrameFreezePending ) |
|
632 { |
|
633 FreezeFrame( aFrameBuffer ); |
|
634 } |
|
635 |
|
636 CVSMMFDataBuffer* buffer = NULL; |
|
637 |
|
638 TRAPD( err, buffer = BufferPool().GetBufferL( ETrue ) ); |
|
639 |
|
640 if( err == KErrNone ) |
|
641 { |
|
642 if ( buffer ) |
|
643 { |
|
644 MFrameBuffer* frameBufferToBeUsed = aFrameBuffer; |
|
645 |
|
646 if( IsFrozen() && !( iFreezePendingFlags & EVideoFrameFreezePending ) ) |
|
647 { |
|
648 iFrozenFrame->CopyProperties( aFrameBuffer ); |
|
649 aFrameBuffer->Release(); |
|
650 frameBufferToBeUsed = iFrozenFrame; |
|
651 } |
|
652 |
|
653 TRAP( err, buffer->SetFrameBufferL( frameBufferToBeUsed ) ); |
|
654 |
|
655 if ( err != KErrNone ) |
|
656 { |
|
657 TInt leaveCode = KErrNone; |
|
658 TRAP( leaveCode, BufferPool().FreeBufferL( buffer ) ); |
|
659 } |
|
660 else |
|
661 { |
|
662 buffer->SetTimeToPlay( TimeToPlay() ); |
|
663 buffer->SetFrameNumber( aFrameBuffer->iIndexOfFirstFrameInBuffer ); |
|
664 TRAP( err, Consumer()->BufferFilledL( buffer ) ); |
|
665 if ( err != KErrNone ) |
|
666 { |
|
667 TInt leaveCode = KErrNone; |
|
668 TRAP( leaveCode, BufferPool().FreeBufferL( buffer ) ); |
|
669 } |
|
670 } |
|
671 } |
|
672 else |
|
673 { |
|
674 aFrameBuffer->Release(); |
|
675 } |
|
676 } |
|
677 |
|
678 if( err != KErrNone ) |
|
679 { |
|
680 NotifyError( err ); |
|
681 } |
|
682 } |
|
683 else |
|
684 { |
|
685 NotifyError( aError ); |
|
686 } |
|
687 |
|
688 iFreezeCS.Signal(); |
|
689 |
|
690 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::FrameBufferReady() <<"), RThread().Id().operator TUint())); |
|
691 } |
|
692 |
|
693 // ----------------------------------------------------------------------------- |
|
694 // CVSOnboardCameraDataProvider::GetVideoFrameSize |
|
695 // ----------------------------------------------------------------------------- |
|
696 // |
|
697 void CVSOnboardCameraDataProvider::GetVideoFrameSize( |
|
698 TSize& aSize, |
|
699 TInt aSizeIndex, |
|
700 const TDesC8& aFormat ) |
|
701 { |
|
702 __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::GetVideoFrameSize() >>"), RThread().Id().operator TUint())); |
|
703 TCameraInfo info; |
|
704 Camera().CameraInfo( info ); |
|
705 if ( aFormat == KVtVideoMIMETypeYUV420 ) |
|
706 { |
|
707 if ( info.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar ) |
|
708 { |
|
709 Camera().EnumerateVideoFrameSizes( aSize, aSizeIndex, CCamera::EFormatYUV420Planar ); |
|
710 } |
|
711 else |
|
712 { |
|
713 aSize.SetSize( 0, 0 ); |
|
714 } |
|
715 } |
|
716 else |
|
717 { |
|
718 aSize.SetSize( 0, 0 ); |
|
719 } |
|
720 __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::GetVideoFrameSize() <<"), RThread().Id().operator TUint())); |
|
721 } |
|
722 |
|
723 // ----------------------------------------------------------------------------- |
|
724 // CVSOnboardCameraDataProvider::GetVideoFrameRate |
|
725 // ----------------------------------------------------------------------------- |
|
726 // |
|
727 void CVSOnboardCameraDataProvider::GetVideoFrameRate( |
|
728 TReal32& aRate, |
|
729 TInt aRateIndex, |
|
730 const TDesC8& aFormat, |
|
731 const TSize& aSize ) |
|
732 { |
|
733 __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::GetVideoFrameRate() >>"), RThread().Id().operator TUint())); |
|
734 TCameraInfo info; |
|
735 Camera().CameraInfo( info ); |
|
736 if ( aFormat == KVtVideoMIMETypeYUV420 ) |
|
737 { |
|
738 if ( info.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar ) |
|
739 { |
|
740 TBool found = EFalse; |
|
741 for ( TInt i = 0; i < info.iNumVideoFrameSizesSupported; i++ ) |
|
742 { |
|
743 TSize size; |
|
744 Camera().EnumerateVideoFrameSizes( |
|
745 size, |
|
746 i, |
|
747 CCamera::EFormatYUV420Planar ); |
|
748 if ( size == aSize ) |
|
749 { |
|
750 Camera().EnumerateVideoFrameRates( |
|
751 aRate, |
|
752 aRateIndex, |
|
753 CCamera::EFormatYUV420Planar, |
|
754 i ); |
|
755 found = ETrue; |
|
756 break; |
|
757 } |
|
758 } |
|
759 if ( !found ) |
|
760 { |
|
761 aRate = 0.0; |
|
762 } |
|
763 } |
|
764 else |
|
765 { |
|
766 aRate = 0.0; |
|
767 } |
|
768 } |
|
769 else |
|
770 { |
|
771 aRate = 0.0; |
|
772 } |
|
773 __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::GetVideoFrameRate() <<"), RThread().Id().operator TUint())); |
|
774 } |
|
775 |
|
776 // ----------------------------------------------------------------------------- |
|
777 // CVSOnboardCameraDataProvider::FreezeFrame |
|
778 // ----------------------------------------------------------------------------- |
|
779 // |
|
780 void CVSOnboardCameraDataProvider::FreezeFrame( MFrameBuffer* aFrameBuffer ) |
|
781 { |
|
782 __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::FreezeFrame() >>"), RThread().Id().operator TUint())); |
|
783 |
|
784 TRAPD( error, iFrozenFrame->CopyFrameL( aFrameBuffer ) ); |
|
785 |
|
786 if( error != KErrNone ) |
|
787 { |
|
788 Observer().vsProviderError( error ); |
|
789 } |
|
790 else |
|
791 { |
|
792 iFreezePendingFlags &= ~EVideoFrameFreezePending; |
|
793 } |
|
794 |
|
795 __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::FreezeFrame() <<"), RThread().Id().operator TUint())); |
|
796 } |
|
797 // ----------------------------------------------------------------------------- |
|
798 // CVSOnboardCameraDataProvider::FreezeFrame |
|
799 // ----------------------------------------------------------------------------- |
|
800 // |
|
801 void CVSOnboardCameraDataProvider::FreezeFrame( MCameraBuffer* aCameraBuffer ) |
|
802 { |
|
803 __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::FreezeFrame() >>"), RThread().Id().operator TUint())); |
|
804 |
|
805 TRAPD( error, iFrozenFrame->CopyFrameL( aCameraBuffer ) ); |
|
806 |
|
807 if( error != KErrNone ) |
|
808 { |
|
809 Observer().vsProviderError( error ); |
|
810 } |
|
811 else |
|
812 { |
|
813 iFreezePendingFlags &= ~EVideoFrameFreezePending; |
|
814 } |
|
815 |
|
816 __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::FreezeFrame() <<"), RThread().Id().operator TUint())); |
|
817 } |
|
818 |
|
819 // ----------------------------------------------------------------------------- |
|
820 // CVSOnboardCameraDataProvider::HandleEvent |
|
821 // ----------------------------------------------------------------------------- |
|
822 // |
|
823 void CVSOnboardCameraDataProvider::HandleEvent( const TECAMEvent& aEvent ) |
|
824 { |
|
825 __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() event %d>>"), |
|
826 RThread().Id().operator TUint(), aEvent.iEventType )); |
|
827 __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() iErrorCode %d>"), |
|
828 RThread().Id().operator TUint(), aEvent.iErrorCode )); |
|
829 //Needs to handled first |
|
830 if( aEvent.iEventType == KUidECamEventCameraNoLongerReserved ) |
|
831 { |
|
832 iCameraLost = ETrue; |
|
833 __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() Camera lost>>"), |
|
834 RThread().Id().operator TUint())); |
|
835 NotifyError( KVsErrCameraNoLongerReserved ); |
|
836 } |
|
837 //Do not care errors that occures if camera is lost |
|
838 if ( aEvent.iErrorCode != KErrNone ) |
|
839 { |
|
840 if ( iCameraLost ) |
|
841 { |
|
842 __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() Camera lost error<<"), |
|
843 RThread().Id().operator TUint())); |
|
844 return; |
|
845 } |
|
846 } |
|
847 // Gets called twice for both threads |
|
848 if ( aEvent.iEventType == KUidECamEventReserveComplete ) |
|
849 { |
|
850 ReserveComplete( aEvent.iErrorCode ); |
|
851 } |
|
852 else if( aEvent.iEventType == KUidECamEventPowerOnComplete ) |
|
853 { |
|
854 PowerOnComplete( aEvent.iErrorCode ); |
|
855 } |
|
856 __IF_DEBUG(Print(_L("VideoSource [%d]: CVSOnboardCameraDataProvider::HandleEvent() <<"), RThread().Id().operator TUint())); |
|
857 } |
|
858 |
|
859 // ----------------------------------------------------------------------------- |
|
860 // CVSOnboardCameraDataProvider::ViewFinderReady |
|
861 // ----------------------------------------------------------------------------- |
|
862 // |
|
863 void CVSOnboardCameraDataProvider::ViewFinderReady( MCameraBuffer& aCameraBuffer,TInt aError ) |
|
864 { |
|
865 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ViewFinderReady() error %d >>"), RThread().Id().operator TUint(), aError )); |
|
866 // If error occures notify observer |
|
867 if ( aError != KErrNone && !iCameraLost ) |
|
868 { |
|
869 NotifyError( aError ); |
|
870 return; |
|
871 } |
|
872 // If camera has been lost do nothing |
|
873 // because event to indicate cameralost has come or is coming |
|
874 else if ( iCameraLost ) |
|
875 { |
|
876 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ViewFinderReady() Camera lost<<"), |
|
877 RThread().Id().operator TUint())); |
|
878 return; |
|
879 } |
|
880 // If there is more than 1 frame in buffer |
|
881 // something has went wrong and error (-38) has occured |
|
882 if ( aCameraBuffer.NumFrames() > 1 ) |
|
883 { |
|
884 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ViewFinderReady() FRAMES [%d] IN BUFFER >>"), |
|
885 RThread().Id().operator TUint(), aCameraBuffer.NumFrames())); |
|
886 } |
|
887 |
|
888 //Duplicate camera buffers the newest bitmap |
|
889 //In case of error release buffer and notify observer |
|
890 if ( !iDublicatedBitmap ) |
|
891 { |
|
892 aCameraBuffer.Release(); |
|
893 NotifyError( KErrBadDescriptor ); |
|
894 return; |
|
895 } |
|
896 iDublicatedBitmap->BeginDataAccess(); |
|
897 TRAPD( err, iDublicatedBitmap->Duplicate( aCameraBuffer.BitmapL( aCameraBuffer.NumFrames() - 1 ).Handle() ) ); |
|
898 iDublicatedBitmap->EndDataAccess(); |
|
899 if( err != KErrNone ) |
|
900 { |
|
901 aCameraBuffer.Release(); |
|
902 NotifyError( KErrBadDescriptor ); |
|
903 return; |
|
904 } |
|
905 |
|
906 // Send dublicated bitmap to UI |
|
907 ViewFinderFrameReady( *iDublicatedBitmap ); |
|
908 |
|
909 //Release camera buffer for further usage |
|
910 aCameraBuffer.Release(); |
|
911 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::ViewFinderReady() <<"), |
|
912 RThread().Id().operator TUint())); |
|
913 } |
|
914 |
|
915 // ----------------------------------------------------------------------------- |
|
916 // CVSOnboardCameraDataProvider::VideoBufferReady |
|
917 // ----------------------------------------------------------------------------- |
|
918 // |
|
919 void CVSOnboardCameraDataProvider::VideoBufferReady( MCameraBuffer& aCameraBuffer,TInt aError ) |
|
920 { |
|
921 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() >>"), RThread().Id().operator TUint())); |
|
922 |
|
923 iFreezeCS.Wait(); |
|
924 |
|
925 // If there is more than 1 frame in buffer |
|
926 // print it out |
|
927 // calculate delta which indicates how many frames are skipped |
|
928 TInt delta = 0; |
|
929 if ( aCameraBuffer.NumFrames() > 1 ) |
|
930 { |
|
931 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() FRAMES [%d] IN BUFFER >>"), |
|
932 RThread().Id().operator TUint(), aCameraBuffer.NumFrames())); |
|
933 delta = aCameraBuffer.NumFrames() - 1; |
|
934 } |
|
935 |
|
936 if ( aError == KErrNone ) |
|
937 { |
|
938 if( iFreezePendingFlags & EVideoFrameFreezePending ) |
|
939 { |
|
940 FreezeFrame( &aCameraBuffer ); |
|
941 } |
|
942 |
|
943 CVSMMFDataBuffer* buffer = NULL; |
|
944 |
|
945 TRAPD( err, buffer = BufferPool().GetBufferL( ETrue ) ); |
|
946 |
|
947 if( err == KErrNone ) |
|
948 { |
|
949 if ( buffer ) |
|
950 { |
|
951 MCameraBuffer* cameraBufferToBeUsed = &aCameraBuffer; |
|
952 |
|
953 if( IsFrozen() && !( iFreezePendingFlags & EVideoFrameFreezePending ) ) |
|
954 { |
|
955 iFrozenFrame->CopyProperties( &aCameraBuffer ); |
|
956 ( &aCameraBuffer )->Release(); |
|
957 cameraBufferToBeUsed = iFrozenFrame; |
|
958 } |
|
959 |
|
960 TRAP( err, buffer->SetFrameBufferL( cameraBufferToBeUsed ) ); |
|
961 |
|
962 if ( err != KErrNone ) |
|
963 { |
|
964 TInt leaveCode = KErrNone; |
|
965 TRAP( leaveCode, BufferPool().FreeBufferL( buffer ) ); |
|
966 } |
|
967 else |
|
968 { |
|
969 buffer->SetTimeToPlay( TimeToPlay() ); |
|
970 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() iIndexOfFirstFrameInBuffer [%d]>>"), |
|
971 RThread().Id().operator TUint(), aCameraBuffer.iIndexOfFirstFrameInBuffer + delta)); |
|
972 buffer->SetFrameNumber( ( &aCameraBuffer )->iIndexOfFirstFrameInBuffer + delta ); |
|
973 TRAP( err, Consumer()->BufferFilledL( buffer ) ); |
|
974 if ( err != KErrNone ) |
|
975 { |
|
976 TInt leaveCode = KErrNone; |
|
977 TRAP( leaveCode, BufferPool().FreeBufferL( buffer ) ); |
|
978 } |
|
979 } |
|
980 } |
|
981 else |
|
982 { |
|
983 ( &aCameraBuffer )->Release(); |
|
984 } |
|
985 } |
|
986 else |
|
987 { |
|
988 NotifyError( err ); |
|
989 } |
|
990 } |
|
991 else |
|
992 { |
|
993 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() Camera lost"), |
|
994 RThread().Id().operator TUint())); |
|
995 if ( !iCameraLost ) |
|
996 { |
|
997 NotifyError( aError ); |
|
998 } |
|
999 } |
|
1000 iFreezeCS.Signal(); |
|
1001 |
|
1002 __IF_DEBUG(Print(_L("VideoSource[%d]: CVSOnboardCameraDataProvider::VideoBufferReady() <<"), RThread().Id().operator TUint())); |
|
1003 } |
|
1004 |
|
1005 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
1006 |
|
1007 // End of File |