|
1 /* |
|
2 * Copyright (c) 2002 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 * Creates a video player and starts video preview |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // CLASS HEADER |
|
22 #include "CFLDVideoPlayer.h" |
|
23 |
|
24 // EXTERNAL INCLUDES |
|
25 #include <AknUtils.h> // For AknLayoutUtils |
|
26 #include <AudioPreference.h> // For KAudioPriorityPreview |
|
27 #include <ScreensaverInternalPSKeys.h> |
|
28 |
|
29 // CONSTANTS |
|
30 namespace |
|
31 { |
|
32 const TInt KAscendingVolumeRampInterval( 3000000 ); // 3 seconds |
|
33 const TInt KPhoneVideoVolumeRampStep = 1; |
|
34 // Used to reset inactivity timer so that backlight stays on |
|
35 const TInt KResetInactivityTimerDelay = 2000000; // 2 seconds |
|
36 } |
|
37 |
|
38 // ============================ MEMBER FUNCTIONS =============================== |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // CFLDVideoPlayer::NewL |
|
42 // Two-phased constructor. |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 CFLDVideoPlayer* CFLDVideoPlayer::NewL( TBool aShowErrorMsgs ) |
|
46 { |
|
47 CFLDVideoPlayer* self = new( ELeave ) CFLDVideoPlayer( aShowErrorMsgs ); |
|
48 CleanupStack::PushL( self ); |
|
49 self->ConstructL(); |
|
50 CleanupStack::Pop( self ); // self |
|
51 return self; |
|
52 } |
|
53 |
|
54 // Destructor |
|
55 CFLDVideoPlayer::~CFLDVideoPlayer() |
|
56 { |
|
57 Cancel(); |
|
58 |
|
59 delete iBacklightTimer; |
|
60 |
|
61 if( iVolumeRampTimer ) |
|
62 { |
|
63 delete iVolumeRampTimer; |
|
64 } |
|
65 |
|
66 if( iVideoPlayer ) |
|
67 { |
|
68 delete iVideoPlayer; |
|
69 } |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CFLDVideoPlayer::CFLDVideoPlayer |
|
74 // C++ default constructor can NOT contain any code, that |
|
75 // might leave. |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 CFLDVideoPlayer::CFLDVideoPlayer( TBool aShowErrorMsgs ) |
|
79 : CFLDPlayerBase( aShowErrorMsgs ), |
|
80 iVideoPlayerStatus( EVideoPlayerNotCreated ) |
|
81 { |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CFLDVideoPlayer::ConstructL |
|
86 // Symbian 2nd phase constructor can leave. |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 void CFLDVideoPlayer::ConstructL() |
|
90 { |
|
91 BaseConstructL(); |
|
92 |
|
93 // To allow/not allow screensaver |
|
94 // Errors ignored, no actions needed if API is not available |
|
95 iPropScreenSaver.Attach( KPSUidScreenSaver, KScreenSaverAllowScreenSaver ); |
|
96 |
|
97 // To keep backlight on while a video is being previewed |
|
98 iBacklightTimer = CPeriodic::NewL( EPriorityLow ); |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CFLDVideoPlayer::ProcessFileL |
|
103 // (other items were commented in a header). |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 void CFLDVideoPlayer::ProcessFileL( const TDesC& aFileName, RWindow* aWindow ) |
|
107 { |
|
108 iWindow = aWindow; |
|
109 |
|
110 if ( aFileName == KNullDesC || iFocusLost || !iWindow ) |
|
111 { |
|
112 return; |
|
113 } |
|
114 |
|
115 Cancel(); // Stops possible playback |
|
116 |
|
117 // Do not allow screen saver while playing |
|
118 // Errors ignored, no actions needed if API is not available |
|
119 iPropScreenSaver.Set( KPSUidScreenSaver, |
|
120 KScreenSaverAllowScreenSaver, EFLScreenSaverNotAllowed ); |
|
121 |
|
122 iBacklightTimer->Cancel(); // Just in case |
|
123 // Disable backlight turn off during video preview |
|
124 iBacklightTimer->Start( KResetInactivityTimerDelay, |
|
125 KResetInactivityTimerDelay, |
|
126 TCallBack( DoResetInactivityTimer, NULL ) ); |
|
127 |
|
128 // Screen and clip rectangles to window dimensions |
|
129 TPoint wndPosition( iWindow->AbsPosition() ); |
|
130 TSize wndSize( iWindow->Size() ); |
|
131 |
|
132 // iY and iHeight should be even numbers |
|
133 if( wndPosition.iY % 2 ) |
|
134 { |
|
135 wndPosition.iY = wndPosition.iY + 1; |
|
136 wndSize.iHeight = wndSize.iHeight - 1; |
|
137 } |
|
138 if( wndSize.iHeight % 2 ) |
|
139 { |
|
140 wndSize.iHeight = wndSize.iHeight - 1; |
|
141 } |
|
142 |
|
143 TRect wndRect( wndPosition, wndSize ); |
|
144 |
|
145 if( iVideoPlayer ) |
|
146 { |
|
147 delete iVideoPlayer; |
|
148 iVideoPlayer = NULL; |
|
149 } |
|
150 |
|
151 iVideoPlayer = |
|
152 CVideoPlayerUtility::NewL (*this, KAudioPriorityPreview, |
|
153 TMdaPriorityPreference( iVibra ? KAudioPrefRingFilePreviewVibra : |
|
154 KAudioPrefRingFilePreview ), |
|
155 CCoeEnv::Static()->WsSession(), |
|
156 *(CCoeEnv::Static()->ScreenDevice()), |
|
157 *iWindow, |
|
158 wndRect, |
|
159 wndRect); |
|
160 |
|
161 iVideoPlayerStatus = EVideoPlayerReady; |
|
162 |
|
163 |
|
164 TDataType dataType; |
|
165 TInt error( DataType( aFileName, dataType ) ); |
|
166 if( ( error != KErrNotFound ) && ( error != KErrNone ) ) |
|
167 { |
|
168 User::Leave( error ); |
|
169 } |
|
170 |
|
171 TPtrC ptr( aFileName ); |
|
172 if( error ) |
|
173 { |
|
174 ptr.Set( iDefaultTone ); |
|
175 } |
|
176 |
|
177 iVideoPlayer->OpenFileL( ptr ); |
|
178 iVideoPlayerStatus = EVideoPlayerInitializing; |
|
179 } |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // CFLDVideoPlayer::Cancel |
|
183 // (other items were commented in a header). |
|
184 // ----------------------------------------------------------------------------- |
|
185 // |
|
186 void CFLDVideoPlayer::Cancel() |
|
187 { |
|
188 iBacklightTimer->Cancel(); |
|
189 |
|
190 if( iVolumeRampTimer ) |
|
191 { |
|
192 iVolumeRampTimer->Cancel(); |
|
193 } |
|
194 |
|
195 if( iVideoPlayer ) |
|
196 { |
|
197 iVideoPlayer->Stop(); |
|
198 iVideoPlayer->Close(); |
|
199 iVideoPlayerStatus = EVideoPlayerReady; |
|
200 delete iVideoPlayer; |
|
201 iVideoPlayer = NULL; |
|
202 } |
|
203 |
|
204 // Allow screen saver, unless there's a call ongoing |
|
205 if( !IsCallOngoing() ) |
|
206 { |
|
207 // Errors ignored, no actions needed if API is not available |
|
208 iPropScreenSaver.Set( KPSUidScreenSaver, |
|
209 KScreenSaverAllowScreenSaver, EFLScreenSaverAllowed ); |
|
210 } |
|
211 |
|
212 } |
|
213 |
|
214 // ----------------------------------------------------------------------------- |
|
215 // CFLDVideoPlayer::DoResetInactivityTimer() |
|
216 // (other items were commented in a header). |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 TInt CFLDVideoPlayer::DoResetInactivityTimer( TAny* /*aObject*/ ) |
|
220 { |
|
221 User::ResetInactivityTime(); |
|
222 return KErrNone; |
|
223 } |
|
224 |
|
225 // ----------------------------------------------------------------------------- |
|
226 // CFLDVideoPlayer::DoSetRingingType() |
|
227 // (other items were commented in a header). |
|
228 // ----------------------------------------------------------------------------- |
|
229 // |
|
230 void CFLDVideoPlayer::DoSetRingingType( TInt aRingingType ) |
|
231 { |
|
232 if( iVideoPlayerStatus == EVideoPlayerInitialized ) |
|
233 { |
|
234 switch( aRingingType ) |
|
235 { |
|
236 // Fall through |
|
237 case ERingingTypeRinging: |
|
238 case ERingingTypeSilent: |
|
239 case ERingingTypeRingOnce: |
|
240 { |
|
241 break; |
|
242 } |
|
243 case ERingingTypeAscending: |
|
244 { |
|
245 if ( !iVolumeRampTimer ) |
|
246 { |
|
247 iVolumeRampTimer = CPeriodic::New( CActive::EPriorityStandard ); |
|
248 } |
|
249 |
|
250 if ( iVolumeRampTimer && !iVolumeRampTimer->IsActive() ) |
|
251 { |
|
252 TCallBack cb( VolumeRampTimerCallback, this ); |
|
253 iRampedVolume = KFLDMinVolumeLevel; |
|
254 iVolumeRampTimer->Start( |
|
255 KAscendingVolumeRampInterval, KAscendingVolumeRampInterval, cb ); |
|
256 } |
|
257 break; |
|
258 } |
|
259 |
|
260 default: |
|
261 { |
|
262 break; |
|
263 } |
|
264 } |
|
265 } |
|
266 } |
|
267 |
|
268 // ----------------------------------------------------------------------------- |
|
269 // CFLDVideoPlayer::DoVolumeRamp |
|
270 // (other items were commented in a header). |
|
271 // ----------------------------------------------------------------------------- |
|
272 // |
|
273 TInt CFLDVideoPlayer::DoVolumeRamp() |
|
274 { |
|
275 if ( iRampedVolume < iRingingVolume ) |
|
276 { |
|
277 iRampedVolume = iRampedVolume + KPhoneVideoVolumeRampStep; |
|
278 if ( iRampedVolume >= iRingingVolume ) |
|
279 { |
|
280 // target volume level reached |
|
281 iRampedVolume = iRingingVolume; |
|
282 iVolumeRampTimer->Cancel(); |
|
283 } |
|
284 } |
|
285 |
|
286 TRAP_IGNORE( iVideoPlayer->SetVolumeL( ConvertVolume( iRampedVolume ) ) ); |
|
287 |
|
288 return KErrNone; |
|
289 } |
|
290 |
|
291 // ----------------------------------------------------------------------------- |
|
292 // CFLDVideoPlayer::VolumeRampTimerCallback |
|
293 // (other items were commented in a header). |
|
294 // ----------------------------------------------------------------------------- |
|
295 // |
|
296 TInt CFLDVideoPlayer::VolumeRampTimerCallback( TAny* aObj ) |
|
297 { |
|
298 return static_cast<CFLDVideoPlayer*>( aObj )->DoVolumeRamp(); |
|
299 } |
|
300 |
|
301 // ----------------------------------------------------------------------------- |
|
302 // CFLDVideoPlayer::ConvertVolume() |
|
303 // (other items were commented in a header). |
|
304 // ----------------------------------------------------------------------------- |
|
305 // |
|
306 TInt CFLDVideoPlayer::ConvertVolume( TInt aVolume ) |
|
307 { |
|
308 TInt result( 0 ); |
|
309 TBool audioEnabled( EFalse ); |
|
310 |
|
311 TRAP_IGNORE( audioEnabled = iVideoPlayer->AudioEnabledL() ); |
|
312 |
|
313 if( audioEnabled ) |
|
314 { |
|
315 if ( iVideoPlayerStatus == EVideoPlayerInitialized || |
|
316 iVideoPlayerStatus == EVideoPlayerPlaying ) |
|
317 { |
|
318 result = BaseConvertVolume( aVolume, iVideoPlayer->MaxVolume() ); |
|
319 |
|
320 //if user has selected silent ringing type |
|
321 // or beeb once, set volume off |
|
322 if( ( iRingingType == ERingingTypeSilent ) || |
|
323 ( iRingingType == ERingingTypeBeepOnce ) ) |
|
324 { |
|
325 result = 0; |
|
326 } |
|
327 } |
|
328 } |
|
329 |
|
330 return result; |
|
331 } |
|
332 |
|
333 // ----------------------------------------------------------------------------- |
|
334 // CFLDVideoPlayer::MvpuoOpenComplete |
|
335 // (other items were commented in a header). |
|
336 // ----------------------------------------------------------------------------- |
|
337 // |
|
338 void CFLDVideoPlayer::MvpuoOpenComplete(TInt aError) |
|
339 { |
|
340 if ( !aError && iVideoPlayerStatus == EVideoPlayerInitializing ) |
|
341 { |
|
342 iVideoPlayer->Prepare(); |
|
343 } |
|
344 else |
|
345 { |
|
346 Cancel(); |
|
347 if ( ( aError == KErrNotSupported ) || ( aError == KErrCorrupt ) ) |
|
348 { |
|
349 // Don't care about leave, if the note can't be displayed. |
|
350 TRAP_IGNORE( DisplayErrorNoteL() ); |
|
351 } |
|
352 } |
|
353 } |
|
354 // ----------------------------------------------------------------------------- |
|
355 // CFLDVideoPlayer::MvpuoFrameReady |
|
356 // (other items were commented in a header). |
|
357 // ----------------------------------------------------------------------------- |
|
358 // |
|
359 void CFLDVideoPlayer::MvpuoFrameReady(CFbsBitmap& /*aFrame*/,TInt /*aError*/) |
|
360 { |
|
361 |
|
362 } |
|
363 |
|
364 // ----------------------------------------------------------------------------- |
|
365 // CFLDVideoPlayer::MvpuoEvent |
|
366 // (other items were commented in a header). |
|
367 // ----------------------------------------------------------------------------- |
|
368 // |
|
369 void CFLDVideoPlayer::MvpuoEvent(const TMMFEvent& /*aEvent*/) |
|
370 { |
|
371 |
|
372 } |
|
373 // ----------------------------------------------------------------------------- |
|
374 // CFLDVideoPlayer::MvpuoPrepareComplete |
|
375 // (other items were commented in a header). |
|
376 // ----------------------------------------------------------------------------- |
|
377 // |
|
378 void CFLDVideoPlayer::MvpuoPrepareComplete(TInt aError) |
|
379 { |
|
380 if ( !aError && iVideoPlayerStatus == EVideoPlayerInitializing ) |
|
381 { |
|
382 iVideoPlayerStatus = EVideoPlayerInitialized; |
|
383 DoSetRingingType( iRingingType ); |
|
384 |
|
385 TInt startVolume( KFLDMinVolumeLevel ); |
|
386 if( iRingingType != ERingingTypeAscending ) |
|
387 { |
|
388 startVolume = ConvertVolume( iRingingVolume ); |
|
389 } |
|
390 else |
|
391 { |
|
392 // Ascending starts from minimum volume level |
|
393 startVolume = ConvertVolume( KFLDMinVolumeLevel ); |
|
394 } |
|
395 |
|
396 TRAP_IGNORE( iVideoPlayer->SetVolumeL( startVolume ) ); |
|
397 |
|
398 // Unfortunately SetPriorityL uses always priority/preference |
|
399 // settings which are given in videoPlayer constructor and ONLY |
|
400 // after that sets SetPriorityL parameter to its member data |
|
401 // which leads to a situation that we need to make SetPriorityL |
|
402 // call twice to make new settings effect. |
|
403 TRAP_IGNORE( iVideoPlayer->SetPriorityL( KAudioPriorityPreview, |
|
404 TMdaPriorityPreference( iVibra ? KAudioPrefRingFilePreviewVibra : |
|
405 KAudioPrefRingFilePreview ) ) ); |
|
406 TRAP_IGNORE( iVideoPlayer->SetPriorityL( KAudioPriorityPreview, |
|
407 TMdaPriorityPreference( iVibra ? KAudioPrefRingFilePreviewVibra : |
|
408 KAudioPrefRingFilePreview ) ) ); |
|
409 iVideoPlayer->Play(); |
|
410 iVideoPlayerStatus = EVideoPlayerPlaying; |
|
411 } |
|
412 else |
|
413 { |
|
414 Cancel(); |
|
415 if ( ( aError == KErrNotSupported ) || ( aError == KErrCorrupt ) ) |
|
416 { |
|
417 // Don't care about leave, if the note can't be displayed. |
|
418 TRAP_IGNORE( DisplayErrorNoteL() ); |
|
419 } |
|
420 } |
|
421 } |
|
422 |
|
423 // ----------------------------------------------------------------------------- |
|
424 // CFLDVideoPlayer::MvpuoPlayComplete |
|
425 // (other items were commented in a header). |
|
426 // ----------------------------------------------------------------------------- |
|
427 // |
|
428 void CFLDVideoPlayer::MvpuoPlayComplete(TInt aError) |
|
429 { |
|
430 if ( !aError && iVideoPlayerStatus == EVideoPlayerPlaying ) |
|
431 { |
|
432 if( iRingingType != ERingingTypeRingOnce ) |
|
433 { |
|
434 iVideoPlayer->Play(); |
|
435 } |
|
436 else |
|
437 { |
|
438 Cancel(); |
|
439 iVideoPlayerStatus = EVideoPlayerReady; |
|
440 } |
|
441 } |
|
442 else |
|
443 { |
|
444 Cancel(); |
|
445 if ( ( aError == KErrNotSupported ) || ( aError == KErrCorrupt ) ) |
|
446 { |
|
447 // Don't care about leave, if the note can't be displayed. |
|
448 TRAP_IGNORE( DisplayErrorNoteL() ); |
|
449 } |
|
450 } |
|
451 } |
|
452 |
|
453 // ----------------------------------------------------------------------------- |
|
454 // CFLDVideoPlayer::VideoResolution |
|
455 // (other items were commented in a header). |
|
456 // ----------------------------------------------------------------------------- |
|
457 // |
|
458 TSize CFLDVideoPlayer::VideoFrameSize() const |
|
459 { |
|
460 // Original implementation taken from phone application |
|
461 |
|
462 TSize frameSize( 0,0 ); |
|
463 |
|
464 TRAPD( err, iVideoPlayer->VideoFrameSizeL( frameSize ) ); |
|
465 |
|
466 if ( err != KErrNone ) |
|
467 { |
|
468 return TSize(0,0); |
|
469 } |
|
470 |
|
471 return frameSize; |
|
472 } |
|
473 |
|
474 // ----------------------------------------------------------------------------- |
|
475 // CFLDVideoPlayer::AdjustToWindow |
|
476 // (other items were commented in a header). |
|
477 // ----------------------------------------------------------------------------- |
|
478 // |
|
479 void CFLDVideoPlayer::AdjustToWindow( RWindow& aDisplayWindow ) |
|
480 { |
|
481 // Original implementation taken from phone application |
|
482 |
|
483 // Get video frame dimensions |
|
484 TSize frameSize( VideoFrameSize() ); |
|
485 |
|
486 if ( frameSize.iWidth == 0 || frameSize.iHeight == 0 ) |
|
487 { |
|
488 return; |
|
489 } |
|
490 |
|
491 // Get display dimensions |
|
492 TPoint displayPosition( aDisplayWindow.AbsPosition() ); |
|
493 TSize displaySize( aDisplayWindow.Size() ); |
|
494 TRect displayRect( displayPosition, displaySize ); |
|
495 |
|
496 |
|
497 // To cover display by video: |
|
498 // 1) Video is scaled to be >= display size |
|
499 // 2) If scaled size > display, then video is cropped |
|
500 // Assumption is that video can be scaled to 50,150 or 200 |
|
501 // percent from its original size (can't be scaled freely). |
|
502 |
|
503 ///////////////////////////// |
|
504 // Calculate scaling factor |
|
505 ///////////////////////////// |
|
506 TInt dScaleFactor(100); // use integer arithmetic |
|
507 |
|
508 TInt xDelta( displaySize.iWidth - frameSize.iWidth ); |
|
509 TInt yDelta( displaySize.iHeight - frameSize.iHeight ); |
|
510 |
|
511 if ( xDelta == 0 && yDelta == 0 ) |
|
512 { |
|
513 // correct size, scaling not needed |
|
514 } |
|
515 else if ( xDelta < 0 && yDelta == 0 ) |
|
516 { |
|
517 // wide, but cannot downscale -> just crop |
|
518 } |
|
519 else if ( yDelta < 0 && xDelta == 0 ) |
|
520 { |
|
521 // tall, but cannot downscale -> just crop |
|
522 } |
|
523 else if ( xDelta > 0 && yDelta > 0 ) |
|
524 { |
|
525 // small, narrow and flat -> enlarge |
|
526 TInt xProp( (100 * displaySize.iWidth) / frameSize.iWidth ); |
|
527 TInt yProp( (100 * displaySize.iHeight) / frameSize.iHeight ); |
|
528 |
|
529 dScaleFactor = xProp > yProp ? xProp : yProp; |
|
530 } |
|
531 else if ( xDelta < 0 && yDelta < 0 ) |
|
532 { |
|
533 // large, wide and tall -> downscale |
|
534 TInt xProp( ( 100 * displaySize.iWidth) / frameSize.iWidth ); |
|
535 TInt yProp( ( 100 * displaySize.iHeight) / frameSize.iHeight ); |
|
536 |
|
537 dScaleFactor = xProp > yProp ? xProp : yProp; |
|
538 } |
|
539 else if ( xDelta > 0 && yDelta <= 0 ) |
|
540 { |
|
541 // narrow -> enlarge |
|
542 dScaleFactor = (100 * displaySize.iWidth) / frameSize.iWidth; |
|
543 } |
|
544 else if ( yDelta > 0 && xDelta <= 0 ) |
|
545 { |
|
546 // flat -> enlarge |
|
547 dScaleFactor = (100 * displaySize.iHeight) / frameSize.iHeight; |
|
548 } |
|
549 else |
|
550 { |
|
551 // do nothing |
|
552 } |
|
553 |
|
554 // Convert to float: 0.5, 1.5, 2.0 .. |
|
555 TInt scaleFactor( dScaleFactor / 100 ); |
|
556 TInt remainder( dScaleFactor % 100 ); |
|
557 TReal32 fScaleFactor = (TReal) scaleFactor ; |
|
558 |
|
559 if ( scaleFactor > 0 ) // upscale |
|
560 { |
|
561 if ( remainder > 50 ) |
|
562 { |
|
563 fScaleFactor = fScaleFactor + 1.0; |
|
564 } |
|
565 else if ( remainder > 0 ) |
|
566 { |
|
567 fScaleFactor = fScaleFactor + 0.5; |
|
568 } |
|
569 else // 0 |
|
570 { |
|
571 } |
|
572 } |
|
573 else // downscale |
|
574 { |
|
575 if ( remainder > 50 ) |
|
576 { |
|
577 fScaleFactor = 1.0; |
|
578 } |
|
579 else |
|
580 { |
|
581 fScaleFactor = 0.5; |
|
582 } |
|
583 } |
|
584 |
|
585 //////////////////////////////////////////////// |
|
586 // Calculate scaled frame size (virtual canvas) |
|
587 //////////////////////////////////////////////// |
|
588 TReal32 canvasWidth = fScaleFactor * (TReal32)frameSize.iWidth; |
|
589 TReal32 canvasHeight = fScaleFactor * (TReal32)frameSize.iHeight; |
|
590 TSize canvasSize( (TInt)canvasWidth, (TInt)canvasHeight ); |
|
591 |
|
592 //////////////////////////////////////////////// |
|
593 // Crop by centering displayRect to canvasRect |
|
594 //////////////////////////////////////////////// |
|
595 TRect canvasRect( displayPosition, canvasSize ); |
|
596 TInt offsetX = (displaySize.iWidth - canvasSize.iWidth) / 2; |
|
597 TInt offsetY = (displaySize.iHeight - canvasSize.iHeight) / 2; |
|
598 canvasRect.Move( offsetX, offsetY ); |
|
599 |
|
600 //////////////////////////////////////////////// |
|
601 // Update settings to player |
|
602 //////////////////////////////////////////////// |
|
603 TRAP_IGNORE( iVideoPlayer->SetDisplayWindowL( |
|
604 CCoeEnv::Static()->WsSession(), |
|
605 *CCoeEnv::Static()->ScreenDevice(), |
|
606 aDisplayWindow, |
|
607 canvasRect, |
|
608 displayRect ) ); |
|
609 |
|
610 } |
|
611 |
|
612 // End of File |