1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 // System includes |
|
22 #include <aknviewappui.h> |
|
23 #include <avkon.hrh> |
|
24 #include <manualvideoeditor.rsg> |
|
25 #include <akntitle.h> |
|
26 #include <barsread.h> |
|
27 #include <stringloader.h> |
|
28 #include <aknnotewrappers.h> |
|
29 #include <aknquerydialog.h> |
|
30 #include <aknlists.h> |
|
31 #include <aknPopup.h> |
|
32 #include <AknProgressDialog.h> |
|
33 #include <aknnavide.h> |
|
34 #include <eikbtgpc.h> |
|
35 #include <eikmenub.h> |
|
36 #include <eikmenup.h> |
|
37 #include <eikprogi.h> |
|
38 #include <CAknMemorySelectionDialog.h> |
|
39 #include <CAknFileNamePromptDialog.h> |
|
40 #include <apparc.h> |
|
41 #include <aknselectionlist.h> |
|
42 #include <sysutil.h> |
|
43 |
|
44 // User includes |
|
45 #include "VeiAppUi.h" |
|
46 #include "VeiCutVideoView.h" |
|
47 #include "VeiCutVideoContainer.h" |
|
48 #include "manualvideoeditor.hrh" |
|
49 #include "veitempmaker.h" |
|
50 #include "VeiTimeLabelNavi.h" |
|
51 #include "VeiEditVideoView.h" |
|
52 #include "VideoEditorCommon.h" |
|
53 #include "VeiErrorUi.h" |
|
54 |
|
55 void CVeiCutVideoView::ConstructL() |
|
56 { |
|
57 LOG(KVideoEditorLogFile, "CVeiCutVideoView::ConstructL: in"); |
|
58 |
|
59 BaseConstructL( R_VEI_CUT_VIDEO_VIEW ); |
|
60 |
|
61 CEikStatusPane* sp = StatusPane(); |
|
62 |
|
63 iNaviPane = (CAknNavigationControlContainer*) sp->ControlL( |
|
64 TUid::Uid(EEikStatusPaneUidNavi)); |
|
65 |
|
66 iTimeNavi = CreateTimeLabelNaviL(); |
|
67 |
|
68 iVolumeNavi = iNaviPane->CreateVolumeIndicatorL( |
|
69 R_AVKON_NAVI_PANE_VOLUME_INDICATOR ); |
|
70 |
|
71 iErrorUI = CVeiErrorUI::NewL( *iCoeEnv ); |
|
72 |
|
73 iTimeUpdater = CPeriodic::NewL( CActive::EPriorityLow ); |
|
74 iVolumeHider = CPeriodic::NewL( CActive::EPriorityLow ); |
|
75 |
|
76 LOG(KVideoEditorLogFile, "CVeiCutVideoView::ConstructL: out"); |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------- |
|
80 // CVeiCutVideoView::~CVeiCutVideoView() |
|
81 // ?implementation_description |
|
82 // --------------------------------------------------------- |
|
83 // |
|
84 CVeiCutVideoView::~CVeiCutVideoView() |
|
85 { |
|
86 if ( iProgressNote ) |
|
87 { |
|
88 delete iProgressNote; |
|
89 iProgressNote = NULL; |
|
90 } |
|
91 if ( iContainer ) |
|
92 { |
|
93 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
94 delete iContainer; |
|
95 iContainer = 0; |
|
96 } |
|
97 if ( iTempMovie ) |
|
98 { |
|
99 iTempMovie->Reset(); |
|
100 delete iTempMovie; |
|
101 iTempMovie = NULL; |
|
102 } |
|
103 if ( iTimeUpdater ) |
|
104 { |
|
105 iTimeUpdater->Cancel(); |
|
106 delete iTimeUpdater; |
|
107 } |
|
108 if ( iVolumeHider ) |
|
109 { |
|
110 iVolumeHider->Cancel(); |
|
111 delete iVolumeHider; |
|
112 } |
|
113 |
|
114 if ( iErrorUI ) |
|
115 { |
|
116 delete iErrorUI; |
|
117 } |
|
118 |
|
119 delete iVolumeNavi; |
|
120 |
|
121 delete iTimeNavi; |
|
122 |
|
123 delete iProcessedTempFile; |
|
124 } |
|
125 |
|
126 TUid CVeiCutVideoView::Id() const |
|
127 { |
|
128 return TUid::Uid( EVeiCutVideoView ); |
|
129 } |
|
130 |
|
131 void CVeiCutVideoView::DialogDismissedL( TInt aButtonId ) |
|
132 { |
|
133 if ( aButtonId != EAknSoftkeyDone ) |
|
134 { |
|
135 iTempMovie->CancelProcessing(); |
|
136 } |
|
137 else |
|
138 { |
|
139 if ( iErrorNmb == KErrNone ) |
|
140 { |
|
141 iContainer->SetInTime( iMovie->VideoClipCutInTime( iIndex ) ); |
|
142 iContainer->SetOutTime( iMovie->VideoClipCutOutTime( iIndex ) ); |
|
143 |
|
144 iContainer->GetThumbL( *iProcessedTempFile ); |
|
145 } |
|
146 else |
|
147 { |
|
148 if ( iProcessedTempFile ) // delete temp |
|
149 { |
|
150 iEikonEnv->FsSession().Delete( *iProcessedTempFile ); |
|
151 delete iProcessedTempFile; |
|
152 iProcessedTempFile = NULL; |
|
153 } |
|
154 |
|
155 iErrorUI->ShowGlobalErrorNote( iErrorNmb ); |
|
156 iErrorNmb = 0; |
|
157 HandleCommandL( EVeiCmdCutVideoViewBack ); |
|
158 } |
|
159 } |
|
160 } |
|
161 |
|
162 void CVeiCutVideoView::DynInitMenuPaneL( TInt aResourceId,CEikMenuPane* aMenuPane ) |
|
163 { |
|
164 TInt state = iContainer->State(); |
|
165 |
|
166 if (aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU_CLEAR_MARKS) |
|
167 { |
|
168 // delete in, out, in & out as necessary. |
|
169 |
|
170 if (iMovie->VideoClipCutInTime(iIndex) <= TTimeIntervalMicroSeconds(0)) |
|
171 { |
|
172 aMenuPane->SetItemDimmed(EVeiCmdCutVideoViewClearMarksIn, ETrue); |
|
173 } |
|
174 if (iMovie->VideoClipCutOutTime(iIndex) >= iMovie->VideoClipInfo(iIndex)->Duration()) |
|
175 { |
|
176 aMenuPane->SetItemDimmed(EVeiCmdCutVideoViewClearMarksOut, ETrue); |
|
177 } |
|
178 |
|
179 if (!((iMovie->VideoClipCutOutTime(iIndex) < iMovie->VideoClipInfo(iIndex)->Duration()) |
|
180 && (iMovie->VideoClipCutInTime(iIndex) > TTimeIntervalMicroSeconds(0)))) |
|
181 { |
|
182 aMenuPane->SetItemDimmed(EVeiCmdCutVideoViewClearMarksInOut, ETrue); |
|
183 } |
|
184 } |
|
185 |
|
186 if ( aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU ) |
|
187 { |
|
188 if ( iPopupMenuOpened != EFalse ) |
|
189 { |
|
190 aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewClearMarks, ETrue ); |
|
191 aMenuPane->SetItemDimmed( EVeiCmdCutVideoTakeSnapshot, ETrue ); |
|
192 aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewHelp, ETrue ); |
|
193 } |
|
194 } |
|
195 if ( !(( aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU ) || |
|
196 ( aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU ) ) ) |
|
197 return; |
|
198 |
|
199 if ( iContainer->PlaybackPositionL() >= iContainer->TotalLength() ) |
|
200 { |
|
201 aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewPlay, ETrue ); |
|
202 |
|
203 } |
|
204 if ( ( state == CVeiCutVideoContainer::EStatePaused ) || |
|
205 ( state == CVeiCutVideoContainer::EStateInitializing ) ) |
|
206 { |
|
207 aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewPlay, ETrue ); |
|
208 } |
|
209 |
|
210 if ( ( state != CVeiCutVideoContainer::EStateStopped ) && |
|
211 ( state != CVeiCutVideoContainer::EStateStoppedInitial ) && |
|
212 ( state != CVeiCutVideoContainer::EStatePaused ) ) |
|
213 { |
|
214 aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewPlay, ETrue ); |
|
215 aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewMarkIn, ETrue ); |
|
216 aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewMarkOut, ETrue ); |
|
217 } |
|
218 else |
|
219 { |
|
220 TTimeIntervalMicroSeconds pos = iContainer->PlaybackPositionL(); |
|
221 CVedVideoClipInfo* info = iMovie->VideoClipInfo( iIndex ); |
|
222 |
|
223 TInt cutInFrameIndex = info->GetVideoFrameIndexL( iMovie->VideoClipCutInTime( iIndex )); |
|
224 TInt cutOutFrameIndex = info->GetVideoFrameIndexL( iMovie->VideoClipCutOutTime( iIndex )); |
|
225 TInt videoFrameCount = info->VideoFrameCount(); |
|
226 |
|
227 // if we are in the existing start/end mark position the start/end mark is removed from the menu |
|
228 if (info->GetVideoFrameIndexL(pos) == cutInFrameIndex) |
|
229 { |
|
230 aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkIn ); |
|
231 } |
|
232 else if (info->GetVideoFrameIndexL(pos) == cutOutFrameIndex) |
|
233 { |
|
234 aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkOut ); |
|
235 } |
|
236 |
|
237 if( cutInFrameIndex < (videoFrameCount-1 ) ) |
|
238 { |
|
239 cutInFrameIndex++; |
|
240 } |
|
241 |
|
242 if( cutOutFrameIndex > 0 ) |
|
243 { |
|
244 cutOutFrameIndex--; |
|
245 } |
|
246 |
|
247 TTimeIntervalMicroSeconds nextFramePosCutIn = info->VideoFrameStartTimeL( cutInFrameIndex ); |
|
248 TTimeIntervalMicroSeconds previousFramePosCutOut = info->VideoFrameStartTimeL( cutOutFrameIndex ); |
|
249 |
|
250 if ( pos < nextFramePosCutIn ) |
|
251 { |
|
252 aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkOut ); |
|
253 } |
|
254 else |
|
255 { |
|
256 if ( pos > previousFramePosCutOut ) |
|
257 { |
|
258 aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkIn ); |
|
259 } |
|
260 } |
|
261 // something crashes somewhere outside VED UI if end mark is put to near to begin |
|
262 TInt ind = -1; |
|
263 if (aMenuPane->MenuItemExists(EVeiCmdCutVideoViewMarkOut, ind) && pos.Int64() < KMinCutVideoLength) |
|
264 { |
|
265 aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkOut ); |
|
266 } |
|
267 } |
|
268 if ( ( iMovie->VideoClipCutInTime( iIndex ) == TTimeIntervalMicroSeconds( 0 ) && |
|
269 iMovie->VideoClipCutOutTime( iIndex ) == iMovie->VideoClipInfo( iIndex )->Duration() ) ) |
|
270 { |
|
271 aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewPlayMarked ); |
|
272 } |
|
273 if ( state != CVeiCutVideoContainer::EStatePlayingMenuOpen && |
|
274 state != CVeiCutVideoContainer::EStatePaused ) |
|
275 { |
|
276 aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewContinue ); |
|
277 } |
|
278 if ( ( state == CVeiCutVideoContainer::EStateStopped ) || |
|
279 ( state == CVeiCutVideoContainer::EStateStoppedInitial ) || |
|
280 ( state == CVeiCutVideoContainer::EStateOpening ) || |
|
281 ( state == CVeiCutVideoContainer::EStateBuffering ) ) |
|
282 { |
|
283 aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewStop ); |
|
284 } |
|
285 |
|
286 if ( ( iMovie->VideoClipCutOutTime( iIndex ) >= iMovie->VideoClipInfo( iIndex )->Duration() ) && |
|
287 ( iMovie->VideoClipCutInTime( iIndex ) <= TTimeIntervalMicroSeconds( 0 ) ) ) |
|
288 { |
|
289 aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewClearMarks, ETrue ); |
|
290 } |
|
291 } |
|
292 |
|
293 void CVeiCutVideoView::HandleCommandL(TInt aCommand) |
|
294 { |
|
295 switch ( aCommand ) |
|
296 { |
|
297 case EAknSoftkeyOk: |
|
298 { |
|
299 iPopupMenuOpened = ETrue; |
|
300 if (iContainer->State() == CVeiCutVideoContainer::EStatePlaying) |
|
301 { |
|
302 PausePreviewL(); |
|
303 iContainer->SetStateL(CVeiCutVideoContainer::EStatePlayingMenuOpen); |
|
304 } |
|
305 |
|
306 MenuBar()->TryDisplayMenuBarL(); |
|
307 if (iContainer->State() == CVeiCutVideoContainer::EStatePlayingMenuOpen) |
|
308 { |
|
309 iContainer->SetStateL(CVeiCutVideoContainer::EStatePaused); |
|
310 } |
|
311 iPopupMenuOpened = EFalse; |
|
312 break; |
|
313 } |
|
314 case EVeiCmdCutVideoViewDone: |
|
315 case EVeiCmdCutVideoViewBack: |
|
316 case EAknSoftkeyBack: |
|
317 { |
|
318 StopNaviPaneUpdateL(); |
|
319 |
|
320 iContainer->StopL(); |
|
321 iContainer->CloseStreamL(); |
|
322 |
|
323 // Activate Edit Video view |
|
324 AppUi()->ActivateLocalViewL( TUid::Uid(EVeiEditVideoView) ); |
|
325 break; |
|
326 } |
|
327 |
|
328 case EVeiCmdCutVideoViewMarkIn: |
|
329 { |
|
330 STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )-> |
|
331 SetPauseIconVisibilityL( ETrue ); |
|
332 MarkInL(); |
|
333 break; |
|
334 } |
|
335 case EVeiCmdCutVideoViewMarkOut: |
|
336 { |
|
337 STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )-> |
|
338 SetPauseIconVisibilityL( ETrue ); |
|
339 MarkOutL(); |
|
340 break; |
|
341 } |
|
342 case EVeiCmdCutVideoViewClearMarksInOut: |
|
343 { |
|
344 ClearInOutL( ETrue, ETrue ); |
|
345 break; |
|
346 } |
|
347 case EVeiCmdCutVideoViewClearMarksIn: |
|
348 { |
|
349 ClearInOutL( ETrue, EFalse ); |
|
350 break; |
|
351 } |
|
352 case EVeiCmdCutVideoViewClearMarksOut: |
|
353 { |
|
354 ClearInOutL( EFalse, ETrue ); |
|
355 break; |
|
356 } |
|
357 case EVeiCmdCutVideoViewPlayMarked: |
|
358 { |
|
359 STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )-> |
|
360 SetPauseIconVisibilityL( EFalse ); |
|
361 PlayMarkedL(); |
|
362 break; |
|
363 } |
|
364 case EVeiCmdCutVideoViewPlay: |
|
365 { |
|
366 STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )-> |
|
367 SetPauseIconVisibilityL( EFalse ); |
|
368 iNaviPane->PushL( *iTimeNavi ); |
|
369 |
|
370 PlayPreviewL(); |
|
371 break; |
|
372 } |
|
373 case EVeiCmdCutVideoViewStop: |
|
374 { |
|
375 STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )-> |
|
376 SetPauseIconVisibilityL( EFalse ); |
|
377 iNaviPane->PushL( *iTimeNavi ); |
|
378 StopNaviPaneUpdateL(); |
|
379 iContainer->StopL(); |
|
380 break; |
|
381 } |
|
382 case EVeiCmdCutVideoViewContinue: |
|
383 { |
|
384 STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )-> |
|
385 SetPauseIconVisibilityL( EFalse ); |
|
386 iNaviPane->PushL( *iTimeNavi ); |
|
387 PlayPreviewL(); |
|
388 break; |
|
389 } |
|
390 case EVeiCmdCutVideoTakeSnapshot: |
|
391 { |
|
392 if( IsEnoughFreeSpaceToSaveL() ) |
|
393 { |
|
394 iContainer->TakeSnapshotL(); |
|
395 } |
|
396 break; |
|
397 } |
|
398 // |
|
399 // Options->Help |
|
400 // |
|
401 case EVeiCmdCutVideoViewHelp: |
|
402 { |
|
403 // CS Help launching is handled in Video Editor's AppUi. |
|
404 AppUi()->HandleCommandL( EVeiCmdCutVideoViewHelp ); |
|
405 break; |
|
406 } |
|
407 default: |
|
408 { |
|
409 AppUi()->HandleCommandL( aCommand ); |
|
410 break; |
|
411 } |
|
412 } |
|
413 } |
|
414 |
|
415 void CVeiCutVideoView::NotifyMovieProcessingStartedL( CVedMovie& /*aMovie*/ ) |
|
416 { |
|
417 LOG(KVideoEditorLogFile, "CVeiCutVideoView::NotifyMovieProcessingStartedL: In"); |
|
418 iProgressNote = |
|
419 new (ELeave) CAknProgressDialog(REINTERPRET_CAST(CEikDialog**, |
|
420 &iProgressNote), ETrue); |
|
421 iProgressNote->SetCallback(this); |
|
422 iProgressNote->ExecuteDlgLD( R_VEI_PROGRESS_NOTE_WITH_CANCEL ); |
|
423 |
|
424 HBufC* stringholder; |
|
425 |
|
426 stringholder = StringLoader::LoadL( R_VEI_PROGRESS_NOTE_CUT, iEikonEnv ); |
|
427 CleanupStack::PushL( stringholder ); |
|
428 |
|
429 iProgressNote->SetTextL( *stringholder ); |
|
430 CleanupStack::PopAndDestroy( stringholder ); |
|
431 |
|
432 iProgressInfo = iProgressNote->GetProgressInfoL(); |
|
433 iProgressInfo->SetFinalValue(100); |
|
434 LOG(KVideoEditorLogFile, "CVeiCutVideoView::NotifyMovieProcessingStartedL: Out"); |
|
435 } |
|
436 |
|
437 void CVeiCutVideoView::NotifyMovieProcessingProgressed( CVedMovie& /*aMovie*/, TInt aPercentage ) |
|
438 { |
|
439 iProgressInfo->SetAndDraw( aPercentage ); |
|
440 } |
|
441 |
|
442 void CVeiCutVideoView::NotifyMovieProcessingCompleted( CVedMovie& /*aMovie*/, TInt aError ) |
|
443 { |
|
444 LOGFMT(KVideoEditorLogFile, "CVeiCutVideoView::NotifyMovieProcessingCompleted: In, aError:%d", aError); |
|
445 if ( iTempMovie ) //Effected clip is ready, Delete tempmovie |
|
446 { |
|
447 iTempMovie->Reset(); |
|
448 delete iTempMovie; |
|
449 iTempMovie = NULL; |
|
450 } |
|
451 |
|
452 if ( aError == KErrCancel ) |
|
453 { |
|
454 HandleCommandL( EVeiCmdCutVideoViewBack ); |
|
455 } |
|
456 else |
|
457 { |
|
458 iProgressInfo->SetAndDraw(100); |
|
459 iErrorNmb = aError; |
|
460 iProgressNote->ProcessFinishedL(); |
|
461 } |
|
462 LOG(KVideoEditorLogFile, "CVeiCutVideoView::NotifyMovieProcessingCompleted: Out"); |
|
463 } |
|
464 |
|
465 void CVeiCutVideoView::NotifyVideoClipAdded( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ) |
|
466 { |
|
467 LOG(KVideoEditorLogFile, "CVeiCutVideoView::NotifyVideoClipAdded: In"); |
|
468 |
|
469 iTempMovie->UnregisterMovieObserver( this ); |
|
470 iTempMovie->VideoClipSetColorEffect( 0, iMovie->VideoClipColorEffect( iIndex ) ); |
|
471 iTempMovie->VideoClipSetColorTone( 0, iMovie->VideoClipColorTone( iIndex ) ); |
|
472 iTempMovie->SetVideoClipVolumeGainL( 0, iMovie->GetVideoClipVolumeGainL( iIndex ) ); |
|
473 |
|
474 iProcessedTempFile = HBufC::NewL( KMaxFileName ); |
|
475 |
|
476 TRAPD( err, |
|
477 CVeiTempMaker* maker = CVeiTempMaker::NewL(); |
|
478 maker->GenerateTempFileName( *iProcessedTempFile, iMemoryInUse, iMovie->Format() ); |
|
479 delete maker; |
|
480 ); |
|
481 |
|
482 if ( err == KErrNone ) |
|
483 { |
|
484 TRAP( err, iTempMovie->ProcessL( *iProcessedTempFile, *this ) ); |
|
485 } |
|
486 |
|
487 if ( err != KErrNone ) |
|
488 { |
|
489 iErrorUI->ShowGlobalErrorNote( err ); |
|
490 |
|
491 if ( iProcessedTempFile ) // delete temp |
|
492 { |
|
493 iEikonEnv->FsSession().Delete( *iProcessedTempFile ); |
|
494 delete iProcessedTempFile; |
|
495 iProcessedTempFile = NULL; |
|
496 } |
|
497 } |
|
498 LOG(KVideoEditorLogFile, "CVeiCutVideoView::NotifyVideoClipAdded: Out"); |
|
499 } |
|
500 |
|
501 void CVeiCutVideoView::NotifyVideoClipAddingFailed( CVedMovie& /*aMovie*/, TInt /*aError*/ ) |
|
502 { |
|
503 } |
|
504 |
|
505 void CVeiCutVideoView::NotifyVideoClipRemoved( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ) |
|
506 { |
|
507 } |
|
508 |
|
509 void CVeiCutVideoView::NotifyVideoClipIndicesChanged( CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, |
|
510 TInt /*aNewIndex*/ ) |
|
511 { |
|
512 } |
|
513 |
|
514 void CVeiCutVideoView::NotifyVideoClipTimingsChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ) |
|
515 { |
|
516 } |
|
517 |
|
518 void CVeiCutVideoView::NotifyVideoClipColorEffectChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ) |
|
519 { |
|
520 } |
|
521 |
|
522 void CVeiCutVideoView::NotifyVideoClipAudioSettingsChanged( CVedMovie& /*aMovie*/, |
|
523 TInt /*aIndex*/ ) |
|
524 { |
|
525 } |
|
526 |
|
527 void CVeiCutVideoView::NotifyStartTransitionEffectChanged( CVedMovie& /*aMovie*/ ) |
|
528 { |
|
529 } |
|
530 |
|
531 void CVeiCutVideoView::NotifyMiddleTransitionEffectChanged( CVedMovie& /*aMovie*/, |
|
532 TInt /*aIndex*/ ) |
|
533 { |
|
534 } |
|
535 |
|
536 void CVeiCutVideoView::NotifyEndTransitionEffectChanged( CVedMovie& /*aMovie*/ ) |
|
537 { |
|
538 } |
|
539 |
|
540 void CVeiCutVideoView::NotifyAudioClipAdded( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ) |
|
541 { |
|
542 } |
|
543 |
|
544 void CVeiCutVideoView::NotifyAudioClipAddingFailed( CVedMovie& /*aMovie*/, TInt /*aError*/ ) |
|
545 { |
|
546 } |
|
547 |
|
548 void CVeiCutVideoView::NotifyAudioClipRemoved( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ) |
|
549 { |
|
550 } |
|
551 |
|
552 void CVeiCutVideoView::NotifyAudioClipIndicesChanged( CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, |
|
553 TInt /*aNewIndex*/ ) |
|
554 { |
|
555 } |
|
556 |
|
557 void CVeiCutVideoView::NotifyAudioClipTimingsChanged( CVedMovie& /*aMovie*/, |
|
558 TInt /*aIndex*/ ) |
|
559 { |
|
560 } |
|
561 |
|
562 void CVeiCutVideoView::NotifyMovieReseted( CVedMovie& /*aMovie*/ ) |
|
563 { |
|
564 } |
|
565 |
|
566 void CVeiCutVideoView::NotifyVideoClipGeneratorSettingsChanged(CVedMovie& /*aMovie*/, |
|
567 TInt /*aIndex*/) |
|
568 { |
|
569 } |
|
570 |
|
571 void CVeiCutVideoView::NotifyVideoClipDescriptiveNameChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/) |
|
572 { |
|
573 } |
|
574 |
|
575 void CVeiCutVideoView::NotifyMovieQualityChanged(CVedMovie& /*aMovie*/) |
|
576 { |
|
577 } |
|
578 |
|
579 void CVeiCutVideoView::NotifyMovieOutputParametersChanged(CVedMovie& /*aMovie*/) |
|
580 { |
|
581 } |
|
582 |
|
583 void CVeiCutVideoView::NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/, |
|
584 TInt /*aClipIndex*/, |
|
585 TInt /*aMarkIndex*/) |
|
586 { |
|
587 } |
|
588 |
|
589 void CVeiCutVideoView::NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, |
|
590 TInt /*aClipIndex*/, |
|
591 TInt /*aMarkIndex*/) |
|
592 { |
|
593 } |
|
594 |
|
595 void CVeiCutVideoView::NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/, |
|
596 TInt /*aClipIndex*/, |
|
597 TInt /*aMarkIndex*/) |
|
598 { |
|
599 } |
|
600 |
|
601 void CVeiCutVideoView::NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, |
|
602 TInt /*aClipIndex*/, |
|
603 TInt /*aMarkIndex*/) |
|
604 { |
|
605 } |
|
606 |
|
607 void CVeiCutVideoView::DoActivateL( |
|
608 const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, |
|
609 const TDesC8& /*aCustomMessage*/) |
|
610 { |
|
611 |
|
612 if (!iContainer) |
|
613 { |
|
614 iContainer = CVeiCutVideoContainer::NewL( AppUi()->ClientRect(), *this, *iErrorUI ); |
|
615 iContainer->SetMopParent( this ); |
|
616 AppUi()->AddToStackL( *this, iContainer ); |
|
617 } |
|
618 |
|
619 CEikStatusPane *statusPane = ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); |
|
620 |
|
621 CAknTitlePane* titlePane = (CAknTitlePane*) statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ); |
|
622 TResourceReader reader1; |
|
623 iCoeEnv->CreateResourceReaderLC( reader1, R_VEI_CUTVIDEO_VIEW_TITLE_NAME ); |
|
624 titlePane->SetFromResourceL( reader1 ); |
|
625 CleanupStack::PopAndDestroy(); //reader1 |
|
626 |
|
627 UpdateCBAL( CVeiCutVideoContainer::EStateInitializing ); |
|
628 iNaviPane->PushL( *iTimeNavi ); |
|
629 |
|
630 iAudioMuted = !( iMovie->VideoClipEditedHasAudio( iIndex ) ); |
|
631 |
|
632 STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )-> |
|
633 SetPauseIconVisibilityL( EFalse ); |
|
634 |
|
635 if ( iAudioMuted ) |
|
636 { |
|
637 STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())-> |
|
638 SetVolumeIconVisibilityL( EFalse ); |
|
639 VolumeMuteL(); |
|
640 } |
|
641 else |
|
642 { |
|
643 STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())-> |
|
644 SetVolumeIconVisibilityL( ETrue ); |
|
645 } |
|
646 iErrorNmb = 0; |
|
647 |
|
648 iContainer->SetInTime( iMovie->VideoClipCutInTime( iIndex ) ); |
|
649 iContainer->SetOutTime( iMovie->VideoClipCutOutTime( iIndex ) ); |
|
650 |
|
651 CVedVideoClipInfo* clipinfo = iMovie->VideoClipInfo( iIndex ); |
|
652 |
|
653 /** |
|
654 * First try to open video clip in videoplayerutility. If it leaves with error code |
|
655 * KErrNotSupported(-5), then GenerateEffectedClipL() is called. |
|
656 */ if (EVedColorEffectBlackAndWhite == iMovie->VideoClipColorEffect( iIndex ) || |
|
657 EVedColorEffectToning == iMovie->VideoClipColorEffect( iIndex )) |
|
658 { |
|
659 GenerateEffectedClipL(); |
|
660 } |
|
661 else if (iMovie->VideoClipInfo(iIndex)->HasAudio() && iMovie->GetVideoClipVolumeGainL(iIndex)) |
|
662 { |
|
663 GenerateEffectedClipL(); |
|
664 } |
|
665 else |
|
666 { |
|
667 iContainer->GetThumbL( clipinfo->FileName() ); |
|
668 } |
|
669 } |
|
670 |
|
671 void CVeiCutVideoView::GenerateEffectedClipL() |
|
672 { |
|
673 TEntry fileinfo; |
|
674 // check if there is enough space to create temp file |
|
675 RFs& fs = iEikonEnv->FsSession(); |
|
676 |
|
677 CVedVideoClipInfo* videoclipinfo = iMovie->VideoClipInfo( iIndex ); |
|
678 |
|
679 fs.Entry( videoclipinfo->FileName(), fileinfo ); |
|
680 |
|
681 TBool spaceBelowCriticalLevel( EFalse ); |
|
682 |
|
683 TVeiSettings movieSaveSettings; |
|
684 |
|
685 |
|
686 STATIC_CAST( CVeiAppUi*, iEikonEnv->AppUi() )->ReadSettingsL( movieSaveSettings ); |
|
687 |
|
688 CAknMemorySelectionDialog::TMemory memoryInUse( movieSaveSettings.MemoryInUse() ); |
|
689 |
|
690 |
|
691 if ( memoryInUse == CAknMemorySelectionDialog::EPhoneMemory ) |
|
692 { |
|
693 spaceBelowCriticalLevel = SysUtil::DiskSpaceBelowCriticalLevelL( |
|
694 &fs, fileinfo.iSize, EDriveC ); |
|
695 } |
|
696 else |
|
697 { |
|
698 spaceBelowCriticalLevel = SysUtil::MMCSpaceBelowCriticalLevelL( |
|
699 &fs, fileinfo.iSize ); |
|
700 } |
|
701 |
|
702 if ( !spaceBelowCriticalLevel ) |
|
703 { |
|
704 iTempMovie = CVedMovie::NewL( NULL ); |
|
705 iTempMovie->RegisterMovieObserverL( this ); |
|
706 CVedVideoClipInfo* clipinfo = iMovie->VideoClipInfo( iIndex ); |
|
707 iTempMovie->InsertVideoClipL( clipinfo->FileName(), 0 ); |
|
708 } |
|
709 else |
|
710 { |
|
711 HBufC* stringholder; |
|
712 |
|
713 stringholder = StringLoader::LoadLC( R_VEI_NOT_ENOUGH_SPACE, iEikonEnv ); |
|
714 |
|
715 CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue ); |
|
716 dlg->ExecuteLD( *stringholder ); |
|
717 |
|
718 CleanupStack::PopAndDestroy( stringholder); |
|
719 |
|
720 HandleCommandL( EVeiCmdCutVideoViewBack ); |
|
721 } |
|
722 |
|
723 } |
|
724 |
|
725 // --------------------------------------------------------- |
|
726 // CVeiCutVideoView::HandleCommandL(TInt aCommand) |
|
727 // ?implementation_description |
|
728 // --------------------------------------------------------- |
|
729 // |
|
730 void CVeiCutVideoView::DoDeactivate() |
|
731 { |
|
732 iNaviPane->Pop( iVolumeNavi ); |
|
733 |
|
734 if ( iTimeUpdater ) |
|
735 { |
|
736 iTimeUpdater->Cancel(); |
|
737 } |
|
738 if ( iVolumeHider ) |
|
739 { |
|
740 iVolumeHider->Cancel(); |
|
741 } |
|
742 if ( iContainer ) |
|
743 { |
|
744 iNaviPane->Pop( iTimeNavi ); |
|
745 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
746 |
|
747 delete iContainer; |
|
748 iContainer = NULL; |
|
749 } |
|
750 |
|
751 if ( iProcessedTempFile ) |
|
752 { |
|
753 iEikonEnv->FsSession().Delete( *iProcessedTempFile ); |
|
754 delete iProcessedTempFile; |
|
755 iProcessedTempFile = NULL; |
|
756 } |
|
757 |
|
758 } |
|
759 |
|
760 void CVeiCutVideoView::SetVideoClipAndIndex( CVedMovie& aVideoClip, TInt aIndex ) |
|
761 { |
|
762 iMovie = &aVideoClip; |
|
763 iIndex = aIndex; |
|
764 } |
|
765 |
|
766 void CVeiCutVideoView::PlayPreviewL() |
|
767 { |
|
768 StartNaviPaneUpdateL(); |
|
769 iContainer->PlayL( iMovie->VideoClipInfo( iIndex )->FileName() ); |
|
770 } |
|
771 |
|
772 void CVeiCutVideoView::PausePreviewL() |
|
773 { |
|
774 STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )-> |
|
775 SetPauseIconVisibilityL( ETrue ); |
|
776 StopNaviPaneUpdateL(); |
|
777 |
|
778 iContainer->PauseL(); |
|
779 } |
|
780 |
|
781 void CVeiCutVideoView::UpdateCBAL(TInt aState) |
|
782 { |
|
783 switch (aState) |
|
784 { |
|
785 case CVeiCutVideoContainer::EStateInitializing: |
|
786 case CVeiCutVideoContainer::EStateOpening: |
|
787 case CVeiCutVideoContainer::EStateBuffering: |
|
788 { |
|
789 Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY); |
|
790 break; |
|
791 } |
|
792 case CVeiCutVideoContainer::EStateStoppedInitial: |
|
793 { |
|
794 if ( ( iMovie->VideoClipCutInTime( iIndex ) == TTimeIntervalMicroSeconds( 0 ) ) && |
|
795 ( iMovie->VideoClipCutOutTime( iIndex ) == iMovie->VideoClipInfo(iIndex)->Duration() ) ) |
|
796 { |
|
797 Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK); |
|
798 } |
|
799 else |
|
800 { |
|
801 Cba()->SetCommandSetL(R_VEI_SOFTKEYS_OPTIONS_DONE); |
|
802 } |
|
803 break; |
|
804 } |
|
805 case CVeiCutVideoContainer::EStatePaused: |
|
806 case CVeiCutVideoContainer::EStateStopped: |
|
807 { |
|
808 if ( ( iMovie->VideoClipCutInTime( iIndex ) == TTimeIntervalMicroSeconds( 0 ) ) && |
|
809 ( iMovie->VideoClipCutOutTime( iIndex ) == iMovie->VideoClipInfo(iIndex)->Duration() ) ) |
|
810 { |
|
811 Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK); |
|
812 } |
|
813 else |
|
814 { |
|
815 Cba()->SetCommandSetL(R_VEI_SOFTKEYS_OPTIONS_DONE); |
|
816 } |
|
817 break; |
|
818 } |
|
819 case CVeiCutVideoContainer::EStatePlaying: |
|
820 { |
|
821 if ( iContainer->PlaybackPositionL() < iMovie->VideoClipCutInTime( iIndex ) ) |
|
822 { |
|
823 Cba()->SetCommandSetL( R_VEI_SOFTKEYS_IN_EMPTY ); |
|
824 iMarkState = EMarkStateIn; |
|
825 } |
|
826 else if ( iContainer->PlaybackPositionL() < iMovie->VideoClipCutOutTime( iIndex ) ) |
|
827 { |
|
828 Cba()->SetCommandSetL( R_VEI_SOFTKEYS_IN_OUT ); |
|
829 iMarkState = EMarkStateInOut; |
|
830 } |
|
831 else |
|
832 { |
|
833 Cba()->SetCommandSetL( R_VEI_SOFTKEYS_EMPTY_OUT ); |
|
834 iMarkState = EMarkStateOut; |
|
835 } |
|
836 break; |
|
837 } |
|
838 default: |
|
839 { |
|
840 break; |
|
841 } |
|
842 } |
|
843 Cba()->DrawDeferred(); |
|
844 } |
|
845 |
|
846 void CVeiCutVideoView::PlayMarkedL() |
|
847 { |
|
848 LOGFMT3(KVideoEditorLogFile, "CVeiCutVideoView::PlayMarkedL: In: iIndex:%d, iMovie->VideoClipCutInTime():%Ld, iMovie->VideoClipCutOutTime():%Ld", iIndex, iMovie->VideoClipCutInTime( iIndex ).Int64(), iMovie->VideoClipCutOutTime( iIndex ).Int64()); |
|
849 |
|
850 StartNaviPaneUpdateL(); |
|
851 iContainer->PlayMarkedL( iMovie->VideoClipInfo( iIndex )->FileName(), |
|
852 iMovie->VideoClipCutInTime( iIndex ), iMovie->VideoClipCutOutTime( iIndex ) ); |
|
853 |
|
854 LOG(KVideoEditorLogFile, "CVeiCutVideoView::PlayMarkedL: Out"); |
|
855 } |
|
856 |
|
857 void CVeiCutVideoView::ClearInOutL( TBool aClearIn, TBool aClearOut ) |
|
858 { |
|
859 if ( aClearIn ) |
|
860 { |
|
861 iMovie->VideoClipSetCutInTime( iIndex, TTimeIntervalMicroSeconds( 0 ) ); |
|
862 iContainer->SetInTime( iMovie->VideoClipCutInTime( iIndex ) ); |
|
863 } |
|
864 if ( aClearOut ) |
|
865 { |
|
866 iMovie->VideoClipSetCutOutTime( iIndex, iMovie->VideoClipInfo( iIndex )->Duration() ); |
|
867 iContainer->SetOutTime( iMovie->VideoClipInfo( iIndex )->Duration() ); |
|
868 } |
|
869 TTimeIntervalMicroSeconds cutin = iMovie->VideoClipCutInTime( iIndex ); |
|
870 TTimeIntervalMicroSeconds cutout = iMovie->VideoClipCutOutTime( iIndex ); |
|
871 |
|
872 if ( ( cutin == TTimeIntervalMicroSeconds( 0 ) ) && |
|
873 ( cutout == iMovie->VideoClipInfo(iIndex)->Duration() ) ) |
|
874 { |
|
875 Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK); |
|
876 Cba()->DrawDeferred(); |
|
877 } |
|
878 } |
|
879 |
|
880 void CVeiCutVideoView::MarkInL() |
|
881 { |
|
882 LOG(KVideoEditorLogFile, "CVeiCutVideoView::MarkInL, In"); |
|
883 TTimeIntervalMicroSeconds pos = iContainer->PlaybackPositionL(); |
|
884 |
|
885 // TTimeIntervalMicroSeconds clipDuration = iMovie->VideoClipInfo( iIndex )->Duration(); |
|
886 // CVedVideoClipInfo* info = iMovie->VideoClipInfo( iIndex ); |
|
887 // TTimeIntervalMicroSeconds intraPos = info->VideoFrameStartTimeL( |
|
888 // info->GetVideoFrameIndexL( pos ) ); |
|
889 |
|
890 if (iMovie->VideoClipCutOutTime(iIndex) > pos) |
|
891 { |
|
892 StopNaviPaneUpdateL(); |
|
893 LOGFMT2(KVideoEditorLogFile, "CVeiCutVideoView::MarkInL, 2, iIndex:%d, pos:%Ld", iIndex, pos.Int64()); |
|
894 iMovie->VideoClipSetCutInTime( iIndex, pos ); |
|
895 iContainer->MarkedInL(); |
|
896 } |
|
897 |
|
898 LOG(KVideoEditorLogFile, "CVeiCutVideoView::MarkInL, Out"); |
|
899 } |
|
900 |
|
901 void CVeiCutVideoView::MarkOutL() |
|
902 { |
|
903 LOG(KVideoEditorLogFile, "CVeiCutVideoView::MarkOutL, In"); |
|
904 TTimeIntervalMicroSeconds pos = iContainer->PlaybackPositionL(); |
|
905 // CVedVideoClipInfo* info = iMovie->VideoClipInfo( iIndex ); |
|
906 // TTimeIntervalMicroSeconds intraPos = info->VideoFrameStartTimeL( |
|
907 // info->GetVideoFrameIndexL( pos ) ); |
|
908 |
|
909 if (iMovie->VideoClipCutInTime(iIndex) < pos) |
|
910 { |
|
911 StopNaviPaneUpdateL(); |
|
912 iMovie->VideoClipSetCutOutTime( iIndex, pos ); |
|
913 LOGFMT2(KVideoEditorLogFile, "CVeiCutVideoView::MarkOutL, 2, iIndex:%d, pos:%Ld", iIndex, pos.Int64() ); |
|
914 iContainer->MarkedOutL(); |
|
915 } |
|
916 LOG(KVideoEditorLogFile, "CVeiCutVideoView::MarkOutL, Out"); |
|
917 } |
|
918 |
|
919 void CVeiCutVideoView::MoveStartOrEndMarkL( TTimeIntervalMicroSeconds aPosition, CVeiCutVideoContainer::TCutMark aMarkType ) |
|
920 { |
|
921 LOG( KVideoEditorLogFile, "CVeiCutVideoView::MoveStartOrEndMarkL, In" ); |
|
922 |
|
923 StopNaviPaneUpdateL(); |
|
924 |
|
925 LOG( KVideoEditorLogFile, "CVeiCutVideoView::MoveStartOrEndMarkL, 2" ); |
|
926 |
|
927 if ( aMarkType == CVeiCutVideoContainer::EStartMark ) |
|
928 { |
|
929 iMovie->VideoClipSetCutInTime( iIndex, aPosition ); |
|
930 } |
|
931 else if ( aMarkType == CVeiCutVideoContainer::EEndMark ) |
|
932 { |
|
933 iMovie->VideoClipSetCutOutTime( iIndex, aPosition ); |
|
934 } |
|
935 LOG( KVideoEditorLogFile, "CVeiCutVideoView::MoveStartOrEndMarkL, Out" ); |
|
936 } |
|
937 |
|
938 |
|
939 TUint CVeiCutVideoView::InPointTime() |
|
940 { |
|
941 if ( !iMovie ) |
|
942 { |
|
943 return 0; |
|
944 } |
|
945 else |
|
946 { |
|
947 return static_cast<TInt32>((iMovie->VideoClipCutInTime(iIndex).Int64() / 1000)); |
|
948 } |
|
949 } |
|
950 |
|
951 TUint CVeiCutVideoView::OutPointTime() |
|
952 { |
|
953 if ( !iMovie ) |
|
954 { |
|
955 return 0; |
|
956 } |
|
957 else |
|
958 { |
|
959 return static_cast<TInt32>(iMovie->VideoClipCutOutTime(iIndex).Int64() / 1000); |
|
960 } |
|
961 } |
|
962 |
|
963 CAknNavigationDecorator* CVeiCutVideoView::CreateTimeLabelNaviL() |
|
964 { |
|
965 LOG(KVideoEditorLogFile, "CVeiCutVideoView::CreateTimeLabelNaviL: in"); |
|
966 CVeiTimeLabelNavi* timelabelnavi = CVeiTimeLabelNavi::NewLC(); |
|
967 CAknNavigationDecorator* decoratedFolder = |
|
968 CAknNavigationDecorator::NewL(iNaviPane, timelabelnavi, CAknNavigationDecorator::ENotSpecified); |
|
969 CleanupStack::Pop(timelabelnavi); |
|
970 |
|
971 CleanupStack::PushL(decoratedFolder); |
|
972 decoratedFolder->SetContainerWindowL(*iNaviPane); |
|
973 CleanupStack::Pop(decoratedFolder); |
|
974 decoratedFolder->MakeScrollButtonVisible(EFalse); |
|
975 LOG(KVideoEditorLogFile, "CVeiCutVideoView::CreateTimeLabelNaviL: out"); |
|
976 return decoratedFolder; |
|
977 } |
|
978 |
|
979 TInt CVeiCutVideoView::UpdateTimeCallbackL(TAny* aPtr) |
|
980 { |
|
981 CVeiCutVideoView* view = (CVeiCutVideoView*)aPtr; |
|
982 |
|
983 view->UpdateTimeL(); |
|
984 |
|
985 return 1; |
|
986 } |
|
987 |
|
988 |
|
989 void CVeiCutVideoView::UpdateTimeL() |
|
990 { |
|
991 DrawTimeNaviL(); |
|
992 |
|
993 if (iMarkState == EMarkStateIn) |
|
994 { |
|
995 if (iContainer->PlaybackPositionL() > iMovie->VideoClipCutInTime( iIndex )) |
|
996 { |
|
997 UpdateCBAL(iContainer->State()); |
|
998 } |
|
999 } |
|
1000 else if (iMarkState == EMarkStateOut) |
|
1001 { |
|
1002 if (iContainer->PlaybackPositionL() < iMovie->VideoClipCutOutTime( iIndex )) |
|
1003 { |
|
1004 UpdateCBAL(iContainer->State()); |
|
1005 } |
|
1006 } |
|
1007 else |
|
1008 { |
|
1009 if ((iContainer->PlaybackPositionL() < iMovie->VideoClipCutInTime( iIndex )) || |
|
1010 (iContainer->PlaybackPositionL() > iMovie->VideoClipCutOutTime( iIndex ))) |
|
1011 { |
|
1012 UpdateCBAL(iContainer->State()); |
|
1013 } |
|
1014 } |
|
1015 } |
|
1016 |
|
1017 void CVeiCutVideoView::DrawTimeNaviL() |
|
1018 { |
|
1019 TTime elapsed( iContainer->PlaybackPositionL().Int64() ); |
|
1020 TTime total( iContainer->TotalLength().Int64() ); |
|
1021 |
|
1022 TBuf<16> elapsedBuf; |
|
1023 TBuf<16> totalBuf; |
|
1024 |
|
1025 HBufC* dateFormatString; |
|
1026 HBufC* stringholder; |
|
1027 |
|
1028 if ( ( total.Int64() / 1000 ) < 3600000 ) // check if time is over 99:59 |
|
1029 { |
|
1030 dateFormatString = iEikonEnv->AllocReadResourceLC( R_QTN_TIME_DURAT_MIN_SEC ); |
|
1031 |
|
1032 elapsed.FormatL(elapsedBuf, *dateFormatString); |
|
1033 total.FormatL(totalBuf, *dateFormatString); |
|
1034 CleanupStack::PopAndDestroy(dateFormatString); |
|
1035 |
|
1036 CDesCArrayFlat* strings = new (ELeave) CDesCArrayFlat(2); |
|
1037 CleanupStack::PushL(strings); |
|
1038 strings->AppendL(elapsedBuf); |
|
1039 strings->AppendL(totalBuf); |
|
1040 stringholder = StringLoader::LoadL(R_VEI_NAVI_TIME, *strings, iEikonEnv); |
|
1041 CleanupStack::PopAndDestroy(strings); |
|
1042 |
|
1043 |
|
1044 CleanupStack::PushL(stringholder); |
|
1045 |
|
1046 STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetLabelL(stringholder->Des()); |
|
1047 |
|
1048 CleanupStack::PopAndDestroy(stringholder); |
|
1049 } |
|
1050 else |
|
1051 { |
|
1052 TBuf<25> layoutTime; |
|
1053 TBuf<15> minsec; |
|
1054 TTimeIntervalMinutes minutes; |
|
1055 TTimeIntervalMicroSeconds32 seconds; |
|
1056 |
|
1057 TInt64 duration = ( iContainer->PlaybackPositionL().Int64() / 1000 ); |
|
1058 TChar timeSeparator = TLocale().TimeSeparator(2); |
|
1059 //over 1 minute |
|
1060 if( duration >= 60000 ) |
|
1061 { |
|
1062 minutes = TTimeIntervalMinutes(static_cast<TInt32>( duration) / 60000 ); |
|
1063 minsec.AppendNum( minutes.Int() ); |
|
1064 minsec.Append( timeSeparator ); |
|
1065 |
|
1066 duration = duration - minutes.Int() * 60000; |
|
1067 } |
|
1068 else |
|
1069 { |
|
1070 minsec.Append( _L( "00" ) ); |
|
1071 minsec.Append( timeSeparator ); |
|
1072 } |
|
1073 if( duration >= 1000 ) |
|
1074 { |
|
1075 seconds = TTimeIntervalMicroSeconds32( static_cast<TInt32>(duration) / 1000 ); |
|
1076 |
|
1077 if( seconds.Int() >= 60 ) |
|
1078 { |
|
1079 minsec.AppendNum( seconds.Int() - 60 ); |
|
1080 } |
|
1081 else |
|
1082 { |
|
1083 if ( seconds.Int() < 10 ) |
|
1084 { |
|
1085 minsec.Append( _L("0") ); |
|
1086 } |
|
1087 minsec.AppendNum( seconds.Int() ); |
|
1088 } |
|
1089 } |
|
1090 else |
|
1091 { |
|
1092 minsec.Append( _L("00") ); |
|
1093 } |
|
1094 layoutTime.Append( minsec ); |
|
1095 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( layoutTime ); |
|
1096 |
|
1097 STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetLabelL(layoutTime); |
|
1098 } |
|
1099 |
|
1100 |
|
1101 /* Prevent the screen light dimming. */ |
|
1102 if (elapsed.DateTime().Second() == 0 || elapsed.DateTime().Second() == 15 || elapsed.DateTime().Second() == 30 || elapsed.DateTime().Second() == 45) |
|
1103 { |
|
1104 User::ResetInactivityTime(); |
|
1105 } |
|
1106 } |
|
1107 |
|
1108 |
|
1109 void CVeiCutVideoView::StartNaviPaneUpdateL() |
|
1110 { |
|
1111 DrawTimeNaviL(); |
|
1112 if (iTimeUpdater && !iTimeUpdater->IsActive()) |
|
1113 { |
|
1114 iTimeUpdater->Start(200000, 1000000/10, TCallBack(CVeiCutVideoView::UpdateTimeCallbackL, this)); |
|
1115 } |
|
1116 } |
|
1117 |
|
1118 void CVeiCutVideoView::StopNaviPaneUpdateL() |
|
1119 { |
|
1120 if (iContainer) |
|
1121 { |
|
1122 DrawTimeNaviL(); |
|
1123 } |
|
1124 if (iTimeUpdater && iTimeUpdater->IsActive()) |
|
1125 { |
|
1126 iTimeUpdater->Cancel(); |
|
1127 } |
|
1128 } |
|
1129 |
|
1130 TInt CVeiCutVideoView::HideVolumeCallbackL(TAny* aPtr) |
|
1131 { |
|
1132 CVeiCutVideoView* view = (CVeiCutVideoView*)aPtr; |
|
1133 view->HideVolume(); |
|
1134 return 0; |
|
1135 } |
|
1136 |
|
1137 void CVeiCutVideoView::HideVolume() |
|
1138 { |
|
1139 iNaviPane->Pop(iVolumeNavi); |
|
1140 } |
|
1141 |
|
1142 void CVeiCutVideoView::VolumeMuteL() |
|
1143 { |
|
1144 iContainer->MuteL(); |
|
1145 } |
|
1146 |
|
1147 |
|
1148 |
|
1149 void CVeiCutVideoView::ShowVolumeLabelL( TInt aVolume ) |
|
1150 { |
|
1151 STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())-> |
|
1152 SetVolumeIconVisibilityL( ETrue ); |
|
1153 |
|
1154 if (iVolumeHider->IsActive()) |
|
1155 { |
|
1156 iVolumeHider->Cancel(); |
|
1157 } |
|
1158 if (aVolume == 0) |
|
1159 { |
|
1160 STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())-> |
|
1161 SetVolumeIconVisibilityL( EFalse ); |
|
1162 HideVolume(); |
|
1163 return; |
|
1164 } |
|
1165 |
|
1166 iNaviPane->PushL(*iVolumeNavi); |
|
1167 iVolumeHider->Start(1000000, 1000000, TCallBack(CVeiCutVideoView::HideVolumeCallbackL, this)); |
|
1168 |
|
1169 STATIC_CAST(CAknVolumeControl*, iVolumeNavi->DecoratedControl())->SetValue(aVolume); |
|
1170 |
|
1171 if (aVolume > iContainer->MinVolume() + 1 ) |
|
1172 { |
|
1173 STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetLeftArrowVisibilityL(ETrue); |
|
1174 } |
|
1175 else |
|
1176 { |
|
1177 STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetLeftArrowVisibilityL(EFalse); |
|
1178 } |
|
1179 |
|
1180 if (aVolume < iContainer->MaxVolume()) |
|
1181 { |
|
1182 STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetRightArrowVisibilityL(ETrue); |
|
1183 } |
|
1184 else |
|
1185 { |
|
1186 STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetRightArrowVisibilityL(EFalse); |
|
1187 } |
|
1188 |
|
1189 } |
|
1190 |
|
1191 void CVeiCutVideoView::HandleForegroundEventL ( TBool aForeground ) |
|
1192 { |
|
1193 if ( !aForeground ) |
|
1194 { |
|
1195 // If the application is closing down, calling PauseL could result in |
|
1196 // a callback from the MMF player after the container is already deleted, |
|
1197 // causing KERN-EXEC 3 |
|
1198 if ( static_cast<CVeiAppUi*>( AppUi() )->AppIsOnTheWayToDestruction() ) |
|
1199 { |
|
1200 iContainer->PrepareForTerminationL(); |
|
1201 } |
|
1202 else |
|
1203 { |
|
1204 iContainer->PauseL( EFalse ); |
|
1205 } |
|
1206 iNaviPane->Pop( iTimeNavi ); |
|
1207 } |
|
1208 else |
|
1209 { |
|
1210 UpdateCBAL( iContainer->State() ); |
|
1211 iNaviPane->PushL( *iTimeNavi ); |
|
1212 } |
|
1213 } |
|
1214 |
|
1215 // --------------------------------------------------------- |
|
1216 // CVeiCutVideoView::HandleStatusPaneSizeChange() |
|
1217 // --------------------------------------------------------- |
|
1218 // |
|
1219 void CVeiCutVideoView::HandleStatusPaneSizeChange() |
|
1220 { |
|
1221 if ( iContainer ) |
|
1222 { |
|
1223 iContainer->SetRect( AppUi()->ClientRect() ); |
|
1224 } |
|
1225 } |
|
1226 |
|
1227 TBool CVeiCutVideoView::IsEnoughFreeSpaceToSaveL()// const |
|
1228 { |
|
1229 |
|
1230 STATIC_CAST( CVeiAppUi*, AppUi() )->ReadSettingsL( iMovieSaveSettings ); |
|
1231 iMemoryInUse = iMovieSaveSettings.MemoryInUse(); |
|
1232 |
|
1233 RFs& fs = iEikonEnv->FsSession(); |
|
1234 TBool spaceBelowCriticalLevel( EFalse ); |
|
1235 |
|
1236 /* seek position of clip */ |
|
1237 TTimeIntervalMicroSeconds frame; |
|
1238 frame = iContainer->PlaybackPositionL(); |
|
1239 |
|
1240 /* frame index of position */ |
|
1241 TInt frameIndex; |
|
1242 frameIndex = iMovie->VideoClipInfo( iIndex )->GetVideoFrameIndexL( frame ); |
|
1243 |
|
1244 /* frame size */ |
|
1245 TInt sizeEstimate; |
|
1246 sizeEstimate = iMovie->VideoClipInfo( iIndex )->VideoFrameSizeL( frameIndex ); |
|
1247 |
|
1248 if ( iMemoryInUse == CAknMemorySelectionDialog::EPhoneMemory ) |
|
1249 { |
|
1250 spaceBelowCriticalLevel = SysUtil::DiskSpaceBelowCriticalLevelL( &fs, sizeEstimate, EDriveC ); |
|
1251 } |
|
1252 else |
|
1253 { |
|
1254 spaceBelowCriticalLevel = SysUtil::MMCSpaceBelowCriticalLevelL( &fs, sizeEstimate ); |
|
1255 } |
|
1256 |
|
1257 |
|
1258 if ( !spaceBelowCriticalLevel ) |
|
1259 { |
|
1260 return ETrue; |
|
1261 } |
|
1262 else |
|
1263 { |
|
1264 HBufC* stringholder; |
|
1265 stringholder = StringLoader::LoadLC( R_VEI_MEMORY_RUNNING_OUT, iEikonEnv ); |
|
1266 CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue ); |
|
1267 dlg->ExecuteLD( *stringholder ); |
|
1268 CleanupStack::PopAndDestroy( stringholder ); |
|
1269 |
|
1270 return EFalse; |
|
1271 } |
|
1272 } |
|
1273 |
|
1274 TTimeIntervalMicroSeconds CVeiCutVideoView::GetVideoClipCutInTime() |
|
1275 { |
|
1276 TTimeIntervalMicroSeconds cutInTime(0); |
|
1277 if ( iMovie ) |
|
1278 { |
|
1279 cutInTime = iMovie->VideoClipCutInTime( iIndex ); |
|
1280 } |
|
1281 return cutInTime; |
|
1282 } |
|
1283 |
|
1284 TTimeIntervalMicroSeconds CVeiCutVideoView::GetVideoClipCutOutTime() |
|
1285 { |
|
1286 TTimeIntervalMicroSeconds cutOutTime(0); |
|
1287 if ( iMovie ) |
|
1288 { |
|
1289 cutOutTime = iMovie->VideoClipCutOutTime( iIndex ); |
|
1290 } |
|
1291 return cutOutTime; |
|
1292 } |
|
1293 |
|
1294 void CVeiCutVideoView::HandleResourceChange(TInt aType) |
|
1295 { |
|
1296 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoView::HandleResourceChange() In, aType:%d", aType); |
|
1297 |
|
1298 if (KAknsMessageSkinChange == aType) |
|
1299 { |
|
1300 // Handle skin change in the navi label controls - they do not receive |
|
1301 // it automatically since they are not in the control stack |
|
1302 iTimeNavi->DecoratedControl()->HandleResourceChange( aType ); |
|
1303 iVolumeNavi->DecoratedControl()->HandleResourceChange( aType ); |
|
1304 } |
|
1305 |
|
1306 LOG(KVideoEditorLogFile, "CVeiEditVideoView::HandleResourceChange() Out"); |
|
1307 } |
|
1308 |
|
1309 // End of File |
|
1310 |
|