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 |
|
22 // System includes |
|
23 #include <manualvideoeditor.rsg> |
|
24 #include <manualvideoeditor.mbg> |
|
25 #include <videoeditoruicomponents.rsg> |
|
26 #include <videoeditoruicomponents.mbg> |
|
27 #include <videoeditorbitmaps.mbg> |
|
28 #include <gulicon.h> |
|
29 #include <stringloader.h> |
|
30 #include <aknsdrawutils.h> |
|
31 #include <aknsdatacontext.h> |
|
32 #include <aknsbasicbackgroundcontrolcontext.h> |
|
33 #include <aknquerydialog.h> |
|
34 #include <eikprogi.h> |
|
35 #include <aknnotewrappers.h> |
|
36 #include <errorui.h> |
|
37 #include <aknbiditextutils.h> |
|
38 #include <gulfont.h> |
|
39 #include <akniconutils.h> |
|
40 #include <pathinfo.h> |
|
41 #include <f32file.h> |
|
42 #include <CMGAlbumManager.h> |
|
43 #include <vedcommon.h> |
|
44 #include <mmf/common/mmferrors.h> |
|
45 |
|
46 // User includes |
|
47 #include "VeiEditVideoContainer.h" |
|
48 #include "VeiVideoDisplay.h" |
|
49 #include "VeiTextDisplay.h" |
|
50 #include "VeiCutterBar.h" |
|
51 #include "veiappui.h" |
|
52 #include "veiframetaker.h" |
|
53 #include "VeiIconBox.h" |
|
54 #include "VideoEditorCommon.h" |
|
55 #include "VideoEditorUtils.h" |
|
56 #include "VideoEditorHelp.hlp.hrh" // Topic contexts (literals) |
|
57 #include "VeiEditVideoView.h" |
|
58 #include "ManualVideoEditor.hrh" |
|
59 #include "VeiSlider.h" |
|
60 #include "StoryboardItems.h" |
|
61 #include "TransitionInfo.h" |
|
62 |
|
63 |
|
64 // ================= MEMBER FUNCTIONS ======================= |
|
65 void CleanupRArray( TAny* object ) |
|
66 { |
|
67 (( RImageTypeDescriptionArray*)object)->ResetAndDestroy(); |
|
68 } |
|
69 |
|
70 CVeiEditVideoContainer* CVeiEditVideoContainer::NewL( const TRect& aRect, |
|
71 CVedMovie& aMovie, CVeiEditVideoView& aView ) |
|
72 { |
|
73 CVeiEditVideoContainer* self = CVeiEditVideoContainer::NewLC( aRect, |
|
74 aMovie, aView ); |
|
75 CleanupStack::Pop( self ); |
|
76 return self; |
|
77 } |
|
78 |
|
79 CVeiEditVideoContainer* CVeiEditVideoContainer::NewLC( const TRect& aRect, |
|
80 CVedMovie& aMovie, CVeiEditVideoView& aView ) |
|
81 { |
|
82 CVeiEditVideoContainer* self = new (ELeave) CVeiEditVideoContainer( aMovie, aView ); |
|
83 CleanupStack::PushL( self ); |
|
84 self->ConstructL( aRect ); |
|
85 return self; |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------- |
|
89 // CVeiEditVideoContainer::ConstructL(const TRect& aRect) |
|
90 // EPOC two phased constructor |
|
91 // --------------------------------------------------------- |
|
92 // |
|
93 void CVeiEditVideoContainer::ConstructL( const TRect& aRect ) |
|
94 { |
|
95 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConstructL in"); |
|
96 |
|
97 CreateWindowL(); |
|
98 |
|
99 iMovie.RegisterMovieObserverL( this ); |
|
100 |
|
101 iConverter = CVeiImageConverter::NewL( this ); |
|
102 |
|
103 TFileName mbmPath( VideoEditorUtils::IconFileNameAndPath(KManualVideoEditorIconFileId) ); |
|
104 TFileName mbmPath2( VideoEditorUtils::IconFileNameAndPath(KVideoEditorUiComponentsIconFileId) ); |
|
105 TFileName mbmPath3( VideoEditorUtils::IconFileNameAndPath(KVeiNonScalableIconFileId) ); |
|
106 |
|
107 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConstructL Loading bitmaps.."); |
|
108 |
|
109 // No thumbnail icon (shown when video thumb nail cannot be generated) |
|
110 AknIconUtils::CreateIconL( iNoThumbnailIcon, iNoThumbnailIconMask, |
|
111 mbmPath2, EMbmVideoeditoruicomponentsQgn_graf_ve_novideo, |
|
112 EMbmVideoeditoruicomponentsQgn_graf_ve_novideo_mask ); |
|
113 |
|
114 iAudioIcon = AknIconUtils::CreateIconL( mbmPath, |
|
115 EMbmManualvideoeditorQgn_graf_ve_symbol_audio ); |
|
116 |
|
117 // Video timeline icon |
|
118 |
|
119 AknIconUtils::CreateIconL( iVideoTrackIcon, iVideoTrackIconMask, |
|
120 mbmPath, EMbmManualvideoeditorQgn_prop_ve_file_video, |
|
121 EMbmManualvideoeditorQgn_prop_ve_file_video_mask ); |
|
122 |
|
123 // Audio timeline icon |
|
124 |
|
125 AknIconUtils::CreateIconL( iAudioTrackIcon, iAudioTrackIconMask, |
|
126 mbmPath, EMbmManualvideoeditorQgn_prop_ve_file_audio, |
|
127 EMbmManualvideoeditorQgn_prop_ve_file_audio_mask ); |
|
128 |
|
129 // Audio mixing icon |
|
130 iAudioMixingIcon = AknIconUtils::CreateIconL( mbmPath3, |
|
131 EMbmVideoeditorbitmapsMix_audio_background ); |
|
132 |
|
133 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConstructL Bitmaps OK!"); |
|
134 |
|
135 iTransitionInfo = CTransitionInfo::NewL(); |
|
136 |
|
137 iZoomTimer = CPeriodic::NewL( CActive::EPriorityLow ); |
|
138 |
|
139 iVideoDisplayBox = TRect(0,0,100,100); |
|
140 |
|
141 iVideoDisplay = CVeiVideoDisplay::NewL( iVideoDisplayBox, this, *this ); |
|
142 |
|
143 /* Video Display components for transitioin state*/ |
|
144 iTransitionDisplayRight = CVeiVideoDisplay::NewL( iVideoDisplayBox, this, *this ); |
|
145 iTransitionDisplayLeft = CVeiVideoDisplay::NewL( iVideoDisplayBox, this, *this ); |
|
146 |
|
147 iDummyCutBar = CVeiCutterBar::NewL( this, ETrue ); |
|
148 iDummyCutBarLeft = CVeiCutterBar::NewL( this, ETrue ); |
|
149 |
|
150 /* IconBox */ |
|
151 iEffectSymbolBox = TRect(0,0,10,10); |
|
152 iEffectSymbols = CVeiIconBox::NewL( iEffectSymbolBox, this ); |
|
153 |
|
154 iInfoDisplay = CVeiTextDisplay::NewL( iVideoDisplayBox, this ); |
|
155 iInfoDisplay->SetMopParent( this ); |
|
156 iArrowsDisplay = CVeiTextDisplay::NewL( iVideoDisplayBox, this ); |
|
157 |
|
158 SetRect( aRect ); |
|
159 iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse ); |
|
160 |
|
161 iFrameTaker = CVeiFrameTaker::NewL( *this ); |
|
162 |
|
163 iGradientBitmap = new(ELeave)CFbsBitmap; |
|
164 TRgb startColor = TRgb( 0x7a, 0xbe, 0xe7); |
|
165 TRgb endColor = TRgb( 0x00, 0x3e, 0x80 ); |
|
166 TInt breadth = 30; |
|
167 ColorUtils::TBitmapOrientation bitmapOrientation = ColorUtils::EBitmapOrientationHorizontal; |
|
168 ColorUtils::CreateGradientBitmapL( *iGradientBitmap, iEikonEnv->WsSession(), breadth, |
|
169 bitmapOrientation, startColor, endColor ); |
|
170 LOG(KVideoEditorLogFile, "Gradient bitmap created.."); |
|
171 SetCursorLocation( ECursorOnEmptyVideoTrack ); |
|
172 |
|
173 /* Timer to keep back light on when user is not giving key events */ |
|
174 iScreenLight = CVeiDisplayLighter::NewL(); |
|
175 |
|
176 iCurrentPoint = 0; |
|
177 /* Timer. Draws playhead */ |
|
178 iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
179 iSeekPos = TTimeIntervalMicroSeconds( 0 ); |
|
180 SetPreviewState(EStateInitializing); |
|
181 |
|
182 iBlackScreen = EFalse; |
|
183 |
|
184 CreateScrollBarL(aRect); |
|
185 |
|
186 AknIconUtils::CreateIconL( iPauseBitmap, iPauseBitmapMask, |
|
187 mbmPath2, EMbmVideoeditoruicomponentsQgn_prop_ve_pause, |
|
188 EMbmVideoeditoruicomponentsQgn_prop_ve_pause_mask ); |
|
189 |
|
190 EnableDragEvents(); |
|
191 |
|
192 ActivateL(); |
|
193 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConstructL: out"); |
|
194 } |
|
195 |
|
196 //=========================================================================== |
|
197 void CVeiEditVideoContainer::CreateScrollBarL(const TRect& aRect) |
|
198 { |
|
199 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::CreateScrollBarL: in"); |
|
200 // create vertical slider control in the middle of the |
|
201 // screen in vertical direction and 10 pixels from the |
|
202 // right side of the screen |
|
203 |
|
204 iVerticalSlider = CVeiVerticalSlider::NewL(aRect, *this); |
|
205 iVerticalSlider->SetMinimum( KVolumeSliderMin ); |
|
206 iVerticalSlider->SetMaximum( KVolumeSliderMax ); |
|
207 iVerticalSlider->SetStep( KVolumeSliderStep ); |
|
208 |
|
209 iVerticalSlider->SetPosition(0); |
|
210 |
|
211 iHorizontalSlider = CVeiHorizontalSlider::NewL(aRect, *this); |
|
212 iHorizontalSlider->SetMinimum(-10); |
|
213 iHorizontalSlider->SetMaximum(10); |
|
214 iHorizontalSlider->SetStep(1); |
|
215 |
|
216 iHorizontalSlider->SetPosition(0); |
|
217 |
|
218 iVerticalSlider->MakeVisible(EFalse); |
|
219 iHorizontalSlider->MakeVisible(EFalse); |
|
220 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::CreateScrollBarL: out"); |
|
221 } |
|
222 |
|
223 //=========================================================================== |
|
224 CVeiEditVideoContainer::CVeiEditVideoContainer( CVedMovie& aMovie, CVeiEditVideoView& aView ) |
|
225 :iView( aView ), iMovie( aMovie ) |
|
226 { |
|
227 iCurrentlyProcessedIndex = -1; |
|
228 iSelectionMode = EModeNavigation; |
|
229 iVideoCursorPos = 0; |
|
230 iAudioCursorPos = 0; |
|
231 |
|
232 iCursorLocation = ECursorOnEmptyVideoTrack; |
|
233 iPrevCursorLocation = ECursorOnClip; |
|
234 iTakeSnapshot = EFalse; |
|
235 iSeeking = EFalse; |
|
236 iCloseStream = EFalse; |
|
237 iBackKeyPressed = EFalse; |
|
238 /* Flag to make sure that engine has finished frame before trying to get next one. */ |
|
239 iFrameReady = ETrue; |
|
240 } |
|
241 |
|
242 |
|
243 CVeiEditVideoContainer::~CVeiEditVideoContainer() |
|
244 { |
|
245 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::~CVeiEditVideoContainer(): In"); |
|
246 if ( iMovie.MovieObserverIsRegistered( this ) ) |
|
247 { |
|
248 iMovie.UnregisterMovieObserver( this ); |
|
249 } |
|
250 |
|
251 if ( iTempVideoInfo ) |
|
252 { |
|
253 iTempVideoInfo->CancelFrame(); |
|
254 delete iTempVideoInfo; |
|
255 iTempVideoInfo = NULL; |
|
256 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::~CVeiEditVideoContainer(): iTempVideoInfo delete OK.."); |
|
257 } |
|
258 |
|
259 if ( iConverter ) |
|
260 { |
|
261 iConverter->CancelEncoding(); |
|
262 delete iConverter; |
|
263 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::~CVeiEditVideoContainer(): iConverter delete OK.."); |
|
264 } |
|
265 |
|
266 delete iTransitionInfo; |
|
267 delete iScreenLight; |
|
268 delete iVideoTrackIcon; |
|
269 delete iVideoTrackIconMask; |
|
270 delete iAudioTrackIcon; |
|
271 delete iAudioTrackIconMask; |
|
272 delete iAudioIcon; |
|
273 delete iAudioMixingIcon; |
|
274 delete iNoThumbnailIcon; |
|
275 delete iNoThumbnailIconMask; |
|
276 delete iGradientBitmap; |
|
277 delete iBgContext; |
|
278 delete iVideoDisplay; |
|
279 delete iTransitionDisplayRight; |
|
280 delete iTransitionDisplayLeft; |
|
281 delete iDummyCutBar; |
|
282 delete iDummyCutBarLeft; |
|
283 delete iEffectSymbols; |
|
284 delete iInfoDisplay; |
|
285 delete iArrowsDisplay; |
|
286 delete iFrameTaker; |
|
287 delete iRemConTarget; |
|
288 |
|
289 if ( iZoomTimer ) |
|
290 { |
|
291 iZoomTimer->Cancel(); |
|
292 delete iZoomTimer; |
|
293 } |
|
294 iVideoItemArray.ResetAndDestroy(); |
|
295 iAudioItemArray.ResetAndDestroy(); |
|
296 iVideoItemRectArray.Close(); |
|
297 |
|
298 if ( iPeriodic ) |
|
299 { |
|
300 iPeriodic->Cancel(); |
|
301 delete iPeriodic; |
|
302 } |
|
303 |
|
304 if ( iTempFileName ) |
|
305 { |
|
306 delete iTempFileName; |
|
307 iTempFileName = NULL; |
|
308 } |
|
309 if ( iSaveToFileName ) |
|
310 { |
|
311 delete iSaveToFileName; |
|
312 iSaveToFileName = NULL; |
|
313 } |
|
314 |
|
315 delete iHorizontalSlider; |
|
316 delete iVerticalSlider; |
|
317 |
|
318 delete iPauseBitmap; |
|
319 delete iPauseBitmapMask; |
|
320 |
|
321 delete iCallBack; |
|
322 |
|
323 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::~CVeiEditVideoContainer(): Out"); |
|
324 } |
|
325 |
|
326 // --------------------------------------------------------- |
|
327 // CVeiEditVideoContainer::SizeChanged() |
|
328 // Called by framework when the view size is changed |
|
329 // --------------------------------------------------------- |
|
330 // |
|
331 void CVeiEditVideoContainer::SizeChanged() |
|
332 { |
|
333 LOGFMT2(KVideoEditorLogFile, "CVeiEditVideoContainer SizeChanged: In: (%d,%d)", Size().iWidth, Size().iHeight); |
|
334 |
|
335 TRect rect = Rect(); |
|
336 |
|
337 if ( iBgContext ) |
|
338 iBgContext->SetRect( rect ); |
|
339 |
|
340 TInt audioTrackBoxTlX = -1; |
|
341 TInt audioTrackBoxSizeWidth = -1; |
|
342 TInt videoScreenSizeWidth = -1; |
|
343 TInt videoScreenSizeHeight = -1; |
|
344 TInt effectSymbolBoxTlXPortrait = -1; |
|
345 TInt videoScreenXPortrait = -1; |
|
346 TInt videoScreenYPortrait = -1; |
|
347 TInt infoDisplayBoxSizeHeight = -1; |
|
348 TInt thumbnailStartPaneBoxTlY = -1; |
|
349 TInt thumbnailStartPaneBoxSizeWidth = -1; |
|
350 TInt thumbnailStartPaneBoxSizeHeight = -1; |
|
351 TInt thumbnailEndPaneBoxTlY = -1; |
|
352 TInt sliderThickness = -1; |
|
353 |
|
354 switch( rect.iBr.iX ) |
|
355 { |
|
356 case 240: |
|
357 case 320: |
|
358 audioTrackBoxTlX = 25; |
|
359 audioTrackBoxSizeWidth = 204; |
|
360 videoScreenSizeWidth = 156; |
|
361 videoScreenSizeHeight = 128; |
|
362 effectSymbolBoxTlXPortrait = 23; |
|
363 videoScreenXPortrait = 47; |
|
364 videoScreenYPortrait = 2; |
|
365 infoDisplayBoxSizeHeight = 24; |
|
366 thumbnailStartPaneBoxTlY = 12; |
|
367 thumbnailStartPaneBoxSizeWidth = 78; |
|
368 thumbnailStartPaneBoxSizeHeight = 64; |
|
369 thumbnailEndPaneBoxTlY = 12; |
|
370 sliderThickness = 12; |
|
371 break; |
|
372 case 176: |
|
373 case 208: |
|
374 audioTrackBoxTlX = 19; |
|
375 audioTrackBoxSizeWidth = rect.iBr.iX-25;//153; |
|
376 videoScreenSizeWidth = 96; |
|
377 videoScreenSizeHeight = 78; |
|
378 effectSymbolBoxTlXPortrait = 25; |
|
379 videoScreenXPortrait = 40; |
|
380 videoScreenYPortrait = 2; |
|
381 infoDisplayBoxSizeHeight = 15; |
|
382 thumbnailStartPaneBoxTlY = 8; |
|
383 thumbnailStartPaneBoxSizeWidth = 56; |
|
384 thumbnailStartPaneBoxSizeHeight = 46; |
|
385 thumbnailEndPaneBoxTlY = 8; |
|
386 sliderThickness = 8; |
|
387 break; |
|
388 case 352: |
|
389 case 416: |
|
390 audioTrackBoxTlX = 38; |
|
391 audioTrackBoxSizeWidth = 306; |
|
392 videoScreenSizeWidth = 193; |
|
393 videoScreenSizeHeight = 158; |
|
394 effectSymbolBoxTlXPortrait = 43; |
|
395 videoScreenXPortrait = 80; |
|
396 videoScreenYPortrait = 4; |
|
397 infoDisplayBoxSizeHeight = 31; |
|
398 thumbnailStartPaneBoxTlY = 16; |
|
399 thumbnailStartPaneBoxSizeWidth = 112; |
|
400 thumbnailStartPaneBoxSizeHeight = 93; |
|
401 thumbnailEndPaneBoxTlY = 16; |
|
402 sliderThickness = 12; |
|
403 break; |
|
404 default: |
|
405 audioTrackBoxTlX = 38; |
|
406 audioTrackBoxSizeWidth = 306; |
|
407 videoScreenSizeWidth = 193; |
|
408 videoScreenSizeHeight = 158; |
|
409 effectSymbolBoxTlXPortrait = 43; |
|
410 videoScreenXPortrait = 80; |
|
411 videoScreenYPortrait = 4; |
|
412 infoDisplayBoxSizeHeight = 31; |
|
413 thumbnailStartPaneBoxTlY = 16; |
|
414 thumbnailStartPaneBoxSizeWidth = 112; |
|
415 thumbnailStartPaneBoxSizeHeight = 93; |
|
416 thumbnailEndPaneBoxTlY = 16; |
|
417 sliderThickness = 12; |
|
418 break; |
|
419 }; |
|
420 |
|
421 iTransitionMarkerSize.iWidth = 7; |
|
422 iTransitionMarkerSize.iHeight = 9; |
|
423 |
|
424 iAudioBarBox.iTl.iX = (rect.iTl.iX + 1) + iTransitionMarkerSize.iWidth / 2 + 20; |
|
425 iAudioBarBox.iTl.iY = rect.iBr.iY - 16; |
|
426 iAudioBarBox.iBr.iX = (rect.iBr.iX - 1) - iTransitionMarkerSize.iWidth / 2; |
|
427 iAudioBarBox.iBr.iY = rect.iBr.iY - 1; |
|
428 |
|
429 TPoint audioTrackBoxTl = TPoint(audioTrackBoxTlX, |
|
430 STATIC_CAST(TInt, rect.iBr.iY*0.8994 )); |
|
431 |
|
432 TSize audioTrackBoxSize = TSize(audioTrackBoxSizeWidth, |
|
433 STATIC_CAST(TInt, rect.iBr.iY*0.0764 )); |
|
434 iAudioTrackBox = TRect( audioTrackBoxTl, audioTrackBoxSize ); |
|
435 |
|
436 iAudioBarIconPos.iX = STATIC_CAST(TInt,0.01137*rect.iBr.iX);//rect.iTl.iX; |
|
437 iAudioBarIconPos.iY = iAudioTrackBox.iTl.iY; |
|
438 |
|
439 AknIconUtils::SetSize( iVideoTrackIcon, TSize( iAudioTrackBox.Height(), iAudioTrackBox.Height() ) ); |
|
440 AknIconUtils::SetSize( iAudioTrackIcon, TSize( iAudioTrackBox.Height(), iAudioTrackBox.Height() ) ); |
|
441 |
|
442 iAudioBarBox = iAudioTrackBox; |
|
443 |
|
444 iVideoBarBox.iTl.iX = iAudioBarBox.iTl.iX; |
|
445 iVideoBarBox.iTl.iY = iAudioBarBox.iTl.iY - iTransitionMarkerSize.iHeight - 16; |
|
446 iVideoBarBox.iBr.iX = iAudioBarBox.iBr.iX; |
|
447 iVideoBarBox.iBr.iY = iAudioBarBox.iTl.iY - 10; |
|
448 |
|
449 TPoint videoTrackBoxTl = TPoint(audioTrackBoxTl.iX, |
|
450 STATIC_CAST(TInt,rect.iBr.iY*0.7882 )); |
|
451 |
|
452 TSize videoTrackBoxSize = TSize(audioTrackBoxSize.iWidth, |
|
453 STATIC_CAST(TInt, rect.iBr.iY*0.0764 )); |
|
454 |
|
455 iVideoTrackBox = TRect( videoTrackBoxTl, videoTrackBoxSize ); |
|
456 |
|
457 iVideoBarIconPos.iX = iAudioBarIconPos.iX; |
|
458 iVideoBarIconPos.iY = iVideoTrackBox.iTl.iY; |
|
459 |
|
460 iVideoBarBox = iVideoTrackBox; |
|
461 |
|
462 iBarArea.iTl.iX = rect.iTl.iX; |
|
463 iBarArea.iTl.iY = iVideoBarBox.iTl.iY; |
|
464 iBarArea.iBr.iX = rect.iBr.iX; |
|
465 iBarArea.iBr.iY = iAudioBarBox.iBr.iY; |
|
466 |
|
467 TBool landscape = VideoEditorUtils::IsLandscapeScreenOrientation(); |
|
468 |
|
469 if ( landscape ) //Landscape |
|
470 { |
|
471 // clip thumbnail pane |
|
472 TInt videoScreenX = STATIC_CAST( TInt, rect.iBr.iX*0.0097 ); |
|
473 TInt videoScreenY = STATIC_CAST( TInt, rect.iBr.iY*0.0139 ); |
|
474 |
|
475 TSize videoScreenSize( videoScreenSizeWidth, videoScreenSizeHeight ); |
|
476 |
|
477 iVideoDisplayBox = TRect( TPoint( videoScreenX, videoScreenY ), videoScreenSize ); |
|
478 iVideoDisplay->SetRect( iVideoDisplayBox ); |
|
479 |
|
480 //clip cut timeline pane |
|
481 TSize cutBarBoxSize = TSize(videoScreenSize.iWidth, |
|
482 STATIC_CAST(TInt,rect.iBr.iY*0.09375 )); |
|
483 iDummyCutBarBox = TRect( TPoint(iVideoDisplayBox.iTl.iX, iVideoDisplayBox.iBr.iY), cutBarBoxSize ); |
|
484 iDummyCutBar->SetRect( iDummyCutBarBox ); |
|
485 |
|
486 //clip info pane |
|
487 TSize infoDisplayBoxSize = TSize( STATIC_CAST(TInt,rect.iBr.iX*0.4159),STATIC_CAST(TInt,rect.iBr.iY*0.56) ); |
|
488 iInfoDisplayBox = TRect( TPoint(iVideoDisplayBox.iBr.iX+videoScreenX, iVideoDisplayBox.iTl.iY), |
|
489 infoDisplayBoxSize ); |
|
490 |
|
491 //clip indicator pane |
|
492 TInt iconHeight = STATIC_CAST( TInt, rect.iBr.iY * 0.0972222222 ); |
|
493 |
|
494 TPoint effectSymbolBoxTl = TPoint( iInfoDisplayBox.iTl.iX, iInfoDisplayBox.iBr.iY/*+videoScreenY*/); |
|
495 TSize effectSymbolBoxSize = TSize( STATIC_CAST(TInt,rect.iBr.iX*0.22115385), iconHeight ); |
|
496 |
|
497 iEffectSymbolBox = TRect( effectSymbolBoxTl, effectSymbolBoxSize); |
|
498 iEffectSymbols->SetLandscapeScreenOrientation( landscape ); |
|
499 |
|
500 //pause indicator box (for preview state) |
|
501 iPauseIconBox = TRect( effectSymbolBoxTl, TSize(iconHeight, iconHeight) ); |
|
502 |
|
503 //slider controls |
|
504 if (iVerticalSlider) |
|
505 { |
|
506 iVerticalSliderSize = TSize(sliderThickness, iVideoDisplayBox.Height() + iDummyCutBarBox.Height()); |
|
507 iVerticalSliderPoint = TPoint( rect.Width() - sliderThickness * 2, videoScreenY ); |
|
508 iVerticalSlider->SetExtent( iVerticalSliderPoint, iVerticalSliderSize ); |
|
509 } |
|
510 if (iHorizontalSlider) |
|
511 { |
|
512 iHorizontalSliderSize = TSize(videoScreenSize.iWidth, sliderThickness); |
|
513 iHorizontalSliderPoint = TPoint( videoScreenX, videoScreenY + videoScreenSize.iHeight + sliderThickness); |
|
514 iHorizontalSlider->SetExtent( iHorizontalSliderPoint, iHorizontalSliderSize ); |
|
515 } |
|
516 |
|
517 //transition |
|
518 |
|
519 //ved_clip_thumbnail_start_pane |
|
520 TPoint thumbnailEndPaneBoxTl = TPoint(videoScreenX,videoScreenY); |
|
521 |
|
522 TSize thumbnailEndPaneBoxSize = TSize(STATIC_CAST(TInt, 0.3198*rect.iBr.iX), |
|
523 STATIC_CAST(TInt,rect.iBr.iY*0.3785)); |
|
524 |
|
525 iTransitionDisplayLeftBox = TRect( thumbnailEndPaneBoxTl, thumbnailEndPaneBoxSize ); |
|
526 iTransitionDisplayLeft->SetRect( iTransitionDisplayLeftBox ); |
|
527 |
|
528 |
|
529 //ved_clip_thumbnail_end_pane |
|
530 TPoint thumbnailStartPaneBoxTl = TPoint(STATIC_CAST(TInt, 0.6707*rect.iBr.iX),videoScreenY); |
|
531 |
|
532 TSize thumbnailStartPaneBoxSize = thumbnailEndPaneBoxSize; |
|
533 |
|
534 iTransitionDisplayRightBox = TRect( thumbnailStartPaneBoxTl, thumbnailStartPaneBoxSize ); |
|
535 iTransitionDisplayRight->SetRect( iTransitionDisplayRightBox ); |
|
536 |
|
537 //ved_transition_info_pane |
|
538 TPoint transitionArrowsBoxTl = TPoint(STATIC_CAST(TInt, 0.0866*rect.iBr.iX), |
|
539 STATIC_CAST(TInt,0.4896*rect.iBr.iY ) ); |
|
540 |
|
541 TSize transitionArrowsBoxSize = TSize(STATIC_CAST(TInt, 0.827*rect.iBr.iX), |
|
542 STATIC_CAST(TInt,0.2848*rect.iBr.iY ) ); |
|
543 |
|
544 iTransitionArrowsBox = TRect( transitionArrowsBoxTl, transitionArrowsBoxSize ); |
|
545 |
|
546 TInt SlowMotionBoxTlX = STATIC_CAST( TInt, rect.iBr.iX * 0.1346 ); |
|
547 TInt SlowMotionBoxTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.6806 ); |
|
548 TInt SlowMotionBoxBrX = STATIC_CAST( TInt, rect.iBr.iX * 0.4423077 ); |
|
549 TInt SlowMotionBoxBrY = STATIC_CAST( TInt, rect.iBr.iY * 0.7639 ); |
|
550 |
|
551 iSlowMotionBox = TRect(SlowMotionBoxTlX, SlowMotionBoxTlY, SlowMotionBoxBrX, |
|
552 SlowMotionBoxBrY); |
|
553 |
|
554 TInt widthAndheight = STATIC_CAST( TInt, rect.iBr.iX * 0.057692 ); |
|
555 |
|
556 iArrowsDisplay->SetArrowSize(TSize( widthAndheight, widthAndheight )); |
|
557 |
|
558 // video display when cursor is on transition. |
|
559 iVideoDisplayBoxOnTransition = TRect(TPoint((rect.iBr.iX/2) - |
|
560 STATIC_CAST( TInt, 1.19*iTransitionDisplayRightBox.Size().iHeight)/2, |
|
561 iTransitionDisplayLeftBox.iTl.iY), |
|
562 TSize(STATIC_CAST( TInt, 1.19*iTransitionDisplayRightBox.Size().iHeight), |
|
563 iTransitionDisplayRightBox.Size().iHeight)); // w:108, h:91 |
|
564 |
|
565 iDummyCutBarBoxOnTransition = TRect( TPoint(iTransitionDisplayRightBox.iTl.iX, |
|
566 iTransitionDisplayRightBox.iBr.iY), TSize( iTransitionDisplayRightBox.Width(), |
|
567 iDummyCutBarBox.Height() )); |
|
568 } |
|
569 else //Portrait |
|
570 { |
|
571 // clip thumbnail pane |
|
572 TInt videoScreenX = videoScreenXPortrait; |
|
573 TInt videoScreenY = videoScreenYPortrait; |
|
574 |
|
575 TSize videoScreenSize( videoScreenSizeWidth, videoScreenSizeHeight ); |
|
576 |
|
577 iVideoDisplayBox = TRect( TPoint( videoScreenX, videoScreenY ), videoScreenSize ); |
|
578 iVideoDisplay->SetRect( iVideoDisplayBox ); |
|
579 |
|
580 //clip cut timeline pane |
|
581 TSize cutBarBoxSize = TSize(videoScreenSize.iWidth, STATIC_CAST(TInt,rect.iBr.iY*0.0938 )); |
|
582 iDummyCutBarBox = TRect( TPoint(iVideoDisplayBox.iTl.iX, |
|
583 iVideoDisplayBox.iBr.iY - iVideoDisplay->GetBorderWidth()), cutBarBoxSize ); |
|
584 iDummyCutBar->SetRect( iDummyCutBarBox ); |
|
585 iDummyCutBarLeft->MakeVisible( EFalse ); |
|
586 |
|
587 //clip info pane |
|
588 TPoint infoDisplayBoxTl = TPoint(STATIC_CAST(TInt, rect.iBr.iX*0.074), |
|
589 STATIC_CAST(TInt, rect.iBr.iY*0.6598 )); |
|
590 TSize infoDisplayBoxSize = TSize(STATIC_CAST(TInt, rect.iBr.iX*0.855), |
|
591 infoDisplayBoxSizeHeight ); |
|
592 iInfoDisplayBox = TRect( infoDisplayBoxTl, infoDisplayBoxSize ); |
|
593 |
|
594 //clip indicator pane |
|
595 TInt iconWidth = STATIC_CAST( TInt, rect.iBr.iX * 0.07954545455 ); |
|
596 |
|
597 TInt effectSymbolBoxTlX = effectSymbolBoxTlXPortrait; |
|
598 TInt effectSymbolBoxTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.131944444 ); |
|
599 TSize effectSymbolBoxSize = TSize(iconWidth, STATIC_CAST(TInt,rect.iBr.iY * 0.3194444444 )); |
|
600 |
|
601 iEffectSymbolBox = TRect( TPoint(effectSymbolBoxTlX, effectSymbolBoxTlY), effectSymbolBoxSize); |
|
602 iEffectSymbols->SetLandscapeScreenOrientation( landscape ); |
|
603 |
|
604 //pause indicator box (for preview state) |
|
605 iPauseIconBox = TRect( iEffectSymbolBox.iTl, TSize(iconWidth, iconWidth) ); |
|
606 |
|
607 //slider controls |
|
608 if (iVerticalSlider) |
|
609 { |
|
610 iVerticalSliderSize = TSize(sliderThickness, iVideoDisplayBox.Height() + iDummyCutBarBox.Height()); |
|
611 iVerticalSliderPoint = TPoint( rect.Width() - sliderThickness * 2, videoScreenY ); |
|
612 iVerticalSlider->SetExtent( iVerticalSliderPoint, iVerticalSliderSize ); |
|
613 } |
|
614 if (iHorizontalSlider) |
|
615 { |
|
616 iHorizontalSliderSize = TSize(videoScreenSize.iWidth, sliderThickness); |
|
617 iHorizontalSliderPoint = TPoint( videoScreenX, videoScreenY + videoScreenSize.iHeight + sliderThickness); |
|
618 iHorizontalSlider->SetExtent( iHorizontalSliderPoint, iHorizontalSliderSize ); |
|
619 } |
|
620 |
|
621 //transition |
|
622 |
|
623 //ved_clip_thumbnail_start_pane |
|
624 TPoint thumbnailStartPaneBoxTl = TPoint(STATIC_CAST(TInt, 0.6705*rect.iBr.iX), |
|
625 thumbnailStartPaneBoxTlY); |
|
626 |
|
627 TSize thumbnailStartPaneBoxSize = TSize(thumbnailStartPaneBoxSizeWidth, |
|
628 thumbnailStartPaneBoxSizeHeight); |
|
629 |
|
630 iTransitionDisplayRightBox = TRect( thumbnailStartPaneBoxTl, thumbnailStartPaneBoxSize ); |
|
631 iTransitionDisplayRight->SetRect( iTransitionDisplayRightBox ); |
|
632 |
|
633 //ved_clip_thumbnail_end_pane |
|
634 TPoint thumbnailEndPaneBoxTl = TPoint(STATIC_CAST(TInt, 0.0116*rect.iBr.iX), |
|
635 thumbnailEndPaneBoxTlY ); |
|
636 |
|
637 TSize thumbnailEndPaneBoxSize = thumbnailStartPaneBoxSize; |
|
638 |
|
639 iTransitionDisplayLeftBox = TRect( thumbnailEndPaneBoxTl, thumbnailEndPaneBoxSize ); |
|
640 iTransitionDisplayLeft->SetRect( iTransitionDisplayLeftBox ); |
|
641 |
|
642 TInt SlowMotionBoxTlX = STATIC_CAST( TInt, rect.iBr.iX * 0.3 ); |
|
643 TInt SlowMotionBoxTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.65 ); |
|
644 TInt SlowMotionBoxBrX = STATIC_CAST( TInt, rect.iBr.iX * 0.7 ); |
|
645 TInt SlowMotionBoxBrY = STATIC_CAST( TInt, rect.iBr.iY * 0.76 ); |
|
646 |
|
647 iSlowMotionBox = TRect(SlowMotionBoxTlX, SlowMotionBoxTlY, SlowMotionBoxBrX, |
|
648 SlowMotionBoxBrY); |
|
649 |
|
650 //ved_transition_info_pane |
|
651 TPoint transitionArrowsBoxTl = TPoint(STATIC_CAST(TInt, 0.0116*rect.iBr.iX), |
|
652 STATIC_CAST(TInt,0.4792*rect.iBr.iY ) ); |
|
653 |
|
654 TSize transitionArrowsBoxSize = TSize(STATIC_CAST(TInt, 0.9773*rect.iBr.iX), |
|
655 STATIC_CAST(TInt,0.2848*rect.iBr.iY ) ); |
|
656 |
|
657 iTransitionArrowsBox = TRect( transitionArrowsBoxTl, transitionArrowsBoxSize ); |
|
658 |
|
659 |
|
660 TInt widthAndheight = STATIC_CAST( TInt, rect.iBr.iX * 0.068182 ); |
|
661 |
|
662 iInfoDisplay->SetArrowSize(TSize( widthAndheight, widthAndheight )); |
|
663 iArrowsDisplay->SetArrowSize(TSize( widthAndheight, widthAndheight )); |
|
664 |
|
665 // video display when cursor is on transition. |
|
666 iVideoDisplayBoxOnTransition = TRect( TPoint(STATIC_CAST( TInt, 0.341*rect.iBr.iX), |
|
667 iTransitionDisplayLeftBox.iTl.iY), iTransitionDisplayRightBox.Size() ); |
|
668 |
|
669 iDummyCutBarBoxOnTransition = TRect( TPoint(iTransitionDisplayRightBox.iTl.iX, |
|
670 iTransitionDisplayRightBox.iBr.iY - iVideoDisplay->GetBorderWidth()), |
|
671 TSize( iTransitionDisplayRightBox.Width(), iDummyCutBarBox.Height() )); |
|
672 } |
|
673 |
|
674 iInfoDisplay->SetRect( iInfoDisplayBox ); |
|
675 iInfoDisplay->SetLandscapeScreenOrientation( landscape ); |
|
676 iArrowsDisplay->SetRect(iSlowMotionBox); |
|
677 |
|
678 AknIconUtils::SetSize( iNoThumbnailIcon, TSize( iVideoDisplayBox.Size() ) ); |
|
679 AknIconUtils::SetSize( iAudioIcon, TSize( iVideoDisplayBox.Size() ) ); |
|
680 AknIconUtils::SetSize( iPauseBitmap, TSize( iPauseIconBox.Size() ), EAspectRatioNotPreserved ); |
|
681 |
|
682 // Update iconbox after screen rotation |
|
683 iEffectSymbols->SetRect( iEffectSymbolBox ); |
|
684 if ( CursorLocation() == ECursorOnTransition && |
|
685 iView.EditorState() != CVeiEditVideoView::EPreview ) |
|
686 { |
|
687 SetCursorLocation( CursorLocation() ); |
|
688 } |
|
689 |
|
690 iArrowsDisplay->DrawDeferred(); |
|
691 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer SizeChanged: Out"); |
|
692 } |
|
693 |
|
694 TInt CVeiEditVideoContainer::CurrentIndex() const |
|
695 { |
|
696 if ((iCursorLocation == ECursorOnAudio) || |
|
697 (iCursorLocation == ECursorOnEmptyAudioTrack)) |
|
698 { |
|
699 return iAudioCursorPos; |
|
700 } |
|
701 else |
|
702 { |
|
703 if ( iCursorLocation == ECursorOnEmptyVideoTrack ) |
|
704 { |
|
705 return iMovie.VideoClipCount() - 1; |
|
706 } |
|
707 |
|
708 return iVideoCursorPos; |
|
709 } |
|
710 } |
|
711 |
|
712 TUint CVeiEditVideoContainer::GetAndDecrementCurrentIndex() |
|
713 { |
|
714 TUint ret = 0; |
|
715 |
|
716 if ( iCursorLocation == ECursorOnClip ) |
|
717 { |
|
718 ret = iVideoCursorPos; |
|
719 if ( iVideoCursorPos > 0 ) |
|
720 { |
|
721 iVideoCursorPos--; |
|
722 } |
|
723 } |
|
724 else if ( iCursorLocation == ECursorOnAudio ) |
|
725 { |
|
726 ret = iAudioCursorPos; |
|
727 if ( iAudioCursorPos > 0 ) |
|
728 { |
|
729 iAudioCursorPos--; |
|
730 } |
|
731 } |
|
732 else |
|
733 { |
|
734 User::Panic( _L("VideoEditor"), 0 ); |
|
735 } |
|
736 return ret; |
|
737 } |
|
738 |
|
739 void CVeiEditVideoContainer::GetThumbAtL( const TTimeIntervalMicroSeconds& aTime ) |
|
740 { |
|
741 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::GetThumbAtL: In, iFrameReady:%d", iFrameReady); |
|
742 if( !iTempVideoInfo || !iFrameReady ) |
|
743 { |
|
744 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetThumbAtL: 1"); |
|
745 return; |
|
746 } |
|
747 |
|
748 TSize resolution( iTempVideoInfo->Resolution() ); |
|
749 TInt frameIndex = iTempVideoInfo->GetVideoFrameIndexL( aTime ); |
|
750 |
|
751 TInt totalFrameCount = iTempVideoInfo->VideoFrameCount(); |
|
752 iFrameReady = EFalse; |
|
753 if ( frameIndex > totalFrameCount ) |
|
754 { |
|
755 frameIndex = totalFrameCount; |
|
756 } |
|
757 |
|
758 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetThumbAtL: 2"); |
|
759 /* : |
|
760 check out on every phone before releasing whether videodisplay should be stopped before starting |
|
761 asynchronous GetFrameL() |
|
762 see how EStateGettingFrame is handled in SetPreviewState |
|
763 Stopping frees memory and it is needed in memory sensible devices |
|
764 */ |
|
765 iTempVideoInfo->GetFrameL( *this, frameIndex, &resolution ); |
|
766 SetPreviewState(EStateGettingFrame); |
|
767 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetThumbAtL: Out"); |
|
768 } |
|
769 |
|
770 void CVeiEditVideoContainer::StartZooming() |
|
771 { |
|
772 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartZooming: In"); |
|
773 |
|
774 const TUint delay = 90000; |
|
775 |
|
776 if (iView.EditorState() != CVeiEditVideoView::EQuickPreview ) |
|
777 { |
|
778 iZoomFactorX = 0; |
|
779 iZoomFactorY = 0; |
|
780 } |
|
781 else |
|
782 { |
|
783 iZoomFactorX = KMaxZoomFactorX; |
|
784 iZoomFactorY = KMaxZoomFactorY; |
|
785 } |
|
786 |
|
787 if ( iZoomTimer->IsActive() ) |
|
788 { |
|
789 iZoomTimer->Cancel(); |
|
790 } |
|
791 iZoomTimer->Start( delay, delay, TCallBack( CVeiEditVideoContainer::Update, this ) ); |
|
792 |
|
793 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartZooming: Out"); |
|
794 } |
|
795 |
|
796 TKeyResponse CVeiEditVideoContainer::HandleScrollBarL ( |
|
797 const TKeyEvent & aKeyEvent, |
|
798 TEventCode aType |
|
799 ) |
|
800 { |
|
801 TKeyResponse ret = EKeyWasNotConsumed; |
|
802 |
|
803 if (EEventKey == aType) |
|
804 { |
|
805 switch (aKeyEvent.iCode) |
|
806 { |
|
807 |
|
808 case EKeyDownArrow: |
|
809 { |
|
810 iVerticalSlider->Increment(); |
|
811 iVerticalSlider->DrawDeferred(); |
|
812 ret = EKeyWasConsumed; |
|
813 break; |
|
814 } |
|
815 case EKeyUpArrow: |
|
816 { |
|
817 iVerticalSlider->Decrement(); |
|
818 iVerticalSlider->DrawDeferred(); |
|
819 ret = EKeyWasConsumed; |
|
820 break; |
|
821 } |
|
822 |
|
823 case EKeyLeftArrow: |
|
824 { |
|
825 iHorizontalSlider->Decrement(); |
|
826 iHorizontalSlider->DrawDeferred(); |
|
827 ret = EKeyWasConsumed; |
|
828 break; |
|
829 } |
|
830 case EKeyRightArrow: |
|
831 { |
|
832 iHorizontalSlider->Increment(); |
|
833 iHorizontalSlider->DrawDeferred(); |
|
834 ret = EKeyWasConsumed; |
|
835 break; |
|
836 } |
|
837 |
|
838 case EKeyOK: |
|
839 { |
|
840 ret = EKeyWasConsumed; |
|
841 break; |
|
842 } |
|
843 |
|
844 /*case EKeyLeftArrow: |
|
845 case EKeyRightArrow: |
|
846 { |
|
847 ret = EKeyWasConsumed; |
|
848 break; |
|
849 }*/ |
|
850 |
|
851 default: |
|
852 { |
|
853 break; |
|
854 } |
|
855 } |
|
856 } |
|
857 |
|
858 return ret; |
|
859 } |
|
860 |
|
861 |
|
862 TKeyResponse CVeiEditVideoContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) |
|
863 { |
|
864 if (EModeMixingAudio == iSelectionMode || EModeAdjustVolume == iSelectionMode) |
|
865 { |
|
866 CVeiEditVideoView::TEditorState editorState = iView.EditorState(); |
|
867 if (CVeiEditVideoView::EMixAudio == editorState || |
|
868 CVeiEditVideoView::EAdjustVolume == editorState) |
|
869 { |
|
870 TKeyResponse ret = HandleScrollBarL(aKeyEvent, aType); |
|
871 DrawDeferred(); |
|
872 return ret; |
|
873 } |
|
874 } |
|
875 |
|
876 if ( iSeeking ) |
|
877 { |
|
878 DoUpdatePosition(); |
|
879 } |
|
880 |
|
881 if ( aType == EEventKeyDown ) |
|
882 { |
|
883 |
|
884 if ( iView.EditorState() == CVeiEditVideoView::EPreview )//large preview |
|
885 { |
|
886 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::OfferKeyEventL preview back"); |
|
887 iVideoDisplay->Stop( ETrue ); |
|
888 iBackKeyPressed = ETrue; |
|
889 SetBlackScreen( EFalse ); |
|
890 } |
|
891 |
|
892 iKeyRepeatCount = 0; |
|
893 |
|
894 // Shift key check. move clip - state |
|
895 TBool shiftKeyPressed = (aKeyEvent.iModifiers & EModifierShift ); |
|
896 if( shiftKeyPressed ) |
|
897 { |
|
898 if ( (iView.EditorState() == CVeiEditVideoView::EPreview ) && |
|
899 (iPreviewState == EStatePlaying ))//large preview |
|
900 { |
|
901 iVideoDisplay->Stop( ETrue ); |
|
902 |
|
903 iView.SetFullScreenSelected( EFalse ); |
|
904 SetBlackScreen( EFalse ); |
|
905 return EKeyWasConsumed; |
|
906 } |
|
907 else if (((((iCursorLocation == ECursorOnClip) && (iMovie.VideoClipCount()>1) ) && (iView.EditorState() != CVeiEditVideoView::EQuickPreview)) || |
|
908 ( (iCursorLocation == ECursorOnAudio) && (iMovie.AudioClipCount()>0) ) ) && |
|
909 iSelectionMode == EModeNavigation ) |
|
910 { |
|
911 iView.ProcessCommandL( EVeiCmdEditVideoViewEditVideoMove ); |
|
912 return EKeyWasConsumed; |
|
913 } |
|
914 else if (iView.EditorState() == CVeiEditVideoView::EQuickPreview) |
|
915 { |
|
916 if( iView.IsEnoughFreeSpaceToSaveL() && !iTakeSnapshot ) |
|
917 { |
|
918 /*if (EStatePlaying == iPreviewState) |
|
919 { |
|
920 PauseVideoL(); |
|
921 } |
|
922 */ |
|
923 TakeSnapshotL(); |
|
924 return EKeyWasConsumed; |
|
925 } |
|
926 } |
|
927 return EKeyWasNotConsumed; |
|
928 } |
|
929 //Check that it's a seeking key and we're in a suitable state. |
|
930 if ( iPreviewState != EStatePlaying ) |
|
931 { |
|
932 return EKeyWasNotConsumed; |
|
933 } |
|
934 |
|
935 iSeekPos = iVideoDisplay->PositionL(); |
|
936 |
|
937 return EKeyWasConsumed; |
|
938 } |
|
939 else if ( aType == EEventKeyUp ) |
|
940 { |
|
941 iBackKeyPressed = EFalse; |
|
942 |
|
943 if ( (iView.EditorState() == CVeiEditVideoView::EPreview ) && |
|
944 (iPreviewState == EStatePaused ))//large preview |
|
945 { |
|
946 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::OfferKeyEventL preview back"); |
|
947 iVideoDisplay->Stop( ETrue ); |
|
948 iBackKeyPressed = ETrue; |
|
949 SetBlackScreen( EFalse ); |
|
950 } |
|
951 |
|
952 |
|
953 if ( iSeeking == EFalse ) |
|
954 { |
|
955 return EKeyWasNotConsumed; |
|
956 } |
|
957 iLastPosition = iSeekPos; |
|
958 |
|
959 iSeeking = EFalse; |
|
960 |
|
961 if ( (iPreviewState == EStatePaused || iPreviewState == EStateStopped) && |
|
962 (iLastKeyCode == EKeyLeftArrow || iLastKeyCode == EKeyRightArrow) ) |
|
963 { |
|
964 GetThumbAtL( iSeekPos ); |
|
965 return EKeyWasConsumed; |
|
966 } |
|
967 else if ( iPreviewState == EStatePlaying ) |
|
968 { |
|
969 if ( iTempVideoInfo && (iSeekPos >= iTempVideoInfo->Duration().Int64()) ) |
|
970 { |
|
971 iVideoDisplay->Stop( EFalse ); |
|
972 } |
|
973 else |
|
974 { |
|
975 iVideoDisplay->SetPositionL( iSeekPos ); |
|
976 iVideoDisplay->ShowBlackScreen(); |
|
977 DrawDeferred(); |
|
978 if ( iTempVideoInfo && !iFrameReady) |
|
979 { |
|
980 iTempVideoInfo->CancelFrame(); |
|
981 } |
|
982 iVideoDisplay->Play(); |
|
983 } |
|
984 return EKeyWasConsumed; |
|
985 } |
|
986 else |
|
987 { |
|
988 return EKeyWasConsumed; |
|
989 } |
|
990 } |
|
991 else if ( aType == EEventKey ) |
|
992 { |
|
993 iLastKeyCode = aKeyEvent.iCode; |
|
994 iKeyRepeatCount++; |
|
995 |
|
996 if( iBackKeyPressed ) |
|
997 { |
|
998 iView.SetFullScreenSelected( EFalse ); |
|
999 } |
|
1000 |
|
1001 if ( iView.EditorState() == CVeiEditVideoView::EPreview )//large preview |
|
1002 { |
|
1003 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::OfferKeyEventL preview back"); |
|
1004 iVideoDisplay->Stop( ETrue ); |
|
1005 iBackKeyPressed = ETrue; |
|
1006 SetBlackScreen( EFalse ); |
|
1007 } |
|
1008 |
|
1009 switch ( aKeyEvent.iCode ) |
|
1010 { |
|
1011 case EKeyOK: |
|
1012 { |
|
1013 if ( iBackKeyPressed ) |
|
1014 { |
|
1015 return EKeyWasNotConsumed; |
|
1016 } |
|
1017 if ( iView.EditorState() == CVeiEditVideoView::EPreview ) |
|
1018 { |
|
1019 iView.HandleCommandL( EAknSoftkeyBack ); |
|
1020 return EKeyWasConsumed; |
|
1021 } |
|
1022 |
|
1023 if ( ( iCursorLocation == ECursorOnClip && iMovie.VideoClipCount() == 0 ) || |
|
1024 ( iCursorLocation == ECursorOnEmptyVideoTrack ) ) |
|
1025 { |
|
1026 iView.Popup()->ShowInsertStuffPopupList(); |
|
1027 } |
|
1028 else if ( ( iSelectionMode == EModeRecordingSetStart ) || |
|
1029 ( iSelectionMode == EModeRecording ) || |
|
1030 ( iSelectionMode == EModeRecordingPaused ) ) |
|
1031 { |
|
1032 return EKeyWasConsumed; |
|
1033 } |
|
1034 else if ( ( iCursorLocation == ECursorOnAudio && iMovie.AudioClipCount() == 0 ) || |
|
1035 ( iCursorLocation == ECursorOnEmptyAudioTrack ) ) |
|
1036 { |
|
1037 iView.Popup()->ShowInsertAudioPopupList(); |
|
1038 } |
|
1039 else if ( ( iCursorLocation == ECursorOnClip || iCursorLocation == ECursorOnAudio ) |
|
1040 && ( iSelectionMode == EModeMove ) ) |
|
1041 { |
|
1042 iView.HandleCommandL( EAknSoftkeyOk ); |
|
1043 } |
|
1044 |
|
1045 else if (iCursorLocation == ECursorOnClip && iSelectionMode == EModeDuration) |
|
1046 { |
|
1047 iView.HandleCommandL( EAknSoftkeyOk ); |
|
1048 } |
|
1049 else if( iSelectionMode == EModeSlowMotion && iCursorLocation == ECursorOnClip ) |
|
1050 { |
|
1051 SetSelectionMode( CVeiEditVideoContainer::EModeSlowMotion ); |
|
1052 iView.HandleCommandL( EAknSoftkeyOk ); |
|
1053 iInfoDisplay->SetSlowMotionOn( EFalse ); |
|
1054 iInfoDisplay->SetLayout( CVeiTextDisplay::ENameAndDuration ); |
|
1055 |
|
1056 ArrowsControl(); |
|
1057 } |
|
1058 else if ( iSelectionMode == EModeDuration && iCursorLocation == ECursorOnAudio ) |
|
1059 { |
|
1060 iView.HandleCommandL( EAknSoftkeyOk ); |
|
1061 } |
|
1062 |
|
1063 else |
|
1064 { |
|
1065 if (EStateGettingFrame != iPreviewState && EStateBuffering != iPreviewState && |
|
1066 EStateTerminating != iPreviewState && EStateOpening != iPreviewState) |
|
1067 { |
|
1068 iView.ProcessCommandL( EVeiCmdEditVideoViewContainerShowMenu ); |
|
1069 } |
|
1070 } |
|
1071 |
|
1072 return EKeyWasConsumed; |
|
1073 }// case EKeyOk |
|
1074 |
|
1075 case EKeyRightArrow: |
|
1076 { |
|
1077 if ( iView.EditorState() == CVeiEditVideoView::EQuickPreview ) |
|
1078 { |
|
1079 if ( (iKeyRepeatCount > 2) && (iSeeking == EFalse) ) |
|
1080 { |
|
1081 if ( iPreviewState == EStatePlaying ) |
|
1082 { |
|
1083 iLastPosition = iVideoDisplay->PositionL(); |
|
1084 iSeekPos = iVideoDisplay->PositionL(); |
|
1085 } |
|
1086 |
|
1087 iVideoDisplay->PauseL(); |
|
1088 if (iPeriodic) |
|
1089 { |
|
1090 iPeriodic->Cancel(); |
|
1091 } |
|
1092 iSeeking = ETrue; |
|
1093 iKeyRepeatCount = 0; |
|
1094 } |
|
1095 |
|
1096 if ( iSeeking &&( iPreviewState == EStateStopped ) || |
|
1097 ( iPreviewState == EStatePlaying ) || |
|
1098 ( iPreviewState == EStatePaused ) ) |
|
1099 { |
|
1100 TInt adjustment = TimeIncrement( iKeyRepeatCount ); |
|
1101 |
|
1102 TInt64 newPos = iSeekPos.Int64() + adjustment; |
|
1103 |
|
1104 if ( iTempVideoInfo && (newPos > iTempVideoInfo->Duration().Int64()) ) |
|
1105 { |
|
1106 newPos = iTempVideoInfo->Duration().Int64(); |
|
1107 } |
|
1108 |
|
1109 iSeekPos = TTimeIntervalMicroSeconds( newPos ); |
|
1110 |
|
1111 iView.DoUpdateEditNaviLabelL(); |
|
1112 return EKeyWasConsumed; |
|
1113 } |
|
1114 } |
|
1115 |
|
1116 if ( iView.EditorState() != CVeiEditVideoView::EEdit || iBackKeyPressed ) |
|
1117 { |
|
1118 return EKeyWasNotConsumed; |
|
1119 } |
|
1120 if ( iCursorLocation == ECursorOnClip ) |
|
1121 { |
|
1122 //SM - RIGHT = MORE |
|
1123 if((iSelectionMode == EModeSlowMotion) && (iCursorLocation == ECursorOnClip)) |
|
1124 { |
|
1125 if( iSlowMotionValue < 1000) |
|
1126 { |
|
1127 iVideoDisplay->SetFrameIntervalL( -25 ); |
|
1128 iSlowMotionValue = iSlowMotionValue + 50; |
|
1129 iMovie.VideoClipSetSpeed( CurrentIndex(), iSlowMotionValue ); |
|
1130 iArrowsDisplay->SetSlowMotionPreset( iSlowMotionValue / 10); |
|
1131 ArrowsControl(); |
|
1132 } |
|
1133 return EKeyWasConsumed; |
|
1134 } |
|
1135 |
|
1136 if ( iSelectionMode == EModeNavigation ) |
|
1137 { |
|
1138 if ( iMovie.VideoClipCount() > 0 ) |
|
1139 { |
|
1140 ++iVideoCursorPos; |
|
1141 SetCursorLocation( ECursorOnTransition ); |
|
1142 } |
|
1143 } |
|
1144 else |
|
1145 { |
|
1146 if ( ( iSelectionMode == EModeMove ) && ( iVideoCursorPos < iMovie.VideoClipCount() - 1 ) ) |
|
1147 { |
|
1148 TInt oldplace = iVideoCursorPos; |
|
1149 ++iVideoCursorPos; |
|
1150 iMovie.VideoClipSetIndex( oldplace, iVideoCursorPos ); |
|
1151 } |
|
1152 } |
|
1153 |
|
1154 if (iSelectionMode == EModeDuration) |
|
1155 { |
|
1156 CVedVideoClipInfo* info = iMovie.VideoClipInfo( iVideoCursorPos ); |
|
1157 |
|
1158 TInt64 newDurationInt = iMovie.VideoClipEditedDuration( iVideoCursorPos ).Int64() + TimeIncrement(iKeyRepeatCount); |
|
1159 |
|
1160 if (info->Class() == EVedVideoClipClassGenerated) |
|
1161 { |
|
1162 if (info->Generator()->Uid() == KUidTitleClipGenerator) |
|
1163 { |
|
1164 CVeiTitleClipGenerator* generator = STATIC_CAST(CVeiTitleClipGenerator*, info->Generator()); |
|
1165 generator->SetDuration(TTimeIntervalMicroSeconds(newDurationInt)); |
|
1166 } |
|
1167 else if (info->Generator()->Uid() == KUidImageClipGenerator) |
|
1168 { |
|
1169 CVeiImageClipGenerator* generator = STATIC_CAST(CVeiImageClipGenerator*, info->Generator()); |
|
1170 generator->SetDuration(TTimeIntervalMicroSeconds(newDurationInt)); |
|
1171 } |
|
1172 } |
|
1173 } |
|
1174 |
|
1175 } // if ( iCursorLocation == ECursorOnClip ) |
|
1176 |
|
1177 else if ( iCursorLocation == ECursorOnTransition ) |
|
1178 { |
|
1179 if ( iVideoCursorPos < iMovie.VideoClipCount() ) |
|
1180 { |
|
1181 SetCursorLocation( ECursorOnClip ); |
|
1182 } |
|
1183 else |
|
1184 { |
|
1185 SetCursorLocation( ECursorOnEmptyVideoTrack ); |
|
1186 } |
|
1187 } |
|
1188 else if ( iCursorLocation == ECursorOnAudio ) |
|
1189 { |
|
1190 if ( iSelectionMode == EModeNavigation ) |
|
1191 { |
|
1192 if ( iAudioCursorPos < iMovie.AudioClipCount() - 1 ) |
|
1193 { |
|
1194 ++iAudioCursorPos; |
|
1195 SetCursorLocation( ECursorOnAudio ); |
|
1196 } |
|
1197 else |
|
1198 { |
|
1199 SetCursorLocation( ECursorOnEmptyAudioTrack ); |
|
1200 } |
|
1201 } |
|
1202 else if ( iSelectionMode == EModeMove ) |
|
1203 { |
|
1204 return MoveAudioRight(); |
|
1205 } |
|
1206 else if (iSelectionMode == EModeDuration) |
|
1207 { |
|
1208 |
|
1209 TTimeIntervalMicroSeconds clipCutOutTime = iMovie.AudioClipCutOutTime( iAudioCursorPos ); |
|
1210 |
|
1211 TInt64 newEndTimeInt = clipCutOutTime.Int64() + TimeIncrement(iKeyRepeatCount); |
|
1212 |
|
1213 if (iAudioCursorPos < (iMovie.AudioClipCount() - 1)) |
|
1214 { |
|
1215 TInt64 nextStartTimeInt = iMovie.AudioClipStartTime( iAudioCursorPos + 1 ).Int64(); |
|
1216 TInt64 currentEndTimeInt = iMovie.AudioClipEndTime( iAudioCursorPos ).Int64() + TimeIncrement(iKeyRepeatCount); |
|
1217 |
|
1218 if ( currentEndTimeInt > nextStartTimeInt) |
|
1219 { |
|
1220 newEndTimeInt = nextStartTimeInt - iMovie.AudioClipStartTime( iAudioCursorPos ).Int64(); |
|
1221 } |
|
1222 } |
|
1223 CVedAudioClipInfo* audioclipinfo = iMovie.AudioClipInfo( iAudioCursorPos ); |
|
1224 if (newEndTimeInt > audioclipinfo->Duration().Int64() ) |
|
1225 { |
|
1226 newEndTimeInt = audioclipinfo->Duration().Int64(); |
|
1227 } |
|
1228 iMovie.AudioClipSetCutOutTime( iAudioCursorPos, TTimeIntervalMicroSeconds( newEndTimeInt ) ); |
|
1229 } |
|
1230 } // else if ( iCursorLocation == ECursorOnAudio ) |
|
1231 DrawDeferred(); |
|
1232 |
|
1233 return EKeyWasConsumed; |
|
1234 } // case EKeyRightArrow |
|
1235 case EKeyLeftArrow: |
|
1236 { |
|
1237 if ( iView.EditorState() == CVeiEditVideoView::EQuickPreview ) |
|
1238 { |
|
1239 iKeyRepeatCount++; |
|
1240 |
|
1241 if ( (iKeyRepeatCount > 2) && (iSeeking == EFalse) ) |
|
1242 { |
|
1243 |
|
1244 if ( iPreviewState == EStatePlaying ) |
|
1245 { |
|
1246 iLastPosition = iVideoDisplay->PositionL(); |
|
1247 iSeekPos = iVideoDisplay->PositionL(); |
|
1248 } |
|
1249 |
|
1250 iVideoDisplay->PauseL(); |
|
1251 if (iPeriodic) |
|
1252 { |
|
1253 iPeriodic->Cancel(); |
|
1254 } |
|
1255 iSeeking = ETrue; |
|
1256 |
|
1257 iKeyRepeatCount = 0; |
|
1258 } |
|
1259 |
|
1260 if ( iSeeking&&( iPreviewState == EStateStopped ) || |
|
1261 ( iPreviewState == EStatePlaying ) || |
|
1262 ( iPreviewState == EStatePaused ) ) |
|
1263 { |
|
1264 TInt adjustment = TimeIncrement( iKeyRepeatCount ); |
|
1265 |
|
1266 TInt64 newPos = iSeekPos.Int64() - adjustment; |
|
1267 if ( newPos < 0 ) |
|
1268 { |
|
1269 newPos = 0; |
|
1270 } |
|
1271 iSeekPos = TTimeIntervalMicroSeconds( newPos ); |
|
1272 |
|
1273 iView.DoUpdateEditNaviLabelL(); |
|
1274 return EKeyWasConsumed; |
|
1275 } |
|
1276 } |
|
1277 |
|
1278 if ( iView.EditorState() != CVeiEditVideoView::EEdit || iBackKeyPressed ) |
|
1279 { |
|
1280 return EKeyWasNotConsumed; |
|
1281 } |
|
1282 if ( iCursorLocation == ECursorOnClip ) |
|
1283 { |
|
1284 // SM - LEFT = LESS |
|
1285 if(( iSelectionMode == EModeSlowMotion) && (iCursorLocation == ECursorOnClip)) |
|
1286 { |
|
1287 |
|
1288 if( iSlowMotionValue > 250) |
|
1289 { |
|
1290 iVideoDisplay->SetFrameIntervalL( 25 ); |
|
1291 iSlowMotionValue = iSlowMotionValue - 50; |
|
1292 iMovie.VideoClipSetSpeed( CurrentIndex(), iSlowMotionValue ); |
|
1293 iArrowsDisplay->SetSlowMotionPreset( iSlowMotionValue / 10); |
|
1294 ArrowsControl(); |
|
1295 } |
|
1296 return EKeyWasConsumed; |
|
1297 } |
|
1298 |
|
1299 |
|
1300 if ( iSelectionMode == EModeNavigation ) |
|
1301 { |
|
1302 if ( iMovie.VideoClipCount() > 0 ) |
|
1303 { |
|
1304 SetCursorLocation( ECursorOnTransition ); |
|
1305 } |
|
1306 } |
|
1307 else |
|
1308 { |
|
1309 if ( ( iSelectionMode == EModeMove ) && ( iVideoCursorPos > 0 ) ) |
|
1310 { |
|
1311 TInt oldplace = iVideoCursorPos; |
|
1312 iVideoCursorPos--; |
|
1313 iMovie.VideoClipSetIndex( oldplace, iVideoCursorPos ); |
|
1314 } |
|
1315 } |
|
1316 |
|
1317 if (iSelectionMode == EModeDuration) |
|
1318 { |
|
1319 TInt64 newDurationInt = iMovie.VideoClipEditedDuration(iVideoCursorPos).Int64() - TimeIncrement(iKeyRepeatCount); |
|
1320 |
|
1321 if (newDurationInt < 1000000) |
|
1322 { |
|
1323 newDurationInt = 1000000; |
|
1324 } |
|
1325 |
|
1326 CVedVideoClipInfo* info = iMovie.VideoClipInfo(iVideoCursorPos); |
|
1327 if (info->Class() == EVedVideoClipClassGenerated) |
|
1328 { |
|
1329 if (info->Generator()->Uid() == KUidTitleClipGenerator) |
|
1330 { |
|
1331 CVeiTitleClipGenerator* generator = STATIC_CAST(CVeiTitleClipGenerator*, info->Generator()); |
|
1332 generator->SetDuration(TTimeIntervalMicroSeconds(newDurationInt)); |
|
1333 } |
|
1334 else if (info->Generator()->Uid() == KUidImageClipGenerator) |
|
1335 { |
|
1336 CVeiImageClipGenerator* generator = STATIC_CAST(CVeiImageClipGenerator*, info->Generator()); |
|
1337 generator->SetDuration(TTimeIntervalMicroSeconds(newDurationInt)); |
|
1338 } |
|
1339 } |
|
1340 } |
|
1341 |
|
1342 } |
|
1343 else if ( iCursorLocation == ECursorOnTransition ) |
|
1344 { |
|
1345 if ( iVideoCursorPos > 0 ) |
|
1346 { |
|
1347 --iVideoCursorPos; |
|
1348 SetCursorLocation( ECursorOnClip ); |
|
1349 } |
|
1350 } |
|
1351 else if ( iCursorLocation == ECursorOnAudio ) |
|
1352 { |
|
1353 if ( iSelectionMode == EModeNavigation ) |
|
1354 { |
|
1355 if ( iAudioCursorPos > 0 ) |
|
1356 { |
|
1357 iAudioCursorPos--; |
|
1358 SetCursorLocation( ECursorOnAudio ); |
|
1359 } |
|
1360 } |
|
1361 else if (iSelectionMode == EModeMove) |
|
1362 { |
|
1363 return MoveAudioLeft(); |
|
1364 } |
|
1365 else if (iSelectionMode == EModeDuration) |
|
1366 { |
|
1367 |
|
1368 TInt64 newDurationInt = iMovie.AudioClipCutOutTime( iAudioCursorPos ).Int64() - TimeIncrement(iKeyRepeatCount); |
|
1369 if (newDurationInt < 1000000) |
|
1370 { |
|
1371 newDurationInt = 1000000; |
|
1372 } |
|
1373 TInt64 newEndTimeInt = iMovie.AudioClipStartTime( iAudioCursorPos ).Int64() + newDurationInt; |
|
1374 for (TInt i = iMovie.VideoClipCount() - 1; i >= 0; i--) |
|
1375 { |
|
1376 if ( ( iMovie.AudioClipEndTime( iAudioCursorPos ) > iMovie.VideoClipEndTime( i ) ) && |
|
1377 TTimeIntervalMicroSeconds(newEndTimeInt) < iMovie.VideoClipEndTime( i ) ) |
|
1378 { |
|
1379 newDurationInt = iMovie.VideoClipEndTime( i ).Int64() - iMovie.AudioClipStartTime( iAudioCursorPos ).Int64(); |
|
1380 break; |
|
1381 } |
|
1382 } |
|
1383 if ( newDurationInt < ( iMovie.AudioClipCutInTime( iAudioCursorPos ).Int64() ) ) |
|
1384 { |
|
1385 newDurationInt = iMovie.AudioClipCutInTime( iAudioCursorPos ).Int64(); |
|
1386 } |
|
1387 iMovie.AudioClipSetCutOutTime( iAudioCursorPos, TTimeIntervalMicroSeconds( newDurationInt ) ); |
|
1388 } |
|
1389 } |
|
1390 |
|
1391 else if ( iCursorLocation == ECursorOnEmptyVideoTrack ) |
|
1392 { |
|
1393 if ( iMovie.VideoClipCount() > 0 ) |
|
1394 { |
|
1395 SetCursorLocation( ECursorOnTransition ); |
|
1396 } |
|
1397 } |
|
1398 else if ( iCursorLocation == ECursorOnEmptyAudioTrack ) |
|
1399 { |
|
1400 if ( iMovie.AudioClipCount() > 0 ) |
|
1401 { |
|
1402 SetCursorLocation( ECursorOnAudio ); |
|
1403 } |
|
1404 } |
|
1405 |
|
1406 DrawDeferred(); |
|
1407 return EKeyWasConsumed; |
|
1408 } // EKeyLeftArrow |
|
1409 |
|
1410 case EKeyUpArrow: |
|
1411 case EStdKeyIncVolume: |
|
1412 { |
|
1413 if ( iView.EditorState() != CVeiEditVideoView::EEdit || iBackKeyPressed ) |
|
1414 { |
|
1415 if ( iView.EditorState() == CVeiEditVideoView::EQuickPreview ) |
|
1416 { |
|
1417 iVideoDisplay->OfferKeyEventL( aKeyEvent, aType ); |
|
1418 return EKeyWasConsumed; |
|
1419 } |
|
1420 return EKeyWasNotConsumed; |
|
1421 } |
|
1422 if ( ((iCursorLocation==ECursorOnAudio) || (iCursorLocation==ECursorOnEmptyAudioTrack) ) |
|
1423 && (iSelectionMode == EModeNavigation ) ) |
|
1424 { |
|
1425 SetCursorLocation( iPrevCursorLocation ); |
|
1426 DrawDeferred(); |
|
1427 return EKeyWasConsumed; |
|
1428 } |
|
1429 else if ( iCursorLocation == ECursorOnTransition ) |
|
1430 { |
|
1431 iView.HandleCommandL( EVeiCmdEditVideoViewTransitionKeyUp ); |
|
1432 return EKeyWasConsumed; |
|
1433 } |
|
1434 else |
|
1435 { |
|
1436 return EKeyWasNotConsumed; |
|
1437 } |
|
1438 } |
|
1439 case EKeyDownArrow: |
|
1440 case EStdKeyDecVolume: |
|
1441 { |
|
1442 if ( iView.EditorState() != CVeiEditVideoView::EEdit || iBackKeyPressed ) |
|
1443 { |
|
1444 if ( iView.EditorState() == CVeiEditVideoView::EQuickPreview ) |
|
1445 { |
|
1446 iVideoDisplay->OfferKeyEventL( aKeyEvent, aType ); |
|
1447 return EKeyWasConsumed; |
|
1448 } |
|
1449 return EKeyWasNotConsumed; |
|
1450 } |
|
1451 if ( iCursorLocation == ECursorOnTransition ) |
|
1452 { |
|
1453 iView.HandleCommandL( EVeiCmdEditVideoViewTransitionKeyDown ); |
|
1454 return EKeyWasConsumed; |
|
1455 } |
|
1456 else if ( (iCursorLocation != ECursorOnAudio )&& (iSelectionMode == EModeNavigation) && |
|
1457 (iCursorLocation != ECursorOnEmptyAudioTrack ) ) |
|
1458 { |
|
1459 iPrevCursorLocation = iCursorLocation; |
|
1460 SetCursorLocation( ECursorOnAudio ); |
|
1461 DrawDeferred(); |
|
1462 return EKeyWasConsumed; |
|
1463 } |
|
1464 else |
|
1465 { |
|
1466 return EKeyWasNotConsumed; |
|
1467 } |
|
1468 } |
|
1469 case EKeyBackspace: //Clear 0x08 |
|
1470 { |
|
1471 if ( iView.EditorState() != CVeiEditVideoView::EEdit || iBackKeyPressed ) |
|
1472 { |
|
1473 return EKeyWasNotConsumed; |
|
1474 } |
|
1475 if ( ( ( iCursorLocation == ECursorOnClip ) || ( iCursorLocation == ECursorOnAudio ) ) |
|
1476 && ( ( iMovie.VideoClipCount() > 0 ) || ( iMovie.AudioClipCount() > 0 ) ) && ( iSelectionMode == EModeNavigation ) ) |
|
1477 { |
|
1478 iView.ProcessCommandL( EVeiCmdEditVideoViewEditVideoRemove ); |
|
1479 return EKeyWasConsumed; |
|
1480 } |
|
1481 else if ((iCursorLocation == ECursorOnTransition) && (iSelectionMode == EModeNavigation)) |
|
1482 { |
|
1483 iView.ProcessCommandL( EVeiCmdEditVideoViewTransitionNone ); |
|
1484 } |
|
1485 else if ( ( iSelectionMode == EModeSlowMotion )) |
|
1486 { |
|
1487 return EKeyWasNotConsumed; |
|
1488 } |
|
1489 return EKeyWasNotConsumed; |
|
1490 } |
|
1491 case EKeyYes: //Send 63586 |
|
1492 { |
|
1493 if ( iView.EditorState() != CVeiEditVideoView::EEdit || iBackKeyPressed ) |
|
1494 { |
|
1495 return EKeyWasNotConsumed; |
|
1496 } |
|
1497 if ( iSelectionMode == EModeNavigation ) |
|
1498 { |
|
1499 iView.SetSendKey( ETrue ); |
|
1500 iView.ProcessCommandL( EVeiCmdSendMovie ); |
|
1501 return EKeyWasConsumed; |
|
1502 } |
|
1503 break; |
|
1504 } |
|
1505 default: |
|
1506 { |
|
1507 return EKeyWasNotConsumed; |
|
1508 } |
|
1509 } |
|
1510 } |
|
1511 return EKeyWasNotConsumed; |
|
1512 } |
|
1513 |
|
1514 |
|
1515 TKeyResponse CVeiEditVideoContainer::MoveAudioLeft() |
|
1516 { |
|
1517 TInt i; |
|
1518 |
|
1519 TInt index = iAudioCursorPos; |
|
1520 |
|
1521 if ( iAudioCursorPos > 0 ) |
|
1522 { |
|
1523 TTimeIntervalMicroSeconds startTime = iMovie.AudioClipStartTime( iAudioCursorPos ); //second |
|
1524 TTimeIntervalMicroSeconds prevEndTime = iMovie.AudioClipEndTime( iAudioCursorPos-1 ); //first |
|
1525 |
|
1526 if ( startTime == prevEndTime ) |
|
1527 { |
|
1528 TInt newIndex = iAudioCursorPos - 1; |
|
1529 while ( newIndex > 0 ) |
|
1530 { |
|
1531 TTimeIntervalMicroSeconds newNextStartTime = iMovie.AudioClipStartTime( newIndex ); //first |
|
1532 TTimeIntervalMicroSeconds newPrevEndTime = iMovie.AudioClipEndTime( newIndex - 1); |
|
1533 |
|
1534 if ( newPrevEndTime == newNextStartTime ) |
|
1535 { |
|
1536 newIndex--; |
|
1537 } |
|
1538 else |
|
1539 { |
|
1540 break; |
|
1541 } |
|
1542 } |
|
1543 if ( ( newIndex == 0 ) && ( iMovie.AudioClipStartTime( 0 ) == TTimeIntervalMicroSeconds(0) ) ) |
|
1544 { |
|
1545 return EKeyWasConsumed; |
|
1546 } |
|
1547 |
|
1548 TInt64 newEndTimeInt = iMovie.AudioClipStartTime( newIndex ).Int64(); //first |
|
1549 |
|
1550 TInt64 newStartTimeInt = newEndTimeInt - iView.OriginalAudioDuration().Int64(); |
|
1551 |
|
1552 TInt64 newCutOutTimeInt = (newEndTimeInt - newStartTimeInt) + iMovie.AudioClipCutInTime( index ).Int64(); |
|
1553 |
|
1554 if (newStartTimeInt < 0) |
|
1555 { |
|
1556 newStartTimeInt = 0; |
|
1557 } |
|
1558 |
|
1559 if ( newIndex > 0 ) |
|
1560 { |
|
1561 TInt64 newPrevEndTimeInt = iMovie.AudioClipEndTime( newIndex - 1 ).Int64(); |
|
1562 if ( newStartTimeInt < newPrevEndTimeInt ) |
|
1563 { |
|
1564 newStartTimeInt = newPrevEndTimeInt; |
|
1565 } |
|
1566 } |
|
1567 |
|
1568 if ( (newCutOutTimeInt+newStartTimeInt) > iMovie.AudioClipStartTime( index - 1 ).Int64() ) |
|
1569 { |
|
1570 TInt64 audioStartTime = iMovie.AudioClipStartTime( index - 1 ).Int64(); |
|
1571 newCutOutTimeInt = (audioStartTime - newStartTimeInt) + iMovie.AudioClipCutInTime( index ).Int64(); |
|
1572 } |
|
1573 |
|
1574 iMovie.AudioClipSetStartTime( index,TTimeIntervalMicroSeconds( newStartTimeInt ) ); |
|
1575 iMovie.AudioClipSetCutOutTime( newIndex, TTimeIntervalMicroSeconds( newCutOutTimeInt ) ); |
|
1576 |
|
1577 iAudioCursorPos = newIndex; |
|
1578 |
|
1579 DrawDeferred(); |
|
1580 |
|
1581 return EKeyWasConsumed; |
|
1582 } |
|
1583 } |
|
1584 |
|
1585 TTimeIntervalMicroSeconds audioclipstart = iMovie.AudioClipStartTime( index ); |
|
1586 TTimeIntervalMicroSeconds audioclipend = iMovie.AudioClipEndTime( index ); |
|
1587 TInt64 audioclipeditedduration = iMovie.AudioClipEditedDuration( index ).Int64(); |
|
1588 |
|
1589 TInt64 newStartTimeInt = audioclipstart.Int64() - TimeIncrement( iKeyRepeatCount ); |
|
1590 |
|
1591 if ( newStartTimeInt < 0 ) |
|
1592 { |
|
1593 newStartTimeInt = 0; |
|
1594 } |
|
1595 |
|
1596 for ( i = iMovie.VideoClipCount() - 1; i >= 0; i-- ) |
|
1597 { |
|
1598 TTimeIntervalMicroSeconds endtime = iMovie.VideoClipEndTime( i ); |
|
1599 |
|
1600 if ( ( audioclipstart > endtime ) && TTimeIntervalMicroSeconds(newStartTimeInt) < endtime ) |
|
1601 { |
|
1602 newStartTimeInt = endtime.Int64(); |
|
1603 break; |
|
1604 } |
|
1605 } |
|
1606 |
|
1607 TInt64 newEndTimeInt = newStartTimeInt + audioclipeditedduration; |
|
1608 |
|
1609 for (i = iMovie.VideoClipCount() - 1; i >= 0; i-- ) |
|
1610 { |
|
1611 if ((audioclipend > iMovie.VideoClipEndTime(i)) && TTimeIntervalMicroSeconds(newEndTimeInt) < iMovie.VideoClipEndTime(i)) |
|
1612 { |
|
1613 newStartTimeInt = iMovie.VideoClipEndTime(i).Int64() - audioclipeditedduration; |
|
1614 break; |
|
1615 } |
|
1616 } |
|
1617 |
|
1618 if (iAudioCursorPos > 0) |
|
1619 { |
|
1620 TInt64 prevEndTimeInt = iMovie.AudioClipEndTime( iAudioCursorPos - 1 ).Int64(); |
|
1621 |
|
1622 if (newStartTimeInt < prevEndTimeInt) |
|
1623 { |
|
1624 newStartTimeInt = prevEndTimeInt; |
|
1625 } |
|
1626 } |
|
1627 iMovie.AudioClipSetStartTime( index, TTimeIntervalMicroSeconds(newStartTimeInt) ); |
|
1628 iAudioCursorPos = index; |
|
1629 return EKeyWasConsumed; |
|
1630 } |
|
1631 |
|
1632 |
|
1633 TKeyResponse CVeiEditVideoContainer::MoveAudioRight() |
|
1634 { |
|
1635 TInt i; |
|
1636 TInt index = iAudioCursorPos; |
|
1637 |
|
1638 if ( iAudioCursorPos < ( iMovie.AudioClipCount() - 1 ) ) |
|
1639 { |
|
1640 TTimeIntervalMicroSeconds endTime = iMovie.AudioClipEndTime( iAudioCursorPos ); |
|
1641 TTimeIntervalMicroSeconds nextStartTime = iMovie.AudioClipStartTime( iAudioCursorPos+1 ); |
|
1642 |
|
1643 if (endTime == nextStartTime) |
|
1644 { |
|
1645 TInt newIndex = iAudioCursorPos + 1; |
|
1646 while ( newIndex < ( iMovie.AudioClipCount() - 1 ) ) |
|
1647 { |
|
1648 TTimeIntervalMicroSeconds newPrevEndTime = iMovie.AudioClipEndTime( newIndex ); |
|
1649 TTimeIntervalMicroSeconds newNextStartTime = iMovie.AudioClipStartTime( newIndex+1 ); |
|
1650 |
|
1651 if (newPrevEndTime == newNextStartTime) |
|
1652 { |
|
1653 newIndex++; |
|
1654 } |
|
1655 else |
|
1656 { |
|
1657 break; |
|
1658 } |
|
1659 } |
|
1660 |
|
1661 TInt64 newStartTimeInt = iMovie.AudioClipEndTime( newIndex ).Int64(); |
|
1662 TInt64 newEndTimeInt = newStartTimeInt + iView.OriginalAudioDuration().Int64(); |
|
1663 |
|
1664 TInt64 newCutOutTimeInt = (newEndTimeInt - newStartTimeInt) + iMovie.AudioClipCutInTime( index ).Int64(); |
|
1665 |
|
1666 if ( newIndex < ( iMovie.AudioClipCount()-1 ) ) |
|
1667 { |
|
1668 TInt64 newNextStartTimeInt = iMovie.AudioClipStartTime(newIndex + 1).Int64(); |
|
1669 if ( newEndTimeInt > newNextStartTimeInt ) |
|
1670 { |
|
1671 newEndTimeInt = newNextStartTimeInt; |
|
1672 } |
|
1673 |
|
1674 if ( (newCutOutTimeInt+newStartTimeInt) > iMovie.AudioClipStartTime( newIndex + 1 ).Int64() ) |
|
1675 { |
|
1676 TInt64 audioStartTime = iMovie.AudioClipStartTime( newIndex + 1 ).Int64(); |
|
1677 newCutOutTimeInt = audioStartTime - newStartTimeInt; |
|
1678 } |
|
1679 } |
|
1680 |
|
1681 iMovie.AudioClipSetStartTime( index,TTimeIntervalMicroSeconds( newStartTimeInt ) ); |
|
1682 iMovie.AudioClipSetCutOutTime( newIndex, TTimeIntervalMicroSeconds( newCutOutTimeInt ) ); |
|
1683 |
|
1684 iAudioCursorPos = newIndex; |
|
1685 |
|
1686 DrawDeferred(); |
|
1687 |
|
1688 return EKeyWasConsumed; |
|
1689 } |
|
1690 } |
|
1691 |
|
1692 TInt64 newStartTimeInt = iMovie.AudioClipStartTime( iAudioCursorPos ).Int64() + TimeIncrement( iKeyRepeatCount ); |
|
1693 |
|
1694 for ( i = 0; i < iMovie.VideoClipCount(); i++ ) |
|
1695 { |
|
1696 TTimeIntervalMicroSeconds endtime = iMovie.VideoClipEndTime( i ); |
|
1697 TTimeIntervalMicroSeconds audioclipstart = iMovie.AudioClipStartTime( index ); |
|
1698 |
|
1699 if ( ( audioclipstart < endtime ) && TTimeIntervalMicroSeconds(newStartTimeInt) > endtime ) |
|
1700 { |
|
1701 newStartTimeInt = endtime.Int64(); |
|
1702 break; |
|
1703 } |
|
1704 } |
|
1705 |
|
1706 TInt64 audioclipeditedduration = iMovie.AudioClipEditedDuration( index ).Int64(); |
|
1707 |
|
1708 TInt64 newEndTimeInt = newStartTimeInt + audioclipeditedduration; |
|
1709 TTimeIntervalMicroSeconds audioclipend = iMovie.AudioClipEndTime( index ); |
|
1710 |
|
1711 for (i = 0; i < iMovie.VideoClipCount(); i++) |
|
1712 { |
|
1713 if ( ( audioclipend < iMovie.VideoClipEndTime(i)) && |
|
1714 TTimeIntervalMicroSeconds( newEndTimeInt ) > iMovie.VideoClipEndTime( i ) ) |
|
1715 { |
|
1716 newStartTimeInt = iMovie.VideoClipEndTime(i).Int64() - audioclipeditedduration; |
|
1717 break; |
|
1718 } |
|
1719 } |
|
1720 |
|
1721 if (iAudioCursorPos < (iMovie.AudioClipCount() - 1)) |
|
1722 { |
|
1723 newEndTimeInt = newStartTimeInt + audioclipeditedduration; |
|
1724 TInt64 nextStartTimeInt = iMovie.AudioClipStartTime( iAudioCursorPos + 1 ).Int64(); |
|
1725 |
|
1726 if (newEndTimeInt > nextStartTimeInt) |
|
1727 { |
|
1728 newStartTimeInt -= (newEndTimeInt - nextStartTimeInt); |
|
1729 } |
|
1730 } |
|
1731 iMovie.AudioClipSetStartTime( index, TTimeIntervalMicroSeconds(newStartTimeInt) ); |
|
1732 iAudioCursorPos = index; |
|
1733 return EKeyWasConsumed; |
|
1734 } |
|
1735 |
|
1736 |
|
1737 TInt CVeiEditVideoContainer::TimeIncrement(TInt aKeyCount) const |
|
1738 { |
|
1739 if ( aKeyCount < 3 ) |
|
1740 { |
|
1741 return 100000; |
|
1742 } |
|
1743 else if ( aKeyCount < 4 ) |
|
1744 { |
|
1745 return 300000; |
|
1746 } |
|
1747 else if ( aKeyCount < 5 ) |
|
1748 { |
|
1749 return 500000; |
|
1750 } |
|
1751 else if ( aKeyCount < 19 ) |
|
1752 { |
|
1753 return 1000000; |
|
1754 } |
|
1755 else |
|
1756 { |
|
1757 return 5000000; |
|
1758 } |
|
1759 } |
|
1760 |
|
1761 |
|
1762 TTimeIntervalMicroSeconds CVeiEditVideoContainer::TotalLength() |
|
1763 { |
|
1764 TTimeIntervalMicroSeconds duration = TTimeIntervalMicroSeconds(0); |
|
1765 |
|
1766 if ( iVideoDisplay ) |
|
1767 { |
|
1768 duration = iVideoDisplay->TotalLengthL(); |
|
1769 } |
|
1770 |
|
1771 return duration; |
|
1772 } |
|
1773 |
|
1774 // --------------------------------------------------------- |
|
1775 // CVeiEditVideoContainer::CountComponentControls() const |
|
1776 // --------------------------------------------------------- |
|
1777 // |
|
1778 TInt CVeiEditVideoContainer::CountComponentControls() const |
|
1779 { |
|
1780 if (EModeMixingAudio == iSelectionMode || EModeAdjustVolume == iSelectionMode) |
|
1781 { |
|
1782 return 9; // return nbr of controls inside this container |
|
1783 } |
|
1784 else |
|
1785 { |
|
1786 return 10; // return nbr of controls inside this container |
|
1787 } |
|
1788 } |
|
1789 |
|
1790 // --------------------------------------------------------- |
|
1791 // CVeiEditVideoContainer::ComponentControl(TInt aIndex) const |
|
1792 // --------------------------------------------------------- |
|
1793 // |
|
1794 CCoeControl* CVeiEditVideoContainer::ComponentControl( TInt aIndex ) const |
|
1795 { |
|
1796 switch ( aIndex ) |
|
1797 { |
|
1798 case 0: |
|
1799 return iVideoDisplay; |
|
1800 case 1: |
|
1801 return iInfoDisplay; |
|
1802 case 2: |
|
1803 return iDummyCutBarLeft; |
|
1804 case 3: |
|
1805 return iTransitionDisplayLeft; |
|
1806 case 4: |
|
1807 return iTransitionDisplayRight; |
|
1808 case 5: |
|
1809 return iEffectSymbols; |
|
1810 case 6: |
|
1811 return iArrowsDisplay; |
|
1812 case 7: |
|
1813 return iVerticalSlider; |
|
1814 case 8: |
|
1815 return iHorizontalSlider; |
|
1816 case 9: |
|
1817 // this one is not used in modes EModeMixingAudio and EModeAdjustVolume |
|
1818 if (EModeMixingAudio != iSelectionMode && EModeAdjustVolume != iSelectionMode) |
|
1819 { |
|
1820 return iDummyCutBar; |
|
1821 } |
|
1822 else |
|
1823 { |
|
1824 return NULL; |
|
1825 } |
|
1826 default: |
|
1827 return NULL; |
|
1828 } |
|
1829 } |
|
1830 |
|
1831 void CVeiEditVideoContainer::SaveSnapshotL() |
|
1832 { |
|
1833 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::SaveSnapshotL(): in"); |
|
1834 |
|
1835 //first we have to encode bitmap |
|
1836 // get encoder types |
|
1837 RImageTypeDescriptionArray imageTypes; |
|
1838 iConverter->GetEncoderImageTypesL( imageTypes ); |
|
1839 |
|
1840 CleanupStack::PushL( TCleanupItem( CleanupRArray, &imageTypes ) ); |
|
1841 |
|
1842 TInt selectedIdx = 0; |
|
1843 |
|
1844 _LIT( KEncoderType, "JPEG" ); // encoder type for image conversion |
|
1845 |
|
1846 for( TInt i=0; i<imageTypes.Count(); i++ ) |
|
1847 { |
|
1848 if ( imageTypes[i]->Description() == KEncoderType ) |
|
1849 { |
|
1850 selectedIdx = i; |
|
1851 } |
|
1852 } |
|
1853 |
|
1854 RFs& fs = iEikonEnv->FsSession(); |
|
1855 |
|
1856 TParse file; |
|
1857 TFileName newname; |
|
1858 TFileName snapshotdir; |
|
1859 |
|
1860 TVeiSettings saveSettings; |
|
1861 // Get default snapshot name from settings view |
|
1862 |
|
1863 STATIC_CAST( CVeiAppUi*, iEikonEnv->AppUi() )->ReadSettingsL( saveSettings ); |
|
1864 |
|
1865 CAknMemorySelectionDialog::TMemory memory( saveSettings.MemoryInUse() ); |
|
1866 |
|
1867 newname.Append( saveSettings.DefaultSnapshotName() ); |
|
1868 newname.Append( _L(".JPEG") ); |
|
1869 file.Set( newname, NULL, NULL ); |
|
1870 |
|
1871 TInt error = KErrNone; |
|
1872 |
|
1873 snapshotdir.Zero(); |
|
1874 |
|
1875 if ( memory == CAknMemorySelectionDialog::EPhoneMemory ) |
|
1876 { |
|
1877 snapshotdir.Append( PathInfo::PhoneMemoryRootPath() ); |
|
1878 } |
|
1879 else |
|
1880 { |
|
1881 snapshotdir.Append( PathInfo::MemoryCardRootPath() ); |
|
1882 } |
|
1883 snapshotdir.Append( PathInfo::ImagesPath() ); |
|
1884 |
|
1885 error = fs.MkDirAll( file.Path() ); |
|
1886 if ( ( error != KErrAlreadyExists ) && ( error != KErrNone ) ) |
|
1887 { |
|
1888 return; |
|
1889 } |
|
1890 |
|
1891 newname.Zero(); |
|
1892 newname.Append( file.NameAndExt() ); |
|
1893 newname.Insert( 0, snapshotdir ); |
|
1894 CApaApplication::GenerateFileName( fs, newname ); |
|
1895 |
|
1896 //for cancellation |
|
1897 if ( iSaveToFileName ) |
|
1898 { |
|
1899 delete iSaveToFileName; |
|
1900 iSaveToFileName = NULL; |
|
1901 } |
|
1902 iSaveToFileName = HBufC::NewL( newname.Length() ); |
|
1903 *iSaveToFileName = newname; |
|
1904 |
|
1905 // request the actuall save/encode |
|
1906 // asynchronous, the result is reported via callback NotifyCompletion |
|
1907 iConverter->StartToEncodeL( newname, |
|
1908 imageTypes[selectedIdx]->ImageType(), imageTypes[selectedIdx]->SubType() ); |
|
1909 |
|
1910 /* |
|
1911 if (iProgressDialog) |
|
1912 { |
|
1913 delete iProgressDialog; |
|
1914 iProgressDialog = NULL; |
|
1915 } |
|
1916 |
|
1917 iProgressDialog = |
|
1918 new (ELeave) CAknProgressDialog(REINTERPRET_CAST(CEikDialog**, |
|
1919 &iProgressDialog), ETrue); |
|
1920 iProgressDialog->SetCallback(this); |
|
1921 iProgressDialog->ExecuteDlgLD( R_VEI_PROGRESS_NOTE ); |
|
1922 |
|
1923 |
|
1924 HBufC* stringholder = StringLoader::LoadLC( R_VEI_PROGRESS_NOTE_SAVING_IMAGE, iEikonEnv ); |
|
1925 iProgressDialog->SetTextL( *stringholder ); |
|
1926 CleanupStack::PopAndDestroy( stringholder ); |
|
1927 |
|
1928 iProgressDialog->GetProgressInfoL()->SetFinalValue(100); |
|
1929 */ |
|
1930 |
|
1931 CleanupStack::PopAndDestroy( &imageTypes ); |
|
1932 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::SaveSnapshotL(): out"); |
|
1933 } |
|
1934 |
|
1935 |
|
1936 void CVeiEditVideoContainer::SetFinishedStatus( TBool aStatus ) |
|
1937 { |
|
1938 iFinished = aStatus; |
|
1939 iCurrentPoint = 0; |
|
1940 DrawPlayHead(); |
|
1941 } |
|
1942 |
|
1943 TInt CVeiEditVideoContainer::Update( TAny* aThis ) |
|
1944 { |
|
1945 STATIC_CAST( CVeiEditVideoContainer*, aThis )->DoUpdate(); |
|
1946 return 42; |
|
1947 } |
|
1948 |
|
1949 void CVeiEditVideoContainer::DoUpdate() |
|
1950 { |
|
1951 if (iView.EditorState() != CVeiEditVideoView::EQuickPreview ) |
|
1952 { |
|
1953 iZoomFactorX++; |
|
1954 iZoomFactorY++; |
|
1955 if ( iZoomFactorX > KMaxZoomFactorX ) |
|
1956 { |
|
1957 iZoomFactorX = KMaxZoomFactorX; |
|
1958 } |
|
1959 if ( iZoomFactorY > KMaxZoomFactorY ) |
|
1960 { |
|
1961 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::DoUpdate: Zooming completed"); |
|
1962 iZoomTimer->Cancel(); |
|
1963 } |
|
1964 } |
|
1965 else |
|
1966 { |
|
1967 iZoomFactorX--; |
|
1968 iZoomFactorY--; |
|
1969 if ( iZoomFactorX < 0 ) |
|
1970 { |
|
1971 iZoomFactorX = 0; |
|
1972 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::DoUpdate: Zooming completed"); |
|
1973 iZoomTimer->Cancel(); |
|
1974 } |
|
1975 if ( iZoomFactorY < 0 ) |
|
1976 { |
|
1977 iZoomFactorY = 0; |
|
1978 } |
|
1979 } |
|
1980 |
|
1981 if( iSelectionMode != EModePreview ) |
|
1982 { |
|
1983 DrawTrackBoxes(); |
|
1984 } |
|
1985 } |
|
1986 |
|
1987 TInt CVeiEditVideoContainer::UpdatePosition( TAny* aThis ) |
|
1988 { |
|
1989 STATIC_CAST( CVeiEditVideoContainer*, aThis )->DoUpdatePosition(); |
|
1990 return 42; |
|
1991 } |
|
1992 |
|
1993 void CVeiEditVideoContainer::DoUpdatePosition() |
|
1994 { |
|
1995 |
|
1996 TUint time = static_cast<TInt32>(PlaybackPositionL().Int64() / 1000); |
|
1997 |
|
1998 //LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::DoUpdatePosition(): 1, time:%d", time); |
|
1999 |
|
2000 /** Check if playhead needs to be drawn again*/ |
|
2001 TInt64 barDuration = iMovie.Duration().Int64(); |
|
2002 |
|
2003 if (barDuration < 30000000) |
|
2004 { |
|
2005 barDuration = 30000000; |
|
2006 } |
|
2007 else if (barDuration < 45000000) |
|
2008 { |
|
2009 barDuration = 45000000; |
|
2010 } |
|
2011 else{ |
|
2012 barDuration = ((barDuration / 30000000) + 1) * 30000000; |
|
2013 } |
|
2014 |
|
2015 TInt barWidth = iVideoBarBox.Width(); |
|
2016 |
|
2017 TInt videoClipCount = iMovie.VideoClipCount(); |
|
2018 TInt audioClipCount = iMovie.AudioClipCount(); |
|
2019 TInt lastVideoClipX(0); |
|
2020 TTimeIntervalMicroSeconds endTime; |
|
2021 |
|
2022 __ASSERT_ALWAYS( ((iMovie.VideoClipCount()>0) || (iMovie.AudioClipCount()>0)), |
|
2023 User::Panic( _L("VideoEditor" ), 34 ) ); |
|
2024 |
|
2025 |
|
2026 if (( videoClipCount > 0 ) && ( audioClipCount > 0 )) |
|
2027 { |
|
2028 TTimeIntervalMicroSeconds videoClipEndTime = iMovie.VideoClipEndTime( videoClipCount-1 ); |
|
2029 TTimeIntervalMicroSeconds audioClipEndTime = iMovie.AudioClipEndTime( audioClipCount-1 ); |
|
2030 if ( videoClipEndTime > audioClipEndTime ) |
|
2031 { |
|
2032 endTime = videoClipEndTime; |
|
2033 } |
|
2034 else |
|
2035 { |
|
2036 endTime = audioClipEndTime; |
|
2037 } |
|
2038 } |
|
2039 else if ( videoClipCount > 0 ) |
|
2040 { |
|
2041 endTime = iMovie.VideoClipEndTime( videoClipCount-1 ); |
|
2042 } |
|
2043 else |
|
2044 { |
|
2045 endTime = iMovie.AudioClipEndTime( audioClipCount-1 ); |
|
2046 } |
|
2047 |
|
2048 lastVideoClipX = iVideoBarBox.iTl.iX |
|
2049 + static_cast<TInt32>((((endTime.Int64() * barWidth)) / barDuration)) + 1; |
|
2050 |
|
2051 TInt width = lastVideoClipX - iVideoBarBox.iTl.iX; |
|
2052 |
|
2053 TUint totalTime = static_cast<TInt32>(iMovie.Duration().Int64() /1000); |
|
2054 TInt nextPosition = time * width / totalTime + iVideoBarBox.iTl.iX; |
|
2055 |
|
2056 if ( nextPosition != iCurrentPointX ) |
|
2057 { |
|
2058 iCurrentPoint = time; |
|
2059 DrawPlayHead(); |
|
2060 } |
|
2061 else |
|
2062 { |
|
2063 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::DoUpdatePosition 3, drawplayhead skipped"); |
|
2064 } |
|
2065 } |
|
2066 |
|
2067 void CVeiEditVideoContainer::PlayVideoFileL( const TDesC& aFilename, const TBool& aFullScreen ) |
|
2068 { |
|
2069 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PlayVideoFileL(): In"); |
|
2070 |
|
2071 if ( iTempFileName ) |
|
2072 { |
|
2073 delete iTempFileName; |
|
2074 iTempFileName = NULL; |
|
2075 } |
|
2076 |
|
2077 iTempFileName = HBufC::NewL(KMaxFileName); |
|
2078 *iTempFileName = aFilename; |
|
2079 |
|
2080 // Get default movie name from settings view |
|
2081 |
|
2082 TFileName newname; |
|
2083 TVeiSettings movieSaveSettings; |
|
2084 |
|
2085 STATIC_CAST( CVeiAppUi*, iEikonEnv->AppUi() )->ReadSettingsL( movieSaveSettings ); |
|
2086 |
|
2087 newname.Append( movieSaveSettings.DefaultVideoName() ); |
|
2088 iInfoDisplay->SetName( newname ); |
|
2089 |
|
2090 TTimeIntervalMicroSeconds movieDuration = iMovie.Duration(); |
|
2091 iInfoDisplay->SetDuration( movieDuration ); |
|
2092 |
|
2093 if ( iTempVideoInfo ) |
|
2094 { |
|
2095 delete iTempVideoInfo; |
|
2096 iTempVideoInfo = 0; |
|
2097 } |
|
2098 iFullScreenSelected = aFullScreen; |
|
2099 |
|
2100 if ( iCursorLocation == ECursorOnTransition ) |
|
2101 { |
|
2102 iTransitionDisplayLeft->MakeVisible( EFalse ); |
|
2103 iTransitionDisplayRight->MakeVisible( EFalse ); |
|
2104 iArrowsDisplay->SetUpperArrowVisibility( EFalse ); |
|
2105 iArrowsDisplay->SetLowerArrowVisibility( EFalse ); |
|
2106 iDummyCutBar->SetRect( iDummyCutBarBox ); |
|
2107 } |
|
2108 iInfoDisplay->MakeVisible( EFalse ); |
|
2109 iDummyCutBar->MakeVisible( EFalse ); |
|
2110 iDummyCutBarLeft->MakeVisible( EFalse ); |
|
2111 iEffectSymbols->MakeVisible( EFalse ); |
|
2112 iVideoDisplay->StopAnimation(); |
|
2113 |
|
2114 SetPreviewState(EStateOpening); |
|
2115 |
|
2116 if ( !iScreenLight->IsActive() ) |
|
2117 { |
|
2118 iScreenLight->Start(); |
|
2119 } |
|
2120 |
|
2121 if ( iFullScreenSelected ) |
|
2122 { |
|
2123 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PlayVideoFileL: fullscreen selected"); |
|
2124 iView.SetEditorState( CVeiEditVideoView::EPreview); |
|
2125 |
|
2126 SetBlackScreen( ETrue ); |
|
2127 iVideoDisplay->OpenFileL( aFilename ); |
|
2128 } |
|
2129 else |
|
2130 { |
|
2131 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PlayVideoFileL: fullscreen not selected"); |
|
2132 iView.SetEditorState( CVeiEditVideoView::EQuickPreview); |
|
2133 iVideoDisplay->SetRect( iVideoDisplayBox ); |
|
2134 iVideoDisplay->ShowBlackScreen(); |
|
2135 iInfoDisplay->SetRect( iInfoDisplayBox ); |
|
2136 |
|
2137 iDummyCutBar->MakeVisible( ETrue ); |
|
2138 iDummyCutBar->Dim( ETrue ); |
|
2139 iVideoDisplay->OpenFileL( aFilename ); |
|
2140 } |
|
2141 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PlayVideoFileL(): Out"); |
|
2142 } |
|
2143 |
|
2144 void CVeiEditVideoContainer::PlayVideo(const TDesC& /*aFilename*/, TBool& /*aFullScreen*/ ) |
|
2145 { |
|
2146 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PlayVideo In"); |
|
2147 |
|
2148 if ( iVideoDisplay ) |
|
2149 { |
|
2150 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PlayVideo(): 1"); |
|
2151 |
|
2152 // associated with, when put into background and back to foreground, play starts from different |
|
2153 // position it was paused (iSeekPos is not iLastPosition) |
|
2154 iVideoDisplay->SetPositionL( iSeekPos ); |
|
2155 |
|
2156 if ( iTempVideoInfo && !iFrameReady) |
|
2157 { |
|
2158 iTempVideoInfo->CancelFrame(); |
|
2159 } |
|
2160 iVideoDisplay->Play(); |
|
2161 } |
|
2162 |
|
2163 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PlayVideo(): Out"); |
|
2164 } |
|
2165 |
|
2166 void CVeiEditVideoContainer::StopVideo( TBool aCloseStream ) |
|
2167 { |
|
2168 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::StopVideo: In, aCloseStream:%d", aCloseStream); |
|
2169 SetPreviewState(EStateStopped); |
|
2170 if ( iPeriodic ) |
|
2171 { |
|
2172 iPeriodic->Cancel(); |
|
2173 } |
|
2174 |
|
2175 iSeekPos = TTimeIntervalMicroSeconds( 0 ); |
|
2176 |
|
2177 iCloseStream = aCloseStream; |
|
2178 |
|
2179 iVideoDisplay->Stop( aCloseStream ); |
|
2180 |
|
2181 iScreenLight->Stop(); |
|
2182 if ( aCloseStream ) |
|
2183 { |
|
2184 SetPreviewState(EStateClosed); |
|
2185 } |
|
2186 else |
|
2187 { |
|
2188 SetFinishedStatus( ETrue ); |
|
2189 } |
|
2190 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StopVideo: out"); |
|
2191 } |
|
2192 |
|
2193 void CVeiEditVideoContainer::TakeSnapshotL() |
|
2194 { |
|
2195 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::TakeSnapshotL: In, iFrameReady:%d", iFrameReady); |
|
2196 |
|
2197 if( !iTempVideoInfo || !iFrameReady ) |
|
2198 { |
|
2199 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::TakeSnapshotL: 1"); |
|
2200 if (!iFrameReady) |
|
2201 { |
|
2202 iTakeSnapshotWaiting = ETrue; |
|
2203 } |
|
2204 return; |
|
2205 } |
|
2206 |
|
2207 iTakeSnapshotWaiting = EFalse; |
|
2208 iTakeSnapshot = ETrue; |
|
2209 TTimeIntervalMicroSeconds pos = PlaybackPositionL(); |
|
2210 |
|
2211 TInt frameIndex; |
|
2212 TInt totalFrameCount; |
|
2213 |
|
2214 frameIndex = iTempVideoInfo->GetVideoFrameIndexL( pos ); |
|
2215 totalFrameCount = iTempVideoInfo->VideoFrameCount(); |
|
2216 |
|
2217 if ( frameIndex > totalFrameCount ) |
|
2218 { |
|
2219 frameIndex = totalFrameCount; |
|
2220 } |
|
2221 |
|
2222 TRect clipResolution = Rect(); |
|
2223 TSize resol( clipResolution.iBr.iX, clipResolution.iBr.iY ); |
|
2224 TDisplayMode displayMode = ENone; |
|
2225 iFrameReady = EFalse; |
|
2226 |
|
2227 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::TakeSnapshotL: 2"); |
|
2228 //iTempVideoInfo->GetFrameL(*this, frameIndex, &resol, displayMode, ETrue); |
|
2229 |
|
2230 /* : |
|
2231 check out on every phone before releasing whether videodisplay should be stopped before starting |
|
2232 asynchronous GetFrameL() |
|
2233 see how EStateGettingFrame is handled in SetPreviewState |
|
2234 Stopping frees memory and it is needed in memory sensible devices |
|
2235 */ |
|
2236 iTempVideoInfo->GetFrameL(*this, frameIndex, NULL, displayMode, ETrue); |
|
2237 SetPreviewState(EStateGettingFrame); |
|
2238 |
|
2239 StartProgressDialogL(R_VEI_PROGRESS_NOTE_WITH_CANCEL, R_VEI_PROGRESS_NOTE_SAVING_IMAGE); |
|
2240 |
|
2241 /* |
|
2242 if (iProgressDialog) |
|
2243 { |
|
2244 delete iProgressDialog; |
|
2245 iProgressDialog = NULL; |
|
2246 } |
|
2247 |
|
2248 iProgressDialog = |
|
2249 new (ELeave) CAknProgressDialog(REINTERPRET_CAST(CEikDialog**, |
|
2250 &iProgressDialog), ETrue); |
|
2251 iProgressDialog->SetCallback(this); |
|
2252 iProgressDialog->ExecuteDlgLD( R_VEI_PROGRESS_NOTE_WITH_CANCEL ); |
|
2253 |
|
2254 |
|
2255 HBufC* stringholder = StringLoader::LoadLC( R_VEI_PROGRESS_NOTE_SAVING_IMAGE, iEikonEnv ); |
|
2256 iProgressDialog->SetTextL( *stringholder ); |
|
2257 CleanupStack::PopAndDestroy( stringholder ); |
|
2258 |
|
2259 iProgressDialog->GetProgressInfoL()->SetFinalValue(100); |
|
2260 */ |
|
2261 // this is good place to start Progress Note, but for some reason this causes some phones to crash |
|
2262 // that is why progress note is started now in NotifyVideoClipFrameCompleted |
|
2263 //StartProgressDialogL(R_VEI_PROGRESS_NOTE_WITH_CANCEL, R_VEI_PROGRESS_NOTE_SAVING_IMAGE); |
|
2264 |
|
2265 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::TakeSnapshotL: Out"); |
|
2266 } |
|
2267 |
|
2268 void CVeiEditVideoContainer::PauseVideoL() |
|
2269 { |
|
2270 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::PauseVideoL: In, iPreviewState:%d", iPreviewState); |
|
2271 |
|
2272 // if-condition added in order to prevent entering to pause state (icon is showed) from "wrong" state |
|
2273 // etc. from "stopped" state |
|
2274 if (EStatePlaying == iPreviewState) |
|
2275 { |
|
2276 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PauseVideoL 1"); |
|
2277 iLastPosition = iVideoDisplay->PositionL(); |
|
2278 |
|
2279 // think whether this should be here? |
|
2280 iSeekPos = iVideoDisplay->PositionL(); |
|
2281 iVideoDisplay->SetPositionL(iSeekPos); |
|
2282 } |
|
2283 iVideoDisplay->PauseL(); |
|
2284 SetPreviewState(EStatePaused); |
|
2285 iScreenLight->Stop(); |
|
2286 if ( iPeriodic ) |
|
2287 { |
|
2288 iPeriodic->Cancel(); |
|
2289 } |
|
2290 iView.StopNaviPaneUpdateL(); |
|
2291 |
|
2292 #ifdef GET_PAUSE_THUMBNAIL |
|
2293 GetThumbAtL( iLastPosition ); |
|
2294 #endif |
|
2295 |
|
2296 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PauseVideoL out"); |
|
2297 } |
|
2298 |
|
2299 TTimeIntervalMicroSeconds CVeiEditVideoContainer::PlaybackPositionL() |
|
2300 { |
|
2301 if ( ( iSeeking ) || ( EStateStopped == iPreviewState) ) |
|
2302 { |
|
2303 return iSeekPos; |
|
2304 } |
|
2305 if ( EStatePlaying != iPreviewState ) |
|
2306 { |
|
2307 return iLastPosition; |
|
2308 } |
|
2309 |
|
2310 iLastPosition = iVideoDisplay->PositionL(); |
|
2311 |
|
2312 // for what situation is this for? |
|
2313 if ( ( iLastPosition == TTimeIntervalMicroSeconds( 0 ) ) && |
|
2314 ( iSeekPos != TTimeIntervalMicroSeconds( 0 ) ) ) |
|
2315 { |
|
2316 return iSeekPos; |
|
2317 } |
|
2318 // for what situation is this for? |
|
2319 return iLastPosition; |
|
2320 } |
|
2321 |
|
2322 |
|
2323 void CVeiEditVideoContainer::SetSelectionMode( TSelectionMode aSelectionMode ) |
|
2324 { |
|
2325 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::SetSelectionMode: In, aSelectionMode:%d", aSelectionMode); |
|
2326 iSelectionMode = aSelectionMode; |
|
2327 |
|
2328 if (EModeMixingAudio == iSelectionMode) |
|
2329 { |
|
2330 iHorizontalSlider->SetPosition(0); |
|
2331 |
|
2332 if (0 != iMovie.GetVideoClipVolumeGainL(KVedClipIndexAll)) |
|
2333 { |
|
2334 TReal gain = iMovie.GetVideoClipVolumeGainL(KVedClipIndexAll);///(KVolumeMaxGain/10); |
|
2335 gain = gain/(KVolumeMaxGain/10); |
|
2336 if (0 < gain) |
|
2337 { |
|
2338 gain += 0.5; |
|
2339 } |
|
2340 else |
|
2341 { |
|
2342 gain -= 0.5; |
|
2343 } |
|
2344 iHorizontalSlider->SetPosition( (TInt)(-gain) ); // see impl. of CSliderBar |
|
2345 } |
|
2346 |
|
2347 else if(0 != iMovie.GetAudioClipVolumeGainL(KVedClipIndexAll)) |
|
2348 { |
|
2349 TReal gain = iMovie.GetAudioClipVolumeGainL(KVedClipIndexAll);///(KVolumeMaxGain/10); |
|
2350 gain = gain/(KVolumeMaxGain/10); |
|
2351 if (0 < gain) |
|
2352 { |
|
2353 gain += 0.5; |
|
2354 } |
|
2355 else |
|
2356 { |
|
2357 gain -= 0.5; |
|
2358 } |
|
2359 iHorizontalSlider->SetPosition( (TInt)gain ); |
|
2360 } |
|
2361 |
|
2362 iHorizontalSlider->MakeVisible(ETrue); |
|
2363 iVerticalSlider->MakeVisible(EFalse); |
|
2364 iVideoDisplay->ShowPictureL( *iAudioMixingIcon ); |
|
2365 iInfoDisplay->MakeVisible(EFalse); |
|
2366 |
|
2367 |
|
2368 iVideoDisplay->StopAnimation(); |
|
2369 if ( iCursorLocation == ECursorOnTransition ) |
|
2370 { |
|
2371 iTransitionDisplayLeft->MakeVisible( EFalse ); |
|
2372 iTransitionDisplayRight->MakeVisible( EFalse ); |
|
2373 iArrowsDisplay->SetUpperArrowVisibility( EFalse ); |
|
2374 iArrowsDisplay->SetLowerArrowVisibility( EFalse ); |
|
2375 iDummyCutBar->SetRect( iDummyCutBarBox ); |
|
2376 } |
|
2377 |
|
2378 |
|
2379 } |
|
2380 else if (EModeAdjustVolume == iSelectionMode) |
|
2381 { |
|
2382 |
|
2383 iVerticalSlider->SetPosition(0); |
|
2384 |
|
2385 if (VideoEditor::ECursorOnClip == CursorLocation()) |
|
2386 { |
|
2387 if (0 != iMovie.GetVideoClipVolumeGainL(CurrentIndex())) |
|
2388 { |
|
2389 TReal adjustVolume = iMovie.GetVideoClipVolumeGainL(CurrentIndex());///(KVolumeMaxGain/10); |
|
2390 adjustVolume = adjustVolume/(KVolumeMaxGain/10); |
|
2391 |
|
2392 if (0 < adjustVolume) |
|
2393 { |
|
2394 adjustVolume += 0.5; |
|
2395 } |
|
2396 else if (0 > adjustVolume) |
|
2397 { |
|
2398 adjustVolume -= 0.5; |
|
2399 } |
|
2400 iVerticalSlider->SetPosition(-adjustVolume); // see impl. of CSliderBar |
|
2401 } |
|
2402 } |
|
2403 else if (VideoEditor::ECursorOnAudio == CursorLocation()) |
|
2404 { |
|
2405 if (0 != iMovie.GetAudioClipVolumeGainL(CurrentIndex())) |
|
2406 { |
|
2407 TReal adjustVolume = iMovie.GetAudioClipVolumeGainL(CurrentIndex());///(KVolumeMaxGain/10); |
|
2408 adjustVolume = adjustVolume/(KVolumeMaxGain/10); |
|
2409 |
|
2410 if (0 < adjustVolume) |
|
2411 { |
|
2412 adjustVolume += 0.5; |
|
2413 } |
|
2414 else if (0 > adjustVolume) |
|
2415 { |
|
2416 adjustVolume -= 0.5; |
|
2417 } |
|
2418 iVerticalSlider->SetPosition(-adjustVolume); |
|
2419 } |
|
2420 } |
|
2421 |
|
2422 iHorizontalSlider->MakeVisible(EFalse); |
|
2423 iVerticalSlider->MakeVisible(ETrue); |
|
2424 } |
|
2425 else |
|
2426 { |
|
2427 iHorizontalSlider->MakeVisible(EFalse); |
|
2428 iVerticalSlider->MakeVisible(EFalse); |
|
2429 } |
|
2430 |
|
2431 if ( iSelectionMode == EModeSlowMotion ) |
|
2432 { |
|
2433 ArrowsControl(); |
|
2434 } |
|
2435 |
|
2436 else |
|
2437 { |
|
2438 iInfoDisplay->SetSlowMotionOn( EFalse ); |
|
2439 switch(iSelectionMode) |
|
2440 { |
|
2441 case EModeRecordingSetStart: |
|
2442 iEffectSymbols->MakeVisible( ETrue ); |
|
2443 iEffectSymbols->SetPauseAudioIconVisibility( EFalse ); |
|
2444 iEffectSymbols->SetRecAudioIconVisibility( EFalse ); |
|
2445 break; |
|
2446 case EModeRecordingPaused: |
|
2447 iEffectSymbols->MakeVisible( ETrue ); |
|
2448 iInfoDisplay->SetLayout( CVeiTextDisplay::ERecordingPaused ); |
|
2449 iEffectSymbols->SetRecAudioIconVisibility( EFalse ); |
|
2450 iEffectSymbols->SetPauseAudioIconVisibility( ETrue ); |
|
2451 iEffectSymbols->DrawNow(); |
|
2452 break; |
|
2453 case EModeRecording: |
|
2454 iEffectSymbols->MakeVisible( ETrue ); |
|
2455 iEffectSymbols->SetPauseAudioIconVisibility( EFalse ); |
|
2456 iEffectSymbols->SetRecAudioIconVisibility( ETrue ); |
|
2457 break; |
|
2458 default: |
|
2459 iEffectSymbols->SetPauseAudioIconVisibility( EFalse ); |
|
2460 iEffectSymbols->SetRecAudioIconVisibility( EFalse ); |
|
2461 if ( !iFullScreenSelected ) |
|
2462 { |
|
2463 if ( VideoEditorUtils::IsLandscapeScreenOrientation() ) //Landscape |
|
2464 { |
|
2465 iInfoDisplay->SetLayout( CVeiTextDisplay::EEverything ); |
|
2466 } |
|
2467 else |
|
2468 { |
|
2469 iInfoDisplay->SetLayout( CVeiTextDisplay::ENameAndDuration ); |
|
2470 } |
|
2471 } |
|
2472 break; |
|
2473 } |
|
2474 } |
|
2475 |
|
2476 DrawDeferred(); |
|
2477 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::SetSelectionMode: Out"); |
|
2478 } |
|
2479 |
|
2480 TTypeUid::Ptr CVeiEditVideoContainer::MopSupplyObject( TTypeUid aId ) |
|
2481 { |
|
2482 if ( aId.iUid == MAknsControlContext::ETypeId && iBgContext ) |
|
2483 { |
|
2484 return MAknsControlContext::SupplyMopObject( aId, iBgContext ); |
|
2485 } |
|
2486 return CCoeControl::MopSupplyObject( aId ); |
|
2487 } |
|
2488 // --------------------------------------------------------- |
|
2489 // CVeiEditVideoContainer::Draw(const TRect& aRect) const |
|
2490 // --------------------------------------------------------- |
|
2491 // |
|
2492 void CVeiEditVideoContainer::Draw( const TRect& /*aRect*/ ) const |
|
2493 { |
|
2494 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::Draw() In, iPreviewState:%d", iPreviewState); |
|
2495 CWindowGc& gc = SystemGc(); |
|
2496 |
|
2497 if(iBlackScreen) |
|
2498 { |
|
2499 gc.Clear( Rect() ); |
|
2500 gc.SetPenStyle( CWindowGc::ESolidPen ); |
|
2501 gc.SetBrushColor( KRgbBlack ); |
|
2502 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
2503 gc.DrawRect( Rect() ); |
|
2504 gc.SetPenStyle( CWindowGc::ESolidPen ); |
|
2505 gc.DrawRoundRect( Rect(), TSize(4,4)); |
|
2506 } |
|
2507 else |
|
2508 { |
|
2509 // Draw skin background |
|
2510 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
2511 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
2512 AknsDrawUtils::Background( skin, cc, this, gc, Rect() ); |
|
2513 |
|
2514 if ( EStatePaused == iPreviewState ) |
|
2515 { |
|
2516 gc.BitBltMasked( iPauseIconBox.iTl, iPauseBitmap, |
|
2517 TRect( TPoint(0,0), iPauseBitmap->SizeInPixels() ), |
|
2518 iPauseBitmapMask, EFalse ); |
|
2519 } |
|
2520 |
|
2521 if (EModeMixingAudio == iSelectionMode && CVeiEditVideoView::EMixAudio != iView.EditorState()) |
|
2522 { |
|
2523 iHorizontalSlider->MakeVisible(EFalse); |
|
2524 } |
|
2525 else if (EModeMixingAudio == iSelectionMode && CVeiEditVideoView::EMixAudio == iView.EditorState()) |
|
2526 { |
|
2527 iHorizontalSlider->MakeVisible(ETrue); |
|
2528 TPoint mixAudioVideoIconPoint(iHorizontalSliderPoint.iX, iHorizontalSliderPoint.iY + 20); |
|
2529 TRect videoTrackIconSourceRect(0, 0, iVideoTrackIcon->SizeInPixels().iWidth, |
|
2530 iVideoTrackIcon->SizeInPixels().iHeight); |
|
2531 gc.BitBltMasked( mixAudioVideoIconPoint, iVideoTrackIcon, videoTrackIconSourceRect, |
|
2532 iVideoTrackIconMask, EFalse); |
|
2533 |
|
2534 TPoint mixAudioAudioIconPoint(iHorizontalSliderPoint.iX + |
|
2535 iHorizontalSliderSize.iWidth - 15, iHorizontalSliderPoint.iY + 20); |
|
2536 TRect audioTrackIconSourceRect(0, 0, iAudioTrackIcon->SizeInPixels().iWidth, |
|
2537 iAudioTrackIcon->SizeInPixels().iHeight); |
|
2538 gc.BitBltMasked(mixAudioAudioIconPoint, iAudioTrackIcon, audioTrackIconSourceRect, |
|
2539 iAudioTrackIconMask, EFalse); |
|
2540 |
|
2541 return; |
|
2542 } |
|
2543 |
|
2544 else if (EModeAdjustVolume == iSelectionMode && CVeiEditVideoView::EAdjustVolume != iView.EditorState()) |
|
2545 { |
|
2546 iVerticalSlider->MakeVisible(EFalse); |
|
2547 } |
|
2548 else if (EModeAdjustVolume == iSelectionMode && CVeiEditVideoView::EAdjustVolume && iView.EditorState()) |
|
2549 { |
|
2550 iVerticalSlider->MakeVisible(ETrue); |
|
2551 TPoint pluspoint(iVerticalSliderPoint.iX - 12, iVerticalSliderPoint.iY + 20); |
|
2552 TPoint minuspoint(iVerticalSliderPoint.iX - 12, iVerticalSliderPoint.iY + iVerticalSliderSize.iHeight); |
|
2553 _LIT(KPlus, "+"); |
|
2554 _LIT(KMinus, "-"); |
|
2555 |
|
2556 const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont ); |
|
2557 gc.UseFont( font ); |
|
2558 |
|
2559 // Get text color from skin |
|
2560 TRgb textColor( KRgbBlack ); |
|
2561 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
|
2562 AknsUtils::GetCachedColor(skinInstance, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ); |
|
2563 gc.SetPenColor( textColor ); |
|
2564 |
|
2565 gc.DrawText( KPlus, pluspoint ); |
|
2566 gc.DrawText( KMinus, minuspoint ); |
|
2567 |
|
2568 gc.DiscardFont(); |
|
2569 |
|
2570 return; |
|
2571 } |
|
2572 |
|
2573 /* Initialize icon & text areas. */ |
|
2574 |
|
2575 CFbsBitmap* thumbnail = 0; |
|
2576 |
|
2577 TInt i; |
|
2578 |
|
2579 TSize roundEdgeSize(2,2); |
|
2580 |
|
2581 /* Draw bar area. */ |
|
2582 |
|
2583 TRgb rgbUnselectedBorder = TRgb( 132,132,132 ); |
|
2584 |
|
2585 TRgb rgbUnselectedTrackFill = TRgb(221,221,221); |
|
2586 TRgb rgbUnselectedTrackBorder = TRgb( 201,201,201 ); |
|
2587 TRgb rgbUnselectedTrackBorderOuterRect = TRgb( 162,162,162 ); |
|
2588 |
|
2589 TRgb rgbUnselectedAudioMarker = KRgbWhite; |
|
2590 |
|
2591 TRgb rgbUnselectedClip = TRgb( 140,166,198 ); |
|
2592 |
|
2593 TRgb rgbUnselectedTransition = KRgbWhite; |
|
2594 TRgb rgbSelectedBorder = TRgb( 94,97,101 ); |
|
2595 TRgb rgbSelectedAudioMarker = KRgbBlack; |
|
2596 TRgb rgbSelectedClip = TRgb( 108,139,182 ); |
|
2597 TRgb rgbSelectedTransition = TRgb( 0x00, 0x9b, 0xff ); |
|
2598 TRgb rgbActiveBorder = KRgbRed; |
|
2599 TRgb rgbActiveAudioMarker = KRgbRed; |
|
2600 TRgb rgbActiveClip = TRgb( 140,166,198 ); |
|
2601 |
|
2602 TRect videoTrackIconSourceRect(0, 0, iVideoTrackIcon->SizeInPixels().iWidth, |
|
2603 iVideoTrackIcon->SizeInPixels().iHeight); |
|
2604 |
|
2605 gc.BitBltMasked( iVideoBarIconPos, iVideoTrackIcon, videoTrackIconSourceRect, |
|
2606 iVideoTrackIconMask, EFalse); |
|
2607 |
|
2608 TRect audioTrackIconSourceRect(0, 0, iAudioTrackIcon->SizeInPixels().iWidth, |
|
2609 iAudioTrackIcon->SizeInPixels().iHeight); |
|
2610 gc.BitBltMasked(iAudioBarIconPos, iAudioTrackIcon, audioTrackIconSourceRect, |
|
2611 iAudioTrackIconMask, EFalse); |
|
2612 |
|
2613 gc.SetPenStyle( CGraphicsContext::ESolidPen ); |
|
2614 gc.SetPenColor( rgbUnselectedTrackBorderOuterRect ); |
|
2615 gc.SetBrushColor( rgbUnselectedTrackFill ); |
|
2616 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
2617 |
|
2618 if ( ( iMovie.VideoClipCount() == 0 ) && ( iCursorLocation != ECursorOnAudio ) && |
|
2619 ( iCursorLocation != ECursorOnEmptyAudioTrack ) || |
|
2620 ( iCursorLocation == ECursorOnEmptyVideoTrack ) ) |
|
2621 { |
|
2622 gc.SetPenColor(rgbSelectedBorder); |
|
2623 gc.SetBrushColor( TRgb( 180,206,238 ) ); |
|
2624 } |
|
2625 |
|
2626 gc.DrawRoundRect(iVideoTrackBox, TSize(2,2)); |
|
2627 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
2628 gc.SetPenColor(rgbUnselectedTrackBorder); |
|
2629 TRect outerRect(iVideoTrackBox); |
|
2630 outerRect.Shrink(1,1); |
|
2631 gc.DrawRoundRect(outerRect, TSize(2,2) ); |
|
2632 |
|
2633 |
|
2634 gc.SetPenColor( rgbUnselectedTrackBorderOuterRect ); |
|
2635 gc.SetBrushColor( rgbUnselectedTrackFill ); |
|
2636 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
2637 |
|
2638 if (((iMovie.AudioClipCount() == 0) && (iCursorLocation == ECursorOnAudio) )|| |
|
2639 ( iCursorLocation == ECursorOnEmptyAudioTrack ) ) |
|
2640 { |
|
2641 gc.SetPenColor(rgbSelectedBorder); |
|
2642 gc.SetBrushColor( TRgb( 180,206,238 ) ); |
|
2643 } |
|
2644 |
|
2645 gc.DrawRoundRect(iAudioTrackBox, TSize(2,2)); |
|
2646 |
|
2647 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
2648 gc.SetPenColor(rgbUnselectedTrackBorder); |
|
2649 outerRect = iAudioTrackBox; |
|
2650 outerRect.Shrink(1,1); |
|
2651 gc.DrawRoundRect(outerRect, TSize(2,2) ); |
|
2652 |
|
2653 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
2654 |
|
2655 TInt64 barDuration = iMovie.Duration().Int64(); |
|
2656 TInt64 audioDuration(0); |
|
2657 if ( (iMovie.AudioClipCount() != 0) && ((iSelectionMode == EModeRecording ) || |
|
2658 (iSelectionMode == EModeRecordingPaused))) |
|
2659 { |
|
2660 audioDuration = (iMovie.AudioClipEndTime( iMovie.AudioClipCount() - 1 )).Int64(); |
|
2661 } |
|
2662 |
|
2663 audioDuration+= iRecordedAudioDuration.Int64(); |
|
2664 |
|
2665 if ( audioDuration > barDuration ) |
|
2666 { |
|
2667 barDuration = audioDuration; |
|
2668 } |
|
2669 |
|
2670 if ( iRecordedAudioStartTime > barDuration ) |
|
2671 { |
|
2672 barDuration = iRecordedAudioStartTime.Int64(); |
|
2673 } |
|
2674 if (barDuration < 30000000) |
|
2675 { |
|
2676 barDuration = 30000000; |
|
2677 } |
|
2678 else if (barDuration < 45000000) |
|
2679 { |
|
2680 barDuration = 45000000; |
|
2681 } |
|
2682 else{ |
|
2683 barDuration = ((barDuration / 30000000) + 1) * 30000000; |
|
2684 } |
|
2685 |
|
2686 TBool drawSelectedRect = EFalse; |
|
2687 TInt selectedAudioClipIndex( -1 ); |
|
2688 TRect selectedRect; |
|
2689 |
|
2690 gc.SetPenColor(rgbUnselectedBorder); |
|
2691 gc.SetBrushColor(rgbUnselectedClip); |
|
2692 |
|
2693 TRect audioBoxes = TRect(); |
|
2694 |
|
2695 TRect box; |
|
2696 box.iTl.iY = iAudioBarBox.iTl.iY; |
|
2697 box.iBr.iY = iAudioBarBox.iBr.iY; |
|
2698 TInt barWidth = iAudioBarBox.Width(); |
|
2699 TInt videoIndex = 0; |
|
2700 |
|
2701 for (i = 0; i < iMovie.AudioClipCount(); i++) |
|
2702 { |
|
2703 box.iTl.iX = iAudioBarBox.iTl.iX |
|
2704 + static_cast<TInt32>((iMovie.AudioClipStartTime(i).Int64() * barWidth) / |
|
2705 barDuration); |
|
2706 box.iBr.iX = iAudioBarBox.iTl.iX |
|
2707 + static_cast<TInt32>((iMovie.AudioClipEndTime(i).Int64() * barWidth) / barDuration)+ 1; |
|
2708 |
|
2709 if ((iCursorLocation == ECursorOnAudio) |
|
2710 && (i == CurrentIndex()) && (( iSelectionMode == EModeNavigation ) |
|
2711 || ( iSelectionMode == EModeMove ) || |
|
2712 ( iSelectionMode == EModeDuration ) )) |
|
2713 { |
|
2714 drawSelectedRect = ETrue; |
|
2715 selectedAudioClipIndex = i; |
|
2716 selectedRect = box; |
|
2717 } |
|
2718 else |
|
2719 { |
|
2720 gc.DrawRect(box); |
|
2721 |
|
2722 gc.SetPenColor(rgbUnselectedAudioMarker); |
|
2723 |
|
2724 audioBoxes.Resize( box.Size() ); |
|
2725 |
|
2726 if ( ( iMovie.AudioClipCutOutTime( i ).Int64() - |
|
2727 iMovie.AudioClipCutInTime( i ).Int64() ) < |
|
2728 iMovie.AudioClipInfo( i )->Duration().Int64() ) |
|
2729 { |
|
2730 TRect truncateBox; |
|
2731 truncateBox.iTl.iY = box.iTl.iY + 2; |
|
2732 truncateBox.iBr.iY = box.iBr.iY - 2; |
|
2733 |
|
2734 truncateBox.iTl.iX = box.iBr.iX - 4; |
|
2735 truncateBox.iBr.iX = truncateBox.iTl.iX + 1; |
|
2736 if (truncateBox.iTl.iX >= (box.iTl.iX + 2)) |
|
2737 { |
|
2738 gc.DrawRect(truncateBox); |
|
2739 } |
|
2740 |
|
2741 truncateBox.iTl.iX = box.iBr.iX - 7; |
|
2742 truncateBox.iBr.iX = truncateBox.iTl.iX + 1; |
|
2743 if (truncateBox.iTl.iX >= (box.iTl.iX + 2)) |
|
2744 { |
|
2745 gc.DrawRect(truncateBox); |
|
2746 } |
|
2747 |
|
2748 truncateBox.iTl.iX = box.iBr.iX - 10; |
|
2749 truncateBox.iBr.iX = truncateBox.iTl.iX + 1; |
|
2750 if (truncateBox.iTl.iX >= (box.iTl.iX + 2)) |
|
2751 { |
|
2752 gc.DrawRect(truncateBox); |
|
2753 } |
|
2754 } |
|
2755 |
|
2756 gc.SetPenColor(rgbUnselectedBorder); |
|
2757 } |
|
2758 |
|
2759 TTimeIntervalMicroSeconds audioClipStartTimeInt = iMovie.AudioClipStartTime(i).Int64() + iMovie.AudioClipCutInTime(i).Int64(); |
|
2760 TTimeIntervalMicroSeconds audioClipEndTimeInt = iMovie.AudioClipEndTime(i).Int64(); |
|
2761 |
|
2762 if ((audioClipStartTimeInt == TTimeIntervalMicroSeconds(0)) && (iMovie.VideoClipCount() > 0)) |
|
2763 { |
|
2764 TRect syncBox; |
|
2765 syncBox.iTl.iX = box.iTl.iX; |
|
2766 syncBox.iTl.iY = iVideoBarBox.iBr.iY; |
|
2767 syncBox.iBr.iX = box.iTl.iX + 1; |
|
2768 syncBox.iBr.iY = iAudioBarBox.iTl.iY; |
|
2769 |
|
2770 gc.DrawRect(syncBox); |
|
2771 } |
|
2772 |
|
2773 while (videoIndex < iMovie.VideoClipCount()) |
|
2774 { |
|
2775 TInt oldIndex = videoIndex; |
|
2776 if ( iMovie.VideoClipEndTime( oldIndex ) < audioClipStartTimeInt ) |
|
2777 { |
|
2778 videoIndex++; |
|
2779 } |
|
2780 else if ( iMovie.VideoClipEndTime( oldIndex ) == audioClipStartTimeInt ) |
|
2781 { |
|
2782 TRect syncBox; |
|
2783 syncBox.iTl.iX = box.iTl.iX; |
|
2784 syncBox.iTl.iY = iVideoBarBox.iBr.iY; |
|
2785 syncBox.iBr.iX = box.iTl.iX + 1; |
|
2786 syncBox.iBr.iY = iAudioBarBox.iTl.iY; |
|
2787 |
|
2788 gc.DrawRect(syncBox); |
|
2789 break; |
|
2790 } |
|
2791 else |
|
2792 { |
|
2793 break; |
|
2794 } |
|
2795 } |
|
2796 |
|
2797 while (videoIndex < iMovie.VideoClipCount()) |
|
2798 { |
|
2799 TInt oldIndex = videoIndex; |
|
2800 |
|
2801 if ( iMovie.VideoClipEndTime( oldIndex ) < audioClipEndTimeInt ) |
|
2802 { |
|
2803 videoIndex++; |
|
2804 } |
|
2805 else if ( iMovie.VideoClipEndTime( oldIndex ) == audioClipEndTimeInt ) |
|
2806 { |
|
2807 TRect syncBox; |
|
2808 syncBox.iTl.iX = box.iBr.iX - 1; |
|
2809 syncBox.iTl.iY = iVideoBarBox.iBr.iY; |
|
2810 syncBox.iBr.iX = box.iBr.iX; |
|
2811 syncBox.iBr.iY = iAudioBarBox.iTl.iY; |
|
2812 |
|
2813 gc.DrawRect(syncBox); |
|
2814 break; |
|
2815 } |
|
2816 else |
|
2817 { |
|
2818 break; |
|
2819 } |
|
2820 } |
|
2821 } |
|
2822 |
|
2823 if ((iSelectionMode == EModeRecordingSetStart) || (iSelectionMode == EModeRecording) |
|
2824 || (iSelectionMode == EModeRecordingPaused)) |
|
2825 { |
|
2826 box.iTl.iX = iAudioBarBox.iTl.iX |
|
2827 + static_cast<TInt32>((iRecordedAudioStartTime.Int64() * barWidth) / barDuration); |
|
2828 TInt64 recordedAudioEndTimeInt = iRecordedAudioStartTime.Int64() + iRecordedAudioDuration.Int64(); |
|
2829 box.iBr.iX = iAudioBarBox.iTl.iX |
|
2830 + static_cast<TInt32>((recordedAudioEndTimeInt * barWidth) / barDuration)+ 1; |
|
2831 |
|
2832 gc.SetPenColor(rgbActiveBorder); |
|
2833 gc.SetBrushColor(rgbSelectedClip); |
|
2834 gc.DrawRect(box); |
|
2835 gc.SetPenColor(rgbUnselectedBorder); |
|
2836 gc.SetBrushColor(rgbUnselectedClip); |
|
2837 } |
|
2838 |
|
2839 box.iTl.iY = iVideoBarBox.iTl.iY; |
|
2840 box.iBr.iY = iVideoBarBox.iBr.iY; |
|
2841 barWidth = iVideoBarBox.Width(); |
|
2842 |
|
2843 TRect videoBoxes = TRect(); |
|
2844 |
|
2845 for (i = 0; i < iMovie.VideoClipCount(); i++) |
|
2846 { |
|
2847 box.iTl.iX = iVideoBarBox.iTl.iX |
|
2848 + static_cast<TInt32>((iMovie.VideoClipStartTime( i ).Int64() * barWidth) / barDuration); |
|
2849 box.iBr.iX = iVideoBarBox.iTl.iX |
|
2850 + static_cast<TInt32>((iMovie.VideoClipEndTime( i ).Int64() * barWidth) / barDuration)+ 1; |
|
2851 |
|
2852 videoBoxes.Resize( box.Size() ); |
|
2853 |
|
2854 if ((iCursorLocation == ECursorOnClip) |
|
2855 && (i == CurrentIndex()) && ( iView.EditorState() == CVeiEditVideoView::EEdit )) |
|
2856 { |
|
2857 drawSelectedRect = ETrue; |
|
2858 selectedRect = box; |
|
2859 gc.DrawRect(box); |
|
2860 } |
|
2861 else |
|
2862 { |
|
2863 gc.DrawRect(box); |
|
2864 //Draw thumbnail in video box. |
|
2865 if ( i < iVideoItemArray.Count() ) |
|
2866 { |
|
2867 thumbnail = iVideoItemArray[i]->iTimelineBitmap; |
|
2868 } |
|
2869 if ( thumbnail ) |
|
2870 { |
|
2871 //TSize thumbnailSizeInPixels = thumbnail->SizeInPixels(); |
|
2872 TPoint pos( box.iTl.iX+1, box.iTl.iY+1 ); |
|
2873 TSize pieceSize = TSize(STATIC_CAST(TInt, (box.Height()-2)*1.22), box.Height()-2); |
|
2874 |
|
2875 if ( pieceSize.iWidth >= box.Width()-2 ) |
|
2876 { |
|
2877 pieceSize.SetSize( box.Width()-2, box.Height()-2 ); |
|
2878 } |
|
2879 TRect pieceRect( TPoint(0,0), pieceSize ); |
|
2880 gc.BitBlt( pos, thumbnail, pieceRect ); |
|
2881 } |
|
2882 |
|
2883 |
|
2884 //Draw play head. |
|
2885 if( iPreviewState == EStatePaused || iPreviewState == EStateStopped) |
|
2886 { |
|
2887 TRect bar( iBarArea );//bar rect. |
|
2888 |
|
2889 const TUint barY = 6; |
|
2890 |
|
2891 bar.iTl.iY += barY; |
|
2892 bar.iTl.iX += barY; |
|
2893 bar.iTl.iX += iVideoTrackIcon->SizeInPixels().iWidth; |
|
2894 bar.iBr.iY -= barY / 2; |
|
2895 bar.iBr.iX -= barY; |
|
2896 |
|
2897 |
|
2898 gc.SetBrushColor( KRgbBlack ); |
|
2899 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
2900 gc.SetPenColor( KRgbDarkGray ); |
|
2901 gc.SetPenStyle( CGraphicsContext::ESolidPen ); |
|
2902 |
|
2903 TPoint inPointList[3]; |
|
2904 inPointList[0] = TPoint( (iCurrentPointX - barY) + 1, iBarArea.iTl.iY - 5 ); |
|
2905 inPointList[1] = TPoint( (iCurrentPointX + barY) - 1, iBarArea.iTl.iY - 5 ); |
|
2906 inPointList[2] = TPoint( iCurrentPointX, bar.iTl.iY - 6 ); |
|
2907 gc.DrawPolygon( inPointList, 3 ); |
|
2908 |
|
2909 inPointList[0] = TPoint( (iCurrentPointX - barY) + 1, iBarArea.iBr.iY + 5 ); |
|
2910 inPointList[1] = TPoint( (iCurrentPointX + barY) - 1, iBarArea.iBr.iY + 5 ); |
|
2911 inPointList[2] = TPoint( iCurrentPointX, bar.iBr.iY ); |
|
2912 gc.DrawPolygon( inPointList, 3 ); |
|
2913 |
|
2914 gc.SetPenSize( TSize( 3, 1 ) ); |
|
2915 gc.DrawLine( TPoint( iCurrentPointX, bar.iTl.iY - 5 ), |
|
2916 TPoint( iCurrentPointX, bar.iBr.iY ) ); |
|
2917 |
|
2918 gc.SetPenColor(rgbUnselectedBorder); |
|
2919 gc.SetBrushColor(rgbUnselectedClip); |
|
2920 gc.SetPenSize( TSize( 1, 1 ) ); |
|
2921 } |
|
2922 } |
|
2923 } |
|
2924 |
|
2925 if (drawSelectedRect) |
|
2926 { |
|
2927 selectedRect.Grow( iZoomFactorX,iZoomFactorY ); |
|
2928 |
|
2929 |
|
2930 TRect outerBlackRect = selectedRect; |
|
2931 outerBlackRect.Grow(1,1); |
|
2932 gc.SetPenColor( KRgbBlack ); |
|
2933 gc.SetPenStyle( CGraphicsContext::ESolidPen ); |
|
2934 gc.DrawRoundRect( outerBlackRect, TSize(2,2) ); |
|
2935 |
|
2936 |
|
2937 if (iSelectionMode == EModeMove ) //Move, draw dashed outline |
|
2938 { |
|
2939 gc.SetPenStyle( CGraphicsContext::EDashedPen ); |
|
2940 gc.SetPenColor( KRgbBlack ); |
|
2941 gc.SetBrushColor(rgbActiveClip); |
|
2942 } |
|
2943 else |
|
2944 { |
|
2945 gc.SetPenColor(rgbSelectedBorder); |
|
2946 gc.SetBrushColor(rgbSelectedClip); |
|
2947 } |
|
2948 |
|
2949 gc.DrawRoundRect( selectedRect,roundEdgeSize ); |
|
2950 |
|
2951 selectedRect.Shrink(2,2); |
|
2952 gc.DrawBitmap( selectedRect, iGradientBitmap ); |
|
2953 |
|
2954 //Draw thumbnail in video box |
|
2955 if ( iCursorLocation == ECursorOnClip ) |
|
2956 { |
|
2957 selectedRect.Grow(2,2); |
|
2958 |
|
2959 thumbnail = iVideoItemArray[CurrentIndex()]->iTimelineBitmap; |
|
2960 if ( thumbnail ) |
|
2961 { |
|
2962 TPoint pos( selectedRect.iTl.iX+1, selectedRect.iTl.iY+1 ); |
|
2963 TSize pieceSize = TSize(STATIC_CAST(TInt, (selectedRect.Height()-2)*1.22), |
|
2964 selectedRect.Height()-2); |
|
2965 |
|
2966 if ( pieceSize.iWidth >= selectedRect.Width()-2 ) |
|
2967 { |
|
2968 pieceSize.SetSize( selectedRect.Width()-2, selectedRect.Height()-2 ); |
|
2969 } |
|
2970 TRect pieceRect( TPoint(0,0), pieceSize ); |
|
2971 gc.BitBlt( pos, thumbnail, pieceRect ); |
|
2972 } |
|
2973 } |
|
2974 drawSelectedRect = EFalse; |
|
2975 |
|
2976 if (iSelectionMode == EModeNavigation) |
|
2977 { |
|
2978 gc.SetPenColor(rgbSelectedAudioMarker); |
|
2979 } |
|
2980 else |
|
2981 { |
|
2982 gc.SetPenColor(rgbActiveAudioMarker); |
|
2983 } |
|
2984 |
|
2985 if ((selectedAudioClipIndex != -1) && |
|
2986 ( ( iMovie.AudioClipCutOutTime( selectedAudioClipIndex ).Int64() - |
|
2987 iMovie.AudioClipCutInTime( selectedAudioClipIndex ).Int64() ) < |
|
2988 iMovie.AudioClipInfo( selectedAudioClipIndex )->Duration().Int64() ) ) |
|
2989 { |
|
2990 TRect truncateBox; |
|
2991 truncateBox.iTl.iY = selectedRect.iTl.iY + 2; |
|
2992 truncateBox.iBr.iY = selectedRect.iBr.iY - 2; |
|
2993 |
|
2994 truncateBox.iTl.iX = selectedRect.iBr.iX - 4; |
|
2995 truncateBox.iBr.iX = truncateBox.iTl.iX + 1; |
|
2996 if (truncateBox.iTl.iX >= (selectedRect.iTl.iX + 2)) |
|
2997 { |
|
2998 gc.DrawRect(truncateBox); |
|
2999 } |
|
3000 |
|
3001 truncateBox.iTl.iX = selectedRect.iBr.iX - 7; |
|
3002 truncateBox.iBr.iX = truncateBox.iTl.iX + 1; |
|
3003 if (truncateBox.iTl.iX >= (selectedRect.iTl.iX + 2)) |
|
3004 { |
|
3005 gc.DrawRect(truncateBox); |
|
3006 } |
|
3007 |
|
3008 truncateBox.iTl.iX = selectedRect.iBr.iX - 10; |
|
3009 truncateBox.iBr.iX = truncateBox.iTl.iX + 1; |
|
3010 if (truncateBox.iTl.iX >= (selectedRect.iTl.iX + 2)) |
|
3011 { |
|
3012 gc.DrawRect(truncateBox); |
|
3013 } |
|
3014 } |
|
3015 } |
|
3016 |
|
3017 gc.SetPenStyle(CGraphicsContext::ESolidPen); |
|
3018 gc.SetPenColor(rgbUnselectedBorder); |
|
3019 gc.SetBrushColor(rgbUnselectedTransition); |
|
3020 |
|
3021 box.iTl.iY += (box.Height() - iTransitionMarkerSize.iHeight) / 2; |
|
3022 box.iBr.iY = box.iTl.iY + iTransitionMarkerSize.iHeight; |
|
3023 for (i = iMovie.VideoClipCount(); (i >= 0) && (iMovie.VideoClipCount() > 0); i--) |
|
3024 { |
|
3025 if ((i == 0) && (iMovie.VideoClipCount() > 0)) |
|
3026 { |
|
3027 box.iTl.iX = iVideoBarBox.iTl.iX |
|
3028 - (iTransitionMarkerSize.iWidth / 2); |
|
3029 } |
|
3030 else |
|
3031 { |
|
3032 box.iTl.iX = iVideoBarBox.iTl.iX |
|
3033 + static_cast<TInt32>((iMovie.VideoClipEndTime( i-1 ).Int64() * barWidth) / barDuration) |
|
3034 - (iTransitionMarkerSize.iWidth / 2); |
|
3035 } |
|
3036 |
|
3037 box.iBr.iX = box.iTl.iX + iTransitionMarkerSize.iWidth; |
|
3038 |
|
3039 if ((iCursorLocation == ECursorOnTransition) && (i == CurrentIndex() ) ) |
|
3040 { |
|
3041 drawSelectedRect = ETrue; |
|
3042 selectedRect = box; |
|
3043 } |
|
3044 else |
|
3045 { |
|
3046 if ( (iCursorLocation == ECursorOnClip) && (i == CurrentIndex() ) &&( iSelectionMode != EModePreview ) ) |
|
3047 { |
|
3048 box.Move( -iZoomFactorX,0); |
|
3049 box.Grow(0,iZoomFactorX/2); |
|
3050 gc.DrawRect(box); |
|
3051 box.Shrink(0,iZoomFactorX/2); |
|
3052 box.Move( iZoomFactorX,0 ); |
|
3053 } |
|
3054 else if ( (iCursorLocation == ECursorOnClip) && (i == CurrentIndex()+1 ) && ( iSelectionMode != EModePreview ) ) |
|
3055 { |
|
3056 box.Move( iZoomFactorX,0 ); |
|
3057 box.Grow(0,iZoomFactorX/2); |
|
3058 gc.DrawRect(box); |
|
3059 box.Shrink(0,iZoomFactorX/2); |
|
3060 box.Move( -iZoomFactorX,0 ); |
|
3061 } |
|
3062 else |
|
3063 { |
|
3064 gc.DrawRect(box); |
|
3065 } |
|
3066 } |
|
3067 } |
|
3068 |
|
3069 if (drawSelectedRect) |
|
3070 { |
|
3071 selectedRect.Grow(1,iZoomFactorX/2); |
|
3072 gc.SetPenColor(rgbSelectedBorder); |
|
3073 gc.SetBrushColor(rgbSelectedTransition); |
|
3074 gc.DrawRect(selectedRect); |
|
3075 } |
|
3076 |
|
3077 // draw the new position for the clip when a clip is dragged with touch |
|
3078 if ( iIsVideoDrag ) |
|
3079 { |
|
3080 TRgb rgbSelectedBorder = KRgbDarkMagenta; |
|
3081 TRgb rgbSelectedTransition = KRgbDarkMagenta; |
|
3082 gc.SetPenColor( rgbSelectedBorder ); |
|
3083 gc.SetBrushColor( rgbSelectedTransition ); |
|
3084 |
|
3085 box.iTl.iY = iVideoBarBox.iTl.iY; |
|
3086 box.iBr.iY = iVideoBarBox.iBr.iY; |
|
3087 |
|
3088 // clip is moved from right to left |
|
3089 if ( iClickedClip > iNewClipPosition ) |
|
3090 { |
|
3091 if ( iNewClipPosition == 0 ) |
|
3092 { |
|
3093 box.iTl.iX = iVideoItemRectArray[ iNewClipPosition ].iTl.iX; |
|
3094 box.iBr.iX = iVideoItemRectArray[ iNewClipPosition ].iTl.iX + 5; |
|
3095 } |
|
3096 else |
|
3097 { |
|
3098 box.iTl.iX = iVideoItemRectArray[ iNewClipPosition ].iTl.iX - 5; |
|
3099 box.iBr.iX = iVideoItemRectArray[ iNewClipPosition ].iTl.iX + 5; |
|
3100 } |
|
3101 gc.DrawRect( box ); |
|
3102 } |
|
3103 // clip is moved from left to right |
|
3104 else if ( iClickedClip < iNewClipPosition ) |
|
3105 { |
|
3106 box.iTl.iX = iVideoItemRectArray[ iNewClipPosition ].iBr.iX - 5; |
|
3107 box.iBr.iX = iVideoItemRectArray[ iNewClipPosition ].iBr.iX + 5; |
|
3108 gc.DrawRect( box ); |
|
3109 } |
|
3110 } |
|
3111 }//else |
|
3112 } |
|
3113 |
|
3114 void CVeiEditVideoContainer::HandleResourceChange(TInt aType) |
|
3115 { |
|
3116 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleResourceChange() In, aType:%d", aType); |
|
3117 |
|
3118 if (KAknsMessageSkinChange == aType) |
|
3119 { |
|
3120 HandleComponentControlsResourceChange(aType); |
|
3121 } |
|
3122 CCoeControl::HandleResourceChange(aType); |
|
3123 |
|
3124 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleResourceChange() Out"); |
|
3125 } |
|
3126 |
|
3127 void CVeiEditVideoContainer::DrawTrackBoxes() const |
|
3128 { |
|
3129 if(!iBlackScreen) |
|
3130 { |
|
3131 TRect drawableRect = iBarArea; |
|
3132 drawableRect.iTl.iX = (iVideoTrackBox.iTl.iX - KMaxZoomFactorX) - 2; |
|
3133 drawableRect.iBr.iX = (iVideoTrackBox.iBr.iX + KMaxZoomFactorX) + 2; |
|
3134 drawableRect.iTl.iY = (iVideoTrackBox.iTl.iY - KMaxZoomFactorY) - 2; |
|
3135 drawableRect.iBr.iY = (iAudioTrackBox.iBr.iY + KMaxZoomFactorY) + 2; |
|
3136 |
|
3137 Window().Invalidate( drawableRect ); |
|
3138 ActivateGc(); |
|
3139 //Redraw of the window's invalid region. |
|
3140 Window().BeginRedraw( drawableRect ); |
|
3141 Draw( drawableRect ); |
|
3142 |
|
3143 Window().EndRedraw(); |
|
3144 DeactivateGc(); |
|
3145 } |
|
3146 } |
|
3147 |
|
3148 |
|
3149 |
|
3150 |
|
3151 // ---------------------------------------------------------------------------- |
|
3152 // CVeiEditVideoContainer::GetHelpContext(...) const |
|
3153 // |
|
3154 // Gets the control's help context. Associates the control with a particular |
|
3155 // Help file and topic in a context sensitive application. |
|
3156 // ---------------------------------------------------------------------------- |
|
3157 // |
|
3158 void CVeiEditVideoContainer::GetHelpContext( TCoeHelpContext& aContext ) const |
|
3159 { |
|
3160 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetHelpContext(): In"); |
|
3161 |
|
3162 // Set UID of the CS Help file (same as application UID). |
|
3163 aContext.iMajor = KUidVideoEditor; |
|
3164 |
|
3165 // Set the context/topic. |
|
3166 aContext.iContext = KVED_HLP_EDIT_VIDEO_VIEW; |
|
3167 |
|
3168 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetHelpContext(): Out"); |
|
3169 } |
|
3170 |
|
3171 |
|
3172 void CVeiEditVideoContainer::ArrowsControl() const |
|
3173 { |
|
3174 |
|
3175 iInfoDisplay->SetLayout( CVeiTextDisplay::EOnlyName ); |
|
3176 iInfoDisplay->SetUpperArrowVisibility( EFalse ); |
|
3177 iInfoDisplay->SetLowerArrowVisibility( EFalse ); |
|
3178 iInfoDisplay->SetRightArrowVisibility( EFalse ); |
|
3179 iInfoDisplay->SetLeftArrowVisibility( EFalse ); |
|
3180 |
|
3181 iArrowsDisplay->MakeVisible( EFalse ); |
|
3182 iArrowsDisplay->SetUpperArrowVisibility( EFalse ); |
|
3183 iArrowsDisplay->SetLowerArrowVisibility( EFalse ); |
|
3184 iArrowsDisplay->SetRightArrowVisibility( EFalse ); |
|
3185 iArrowsDisplay->SetLeftArrowVisibility( EFalse ); |
|
3186 |
|
3187 iInfoDisplay->SetSlowMotionOn( EFalse ); |
|
3188 |
|
3189 iDummyCutBar->MakeVisible( ETrue ); |
|
3190 |
|
3191 if ( iCursorLocation == ECursorOnClip) |
|
3192 { |
|
3193 iInfoDisplay->MakeVisible( ETrue ); |
|
3194 iInfoDisplay->SetRect( iInfoDisplayBox ); |
|
3195 |
|
3196 if( VideoEditorUtils::IsLandscapeScreenOrientation() ) |
|
3197 { |
|
3198 iInfoDisplay->SetLayout( CVeiTextDisplay::EEverything ); |
|
3199 } |
|
3200 else |
|
3201 { |
|
3202 iInfoDisplay->SetLayout( CVeiTextDisplay::ENameAndDuration ); |
|
3203 } |
|
3204 |
|
3205 if (iSelectionMode == EModeSlowMotion) |
|
3206 { |
|
3207 iArrowsDisplay->MakeVisible( ETrue ); |
|
3208 |
|
3209 if( !VideoEditorUtils::IsLandscapeScreenOrientation() ) |
|
3210 { |
|
3211 iInfoDisplay->MakeVisible( EFalse ); |
|
3212 } |
|
3213 |
|
3214 iArrowsDisplay->SetSlowMotionOn( ETrue ); |
|
3215 iArrowsDisplay->SetLayout( CVeiTextDisplay::EArrowsHorizontal ); |
|
3216 |
|
3217 iDummyCutBar->MakeVisible( EFalse ); |
|
3218 |
|
3219 if ( iSlowMotionValue < 1000 ) |
|
3220 { |
|
3221 iArrowsDisplay->SetRightArrowVisibility( ETrue ); |
|
3222 } |
|
3223 if ( iSlowMotionValue > 250 ) |
|
3224 { |
|
3225 iArrowsDisplay->SetLeftArrowVisibility( ETrue ); |
|
3226 } |
|
3227 iArrowsDisplay->SetRect( iSlowMotionBox ); |
|
3228 } |
|
3229 else |
|
3230 { |
|
3231 iVideoDisplay->StopAnimation(); |
|
3232 } |
|
3233 } |
|
3234 else if ( iCursorLocation == ECursorOnAudio ) |
|
3235 { |
|
3236 iInfoDisplay->MakeVisible( ETrue ); |
|
3237 iInfoDisplay->SetRect( iInfoDisplayBox ); |
|
3238 |
|
3239 if( VideoEditorUtils::IsLandscapeScreenOrientation() ) |
|
3240 { |
|
3241 iInfoDisplay->SetLayout( CVeiTextDisplay::EEverything ); |
|
3242 } |
|
3243 else |
|
3244 { |
|
3245 iInfoDisplay->SetLayout( CVeiTextDisplay::ENameAndDuration ); |
|
3246 } |
|
3247 |
|
3248 } |
|
3249 else if ( iCursorLocation == ECursorOnTransition ) |
|
3250 { |
|
3251 iDummyCutBar->MakeVisible( ETrue ); |
|
3252 iInfoDisplay->MakeVisible( ETrue ); |
|
3253 |
|
3254 iInfoDisplay->SetUpperArrowVisibility( ETrue ); |
|
3255 iInfoDisplay->SetLowerArrowVisibility( ETrue ); |
|
3256 iInfoDisplay->SetLayout( CVeiTextDisplay::EArrowsVertical ); |
|
3257 iInfoDisplay->SetRect( iTransitionArrowsBox ); |
|
3258 } |
|
3259 if ( iView.EditorState() == CVeiEditVideoView::EMixAudio || |
|
3260 iView.EditorState() == CVeiEditVideoView::EAdjustVolume) |
|
3261 { |
|
3262 iDummyCutBar->MakeVisible( EFalse ); |
|
3263 } |
|
3264 |
|
3265 if ( iView.EditorState() == CVeiEditVideoView::EMixAudio) |
|
3266 { |
|
3267 iInfoDisplay->MakeVisible(EFalse); |
|
3268 } |
|
3269 if ( iView.EditorState() == CVeiEditVideoView::EAdjustVolume) |
|
3270 { |
|
3271 iInfoDisplay->MakeVisible(ETrue); |
|
3272 } |
|
3273 } |
|
3274 |
|
3275 void CVeiEditVideoContainer::DrawPlayHead() |
|
3276 { |
|
3277 CFbsBitmap* thumbnail = 0; |
|
3278 TRect redrawArea = TRect(iVideoBarIconPos.iX+iVideoTrackIcon->SizeInPixels().iWidth, |
|
3279 iBarArea.iTl.iY - 5, iBarArea.iBr.iX, iBarArea.iBr.iY + 10 ); |
|
3280 |
|
3281 Window().Invalidate( redrawArea ); |
|
3282 ActivateGc(); |
|
3283 //Redraw of the window's invalid region. |
|
3284 Window().BeginRedraw( redrawArea ); |
|
3285 CWindowGc& gc = SystemGc(); |
|
3286 |
|
3287 // Draw skin background |
|
3288 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
3289 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
3290 AknsDrawUtils::Background( skin, cc, this, gc, Rect() ); |
|
3291 |
|
3292 /* Draw bar area. */ |
|
3293 TInt i; |
|
3294 TRgb rgbUnselectedBorder = TRgb( 132,132,132 ); |
|
3295 TRgb rgbUnselectedTrackFill = TRgb(221,221,221); |
|
3296 TRgb rgbUnselectedTrackBorder = TRgb( 201,201,201 ); |
|
3297 TRgb rgbUnselectedTrackBorderOuterRect = TRgb( 162,162,162 ); |
|
3298 |
|
3299 TRgb rgbUnselectedAudioMarker = KRgbWhite; |
|
3300 TRgb rgbUnselectedClip = TRgb( 140,166,198 ); |
|
3301 TRgb rgbUnselectedTransition = KRgbWhite; |
|
3302 |
|
3303 gc.SetPenStyle( CGraphicsContext::ESolidPen ); |
|
3304 gc.SetPenColor( rgbUnselectedTrackBorderOuterRect ); |
|
3305 gc.SetBrushColor( rgbUnselectedTrackFill ); |
|
3306 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
3307 gc.DrawRoundRect(iVideoTrackBox, TSize(2,2)); |
|
3308 |
|
3309 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
3310 gc.SetPenColor( rgbUnselectedTrackBorder ); |
|
3311 TRect outerRect( iVideoTrackBox ); |
|
3312 outerRect.Shrink(1,1); |
|
3313 gc.DrawRoundRect(outerRect, TSize(2,2) ); |
|
3314 |
|
3315 gc.SetPenColor( rgbUnselectedTrackBorderOuterRect ); |
|
3316 gc.SetBrushColor( rgbUnselectedTrackFill ); |
|
3317 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
3318 gc.DrawRoundRect(iAudioTrackBox, TSize(2,2)); |
|
3319 |
|
3320 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
3321 gc.SetPenColor(rgbUnselectedTrackBorder); |
|
3322 outerRect = iAudioTrackBox; |
|
3323 outerRect.Shrink(1,1); |
|
3324 gc.DrawRoundRect(outerRect, TSize(2,2) ); |
|
3325 |
|
3326 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
3327 |
|
3328 TInt64 barDuration = iMovie.Duration().Int64(); |
|
3329 TInt64 audioDuration(0); |
|
3330 if ( (iMovie.AudioClipCount() != 0) && (iSelectionMode == EModeRecording )) |
|
3331 { |
|
3332 audioDuration = (iMovie.AudioClipEndTime( iMovie.AudioClipCount() - 1 )).Int64(); |
|
3333 } |
|
3334 |
|
3335 audioDuration+= iRecordedAudioDuration.Int64(); |
|
3336 |
|
3337 if ( audioDuration > barDuration ) |
|
3338 { |
|
3339 barDuration = audioDuration; |
|
3340 } |
|
3341 |
|
3342 if ( iRecordedAudioStartTime > barDuration ) |
|
3343 { |
|
3344 barDuration = iRecordedAudioStartTime.Int64(); |
|
3345 } |
|
3346 if (barDuration < 30000000) |
|
3347 { |
|
3348 barDuration = 30000000; |
|
3349 } |
|
3350 else if (barDuration < 45000000) |
|
3351 { |
|
3352 barDuration = 45000000; |
|
3353 } |
|
3354 else{ |
|
3355 barDuration = ((barDuration / 30000000) + 1) * 30000000; |
|
3356 } |
|
3357 |
|
3358 gc.SetPenColor(rgbUnselectedBorder); |
|
3359 gc.SetBrushColor(rgbUnselectedClip); |
|
3360 |
|
3361 TRect audioBoxes = TRect(0,0,0,0); |
|
3362 |
|
3363 TRect box; |
|
3364 box.iTl.iY = iAudioBarBox.iTl.iY; |
|
3365 box.iBr.iY = iAudioBarBox.iBr.iY; |
|
3366 TInt barWidth = iAudioBarBox.Width(); |
|
3367 TInt videoIndex = 0; |
|
3368 |
|
3369 for (i = 0; i < iMovie.AudioClipCount(); i++) |
|
3370 { |
|
3371 box.iTl.iX = iAudioBarBox.iTl.iX |
|
3372 + static_cast<TInt32>((iMovie.AudioClipStartTime(i).Int64() * barWidth) / |
|
3373 barDuration); |
|
3374 box.iBr.iX = iAudioBarBox.iTl.iX |
|
3375 + static_cast<TInt32>((iMovie.AudioClipEndTime(i).Int64() * barWidth) / barDuration)+ 1; |
|
3376 |
|
3377 { |
|
3378 gc.DrawRect(box); |
|
3379 |
|
3380 gc.SetPenColor(rgbUnselectedAudioMarker); |
|
3381 |
|
3382 audioBoxes = box; |
|
3383 |
|
3384 gc.SetPenColor(rgbUnselectedAudioMarker); |
|
3385 |
|
3386 if ( ( iMovie.AudioClipCutOutTime( i ).Int64() - |
|
3387 iMovie.AudioClipCutInTime( i ).Int64() ) < |
|
3388 iMovie.AudioClipInfo( i )->Duration().Int64() ) |
|
3389 { |
|
3390 TRect truncateBox; |
|
3391 truncateBox.iTl.iY = box.iTl.iY + 2; |
|
3392 truncateBox.iBr.iY = box.iBr.iY - 2; |
|
3393 |
|
3394 truncateBox.iTl.iX = box.iBr.iX - 4; |
|
3395 truncateBox.iBr.iX = truncateBox.iTl.iX + 1; |
|
3396 if (truncateBox.iTl.iX >= (box.iTl.iX + 2)) |
|
3397 { |
|
3398 gc.DrawRect(truncateBox); |
|
3399 } |
|
3400 |
|
3401 truncateBox.iTl.iX = box.iBr.iX - 7; |
|
3402 truncateBox.iBr.iX = truncateBox.iTl.iX + 1; |
|
3403 if (truncateBox.iTl.iX >= (box.iTl.iX + 2)) |
|
3404 { |
|
3405 gc.DrawRect(truncateBox); |
|
3406 } |
|
3407 |
|
3408 truncateBox.iTl.iX = box.iBr.iX - 10; |
|
3409 truncateBox.iBr.iX = truncateBox.iTl.iX + 1; |
|
3410 if (truncateBox.iTl.iX >= (box.iTl.iX + 2)) |
|
3411 { |
|
3412 gc.DrawRect(truncateBox); |
|
3413 } |
|
3414 } |
|
3415 |
|
3416 gc.SetPenColor(rgbUnselectedBorder); |
|
3417 } |
|
3418 |
|
3419 TTimeIntervalMicroSeconds audioClipStartTimeInt = iMovie.AudioClipStartTime(i).Int64() + iMovie.AudioClipCutInTime(i).Int64(); |
|
3420 TTimeIntervalMicroSeconds audioClipEndTimeInt = iMovie.AudioClipEndTime(i).Int64(); |
|
3421 |
|
3422 if ((audioClipStartTimeInt == TTimeIntervalMicroSeconds(0)) && (iMovie.VideoClipCount() > 0)) |
|
3423 { |
|
3424 TRect syncBox; |
|
3425 syncBox.iTl.iX = box.iTl.iX; |
|
3426 syncBox.iTl.iY = iVideoBarBox.iBr.iY; |
|
3427 syncBox.iBr.iX = box.iTl.iX + 1; |
|
3428 syncBox.iBr.iY = iAudioBarBox.iTl.iY; |
|
3429 |
|
3430 gc.DrawRect(syncBox); |
|
3431 } |
|
3432 |
|
3433 while (videoIndex < iMovie.VideoClipCount()) |
|
3434 { |
|
3435 TInt oldIndex = videoIndex; |
|
3436 if ( iMovie.VideoClipEndTime( oldIndex ) < audioClipStartTimeInt ) |
|
3437 { |
|
3438 videoIndex++; |
|
3439 } |
|
3440 else if ( iMovie.VideoClipEndTime( oldIndex ) == audioClipStartTimeInt ) |
|
3441 { |
|
3442 TRect syncBox; |
|
3443 syncBox.iTl.iX = box.iTl.iX; |
|
3444 syncBox.iTl.iY = iVideoBarBox.iBr.iY; |
|
3445 syncBox.iBr.iX = box.iTl.iX + 1; |
|
3446 syncBox.iBr.iY = iAudioBarBox.iTl.iY; |
|
3447 |
|
3448 gc.DrawRect(syncBox); |
|
3449 break; |
|
3450 } |
|
3451 else |
|
3452 { |
|
3453 break; |
|
3454 } |
|
3455 } |
|
3456 |
|
3457 while (videoIndex < iMovie.VideoClipCount()) |
|
3458 { |
|
3459 TInt oldIndex = videoIndex; |
|
3460 |
|
3461 if ( iMovie.VideoClipEndTime( oldIndex ) < audioClipEndTimeInt ) |
|
3462 { |
|
3463 videoIndex++; |
|
3464 } |
|
3465 else if ( iMovie.VideoClipEndTime( oldIndex ) == audioClipEndTimeInt ) |
|
3466 { |
|
3467 TRect syncBox; |
|
3468 syncBox.iTl.iX = box.iBr.iX - 1; |
|
3469 syncBox.iTl.iY = iVideoBarBox.iBr.iY; |
|
3470 syncBox.iBr.iX = box.iBr.iX; |
|
3471 syncBox.iBr.iY = iAudioBarBox.iTl.iY; |
|
3472 |
|
3473 gc.DrawRect(syncBox); |
|
3474 break; |
|
3475 } |
|
3476 else |
|
3477 { |
|
3478 break; |
|
3479 } |
|
3480 } |
|
3481 } |
|
3482 |
|
3483 box.iTl.iY = iVideoBarBox.iTl.iY; |
|
3484 box.iBr.iY = iVideoBarBox.iBr.iY; |
|
3485 barWidth = iVideoBarBox.Width(); |
|
3486 |
|
3487 |
|
3488 TRect videoBoxes = TRect(); |
|
3489 |
|
3490 for (i = 0; i < iMovie.VideoClipCount(); i++) |
|
3491 { |
|
3492 box.iTl.iX = iVideoBarBox.iTl.iX |
|
3493 + static_cast<TInt32>((iMovie.VideoClipStartTime( i ).Int64() * barWidth) / barDuration); |
|
3494 box.iBr.iX = iVideoBarBox.iTl.iX |
|
3495 + static_cast<TInt32>((iMovie.VideoClipEndTime( i ).Int64() * barWidth) / barDuration) + 1; |
|
3496 |
|
3497 videoBoxes.Resize( box.Size() ); |
|
3498 |
|
3499 gc.DrawRect(box); |
|
3500 //Draw thumbnail in video boxes on the timeline. |
|
3501 thumbnail = iVideoItemArray[i]->iTimelineBitmap; |
|
3502 if ( thumbnail ) |
|
3503 { |
|
3504 TPoint pos( box.iTl.iX+1, box.iTl.iY+1 ); |
|
3505 |
|
3506 TSize pieceSize = TSize(STATIC_CAST(TInt, (box.Height()-2)*1.22), box.Height()-2); |
|
3507 |
|
3508 if ( pieceSize.iWidth >= box.Width()-2 ) |
|
3509 { |
|
3510 pieceSize.SetSize( box.Width()-2, box.Height()-2 ); |
|
3511 } |
|
3512 TRect pieceRect( TPoint(0,0), pieceSize ); |
|
3513 gc.BitBlt( pos, thumbnail, pieceRect ); |
|
3514 } |
|
3515 } |
|
3516 |
|
3517 gc.SetPenStyle(CGraphicsContext::ESolidPen); |
|
3518 gc.SetPenColor(rgbUnselectedBorder); |
|
3519 gc.SetBrushColor(rgbUnselectedTransition); |
|
3520 |
|
3521 box.iTl.iY += (box.Height() - iTransitionMarkerSize.iHeight) / 2; |
|
3522 box.iBr.iY = box.iTl.iY + iTransitionMarkerSize.iHeight; |
|
3523 for (i = iMovie.VideoClipCount(); (i >= 0) && (iMovie.VideoClipCount() > 0); i--) |
|
3524 { |
|
3525 if ((i == 0) && (iMovie.VideoClipCount() > 0)) |
|
3526 { |
|
3527 box.iTl.iX = iVideoBarBox.iTl.iX |
|
3528 - (iTransitionMarkerSize.iWidth / 2); |
|
3529 } |
|
3530 else |
|
3531 { |
|
3532 box.iTl.iX = iVideoBarBox.iTl.iX |
|
3533 + static_cast<TInt32>((iMovie.VideoClipEndTime( i-1 ).Int64() * barWidth) / barDuration) |
|
3534 - (iTransitionMarkerSize.iWidth / 2); |
|
3535 } |
|
3536 |
|
3537 box.iBr.iX = box.iTl.iX + iTransitionMarkerSize.iWidth; |
|
3538 |
|
3539 |
|
3540 gc.DrawRect(box); |
|
3541 } |
|
3542 |
|
3543 //Draw play head. |
|
3544 TRect bar( iBarArea );//bar rect. |
|
3545 const TUint barY = 6; |
|
3546 TUint width = videoBoxes.Width(); |
|
3547 TInt audioTrackWidth(0); |
|
3548 if ( audioBoxes.iBr.iX > 0 ) |
|
3549 { |
|
3550 audioTrackWidth = audioBoxes.iBr.iX - iAudioTrackBox.iTl.iX; |
|
3551 } |
|
3552 |
|
3553 if ( videoBoxes.Width() >= audioTrackWidth ) |
|
3554 { |
|
3555 width = videoBoxes.Width(); |
|
3556 } |
|
3557 else |
|
3558 { |
|
3559 width = audioTrackWidth; |
|
3560 } |
|
3561 TUint totalTime = static_cast<TInt32>(iMovie.Duration().Int64() /1000);//( iVideoDisplay->TotalLengthL().Int64() / 1000 ).Low(); |
|
3562 |
|
3563 if ( totalTime == 0 ) |
|
3564 { |
|
3565 totalTime = 1; |
|
3566 } |
|
3567 |
|
3568 TInt currentPointX = iCurrentPoint * width / totalTime + iVideoBarBox.iTl.iX; |
|
3569 iCurrentPointX = currentPointX; |
|
3570 |
|
3571 bar.iTl.iY += barY; |
|
3572 bar.iTl.iX += barY; |
|
3573 bar.iTl.iX += iVideoTrackIcon->SizeInPixels().iWidth; |
|
3574 bar.iBr.iY -= barY / 2; |
|
3575 bar.iBr.iX -= barY; |
|
3576 |
|
3577 |
|
3578 gc.SetBrushColor( KRgbBlack ); |
|
3579 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
3580 gc.SetPenColor( KRgbDarkGray ); |
|
3581 gc.SetPenStyle( CGraphicsContext::ESolidPen ); |
|
3582 |
|
3583 TPoint inPointList[3]; |
|
3584 inPointList[0] = TPoint( currentPointX - barY + 1, iBarArea.iTl.iY - 5 ); |
|
3585 inPointList[1] = TPoint( currentPointX + barY - 1, iBarArea.iTl.iY - 5 ); |
|
3586 inPointList[2] = TPoint( currentPointX, bar.iTl.iY - 6 ); |
|
3587 gc.DrawPolygon( inPointList, 3 ); |
|
3588 |
|
3589 inPointList[0] = TPoint( currentPointX - barY + 1, iBarArea.iBr.iY + 5 ); |
|
3590 inPointList[1] = TPoint( currentPointX + barY - 1, iBarArea.iBr.iY + 5 ); |
|
3591 inPointList[2] = TPoint( currentPointX, bar.iBr.iY ); |
|
3592 gc.DrawPolygon( inPointList, 3 ); |
|
3593 |
|
3594 gc.SetPenSize( TSize( 3, 1 ) ); |
|
3595 gc.DrawLine( TPoint( currentPointX, bar.iTl.iY - 5 ), |
|
3596 TPoint( currentPointX, bar.iBr.iY ) ); |
|
3597 |
|
3598 Window().EndRedraw(); |
|
3599 DeactivateGc(); |
|
3600 } |
|
3601 |
|
3602 void CVeiEditVideoContainer::DialogDismissedL( TInt aButtonId ) |
|
3603 { |
|
3604 iTakeSnapshot = EFalse; |
|
3605 if ( aButtonId == -1 ) |
|
3606 { |
|
3607 // when pressing cancel button. |
|
3608 /*if ( iTempVideoInfo && !iFrameReady) |
|
3609 { |
|
3610 iTempVideoInfo->CancelFrame(); |
|
3611 } |
|
3612 */ |
|
3613 CancelSnapshotSave(); |
|
3614 } |
|
3615 } |
|
3616 |
|
3617 void CVeiEditVideoContainer::CancelSnapshotSave() |
|
3618 { |
|
3619 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::CancelSnapshotSave: in"); |
|
3620 if ( iConverter ) |
|
3621 { |
|
3622 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::CancelSnapshotSave: 1"); |
|
3623 iConverter->Cancel(); |
|
3624 iConverter->CancelEncoding(); //also close the file |
|
3625 } |
|
3626 if ( iSaveToFileName ) |
|
3627 { |
|
3628 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::CancelSnapshotSave: 2, iSaveToFileName:%S", iSaveToFileName); |
|
3629 |
|
3630 RFs& fs = iEikonEnv->FsSession(); |
|
3631 TInt result = fs.Delete( *iSaveToFileName ); |
|
3632 delete iSaveToFileName; |
|
3633 iSaveToFileName = NULL; |
|
3634 } |
|
3635 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::CancelSnapshotSave: out"); |
|
3636 } |
|
3637 |
|
3638 void CVeiEditVideoContainer::SetCurrentIndex( TInt aCurrentIndex ) |
|
3639 { |
|
3640 if ( (iCursorLocation == ECursorOnAudio) || |
|
3641 (iCursorLocation == ECursorOnEmptyAudioTrack) ) |
|
3642 { |
|
3643 iAudioCursorPos = aCurrentIndex; |
|
3644 } |
|
3645 else |
|
3646 { |
|
3647 iVideoCursorPos = aCurrentIndex; |
|
3648 } |
|
3649 } |
|
3650 |
|
3651 void CVeiEditVideoContainer::NotifyVideoClipAdded( CVedMovie& /*aMovie*/, |
|
3652 TInt aIndex ) |
|
3653 { |
|
3654 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipAdded: in"); |
|
3655 |
|
3656 CStoryboardVideoItem* item=0; |
|
3657 |
|
3658 if ( iView.WaitMode() == CVeiEditVideoView::EDuplicating ) |
|
3659 { |
|
3660 TTimeIntervalMicroSeconds cutInTime = iMovie.VideoClipCutInTime( aIndex - 1 ); |
|
3661 TTimeIntervalMicroSeconds cutOutTime = iMovie.VideoClipCutOutTime( aIndex - 1 ); |
|
3662 |
|
3663 iMovie.VideoClipSetColorEffect( aIndex, iMovie.VideoClipColorEffect( aIndex - 1 ) ); |
|
3664 iMovie.VideoClipSetColorTone( aIndex, iMovie.VideoClipColorTone( aIndex - 1 ) ); |
|
3665 iMovie.SetVideoClipVolumeGainL(aIndex, iMovie.GetVideoClipVolumeGainL(aIndex - 1)); |
|
3666 |
|
3667 iMovie.VideoClipSetSpeed( aIndex, iMovie.VideoClipSpeed( aIndex - 1 ) ); |
|
3668 iMovie.VideoClipSetMuted( aIndex, iMovie.VideoClipIsMuted( aIndex - 1 ) ); |
|
3669 |
|
3670 TBool isFile(iMovie.VideoClipInfo( aIndex )->Class() == EVedVideoClipClassFile); |
|
3671 if ( isFile ) |
|
3672 { |
|
3673 iMovie.VideoClipSetCutInTime( aIndex, cutInTime ); |
|
3674 iMovie.VideoClipSetCutOutTime( aIndex, cutOutTime ); |
|
3675 } |
|
3676 /* Copy bitmaps, names etc. to new storyboarditem. */ |
|
3677 TRAP_IGNORE( item = CStoryboardVideoItem::NewL( |
|
3678 *iVideoItemArray[aIndex-1]->iIconBitmap, |
|
3679 *iVideoItemArray[aIndex-1]->iIconMask, |
|
3680 *iVideoItemArray[aIndex-1]->iFilename, |
|
3681 iVideoItemArray[aIndex-1]->iIsFile, |
|
3682 *iVideoItemArray[aIndex-1]->iAlbumName ) ); |
|
3683 if (item) |
|
3684 { |
|
3685 item->InsertLastFrameL( *iVideoItemArray[aIndex-1]->iLastFrameBitmap, |
|
3686 *iVideoItemArray[aIndex-1]->iLastFrameMask ); |
|
3687 item->InsertTimelineFrameL( *iVideoItemArray[aIndex-1]->iTimelineBitmap, |
|
3688 *iVideoItemArray[aIndex-1]->iTimelineMask ); |
|
3689 |
|
3690 iVideoItemArray.Insert( item, aIndex ); |
|
3691 } |
|
3692 |
|
3693 iVideoCursorPos = aIndex; |
|
3694 iCursorLocation = ECursorOnClip; |
|
3695 DrawDeferred(); |
|
3696 iView.SetWaitMode( CVeiEditVideoView::ENotWaiting ); |
|
3697 SetCursorLocation( CursorLocation() ); |
|
3698 return; |
|
3699 } |
|
3700 |
|
3701 iCurrentlyProcessedIndex = aIndex; |
|
3702 TFileName fileName; |
|
3703 |
|
3704 TBool isFile(iMovie.VideoClipInfo( aIndex )->Class() == EVedVideoClipClassFile); |
|
3705 if ( isFile ) |
|
3706 { |
|
3707 fileName = iMovie.VideoClipInfo( aIndex )->FileName(); |
|
3708 } |
|
3709 else |
|
3710 { |
|
3711 CVedVideoClipInfo* info = iMovie.VideoClipInfo( aIndex ); |
|
3712 |
|
3713 if (info->Class() == EVedVideoClipClassGenerated) |
|
3714 { |
|
3715 if (info->Generator()->Uid() == KUidTitleClipGenerator) |
|
3716 { |
|
3717 fileName = iMovie.VideoClipInfo( aIndex )->DescriptiveName(); |
|
3718 } |
|
3719 else if (info->Generator()->Uid() == KUidImageClipGenerator) |
|
3720 { |
|
3721 CVeiImageClipGenerator* generator = STATIC_CAST(CVeiImageClipGenerator*, info->Generator()); |
|
3722 fileName = generator->ImageFilename(); |
|
3723 } |
|
3724 } |
|
3725 } |
|
3726 |
|
3727 TFileName albumName; |
|
3728 GetAlbumL( fileName, albumName ); |
|
3729 |
|
3730 TRAPD( error, (item = CStoryboardVideoItem::NewL( *iNoThumbnailIcon, |
|
3731 *iNoThumbnailIconMask, fileName, isFile, albumName )) ); |
|
3732 |
|
3733 if ( error == KErrNone ) |
|
3734 { |
|
3735 iVideoItemArray.Insert( item, iCurrentlyProcessedIndex ); |
|
3736 |
|
3737 iVideoCursorPos = aIndex; |
|
3738 iCursorLocation = ECursorOnClip; |
|
3739 iZoomFactorX = 0; |
|
3740 iZoomFactorY = 0; |
|
3741 |
|
3742 TRAPD( frameError, StartFrameTakerL( aIndex ) ); |
|
3743 if ( frameError ) |
|
3744 { |
|
3745 iMovie.RemoveVideoClip( aIndex ); |
|
3746 iView.ShowErrorNote( R_VEI_VIDEO_FAILED ); |
|
3747 iView.CancelWaitDialog(); |
|
3748 iView.AddNext(); |
|
3749 } |
|
3750 } |
|
3751 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipAdded: out"); |
|
3752 } |
|
3753 |
|
3754 void CVeiEditVideoContainer::NotifyVideoClipAddingFailed( CVedMovie& |
|
3755 /*aMovie*/, TInt DEBUGLOG_ARG(aError) ) |
|
3756 { |
|
3757 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipAddingFailed: In and Out, aError:%d", aError); |
|
3758 } |
|
3759 |
|
3760 void CVeiEditVideoContainer::NotifyVideoClipInfoReady( CVedVideoClipInfo& aInfo, |
|
3761 TInt aError ) |
|
3762 { |
|
3763 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipInfoReady: In, aError:%d", aError); |
|
3764 // video info ready, get thumbnail |
|
3765 if (KErrNone == aError) |
|
3766 { |
|
3767 if (iTempVideoInfo) |
|
3768 { |
|
3769 delete iTempVideoInfo; |
|
3770 iTempVideoInfo = NULL; |
|
3771 } |
|
3772 iTempVideoInfo = &aInfo; |
|
3773 TSize thumbResolution; |
|
3774 thumbResolution = iVideoDisplay->GetScreenSize(); |
|
3775 /* Check if cursor is on transition. When editvideocontainer is activated |
|
3776 and right key is pressed very fast application crashes without this check */ |
|
3777 |
|
3778 TInt currentIndex; |
|
3779 currentIndex = CurrentIndex(); |
|
3780 |
|
3781 if ( iCursorLocation == ECursorOnTransition ) |
|
3782 { |
|
3783 currentIndex--; |
|
3784 } |
|
3785 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipInfoReady: 1"); |
|
3786 //we are in preview mode. |
|
3787 if ( iView.EditorState() == CVeiEditVideoView::EQuickPreview ) |
|
3788 { |
|
3789 return; |
|
3790 } |
|
3791 |
|
3792 TTimeIntervalMicroSeconds cutInTime = iMovie.VideoClipCutInTime( currentIndex ); |
|
3793 TTimeIntervalMicroSeconds cutOutTime = iMovie.VideoClipCutOutTime( currentIndex ); |
|
3794 |
|
3795 TInt firstThumbNailIndex = iTempVideoInfo->GetVideoFrameIndexL( cutInTime ); |
|
3796 // TInt lastThumbNailIndex = aInfo.GetVideoFrameIndexL( cutOutTime ); |
|
3797 // lastThumbNailIndex--; |
|
3798 |
|
3799 TDisplayMode thumbnailDisplayMode( ENone ); |
|
3800 |
|
3801 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipInfoReady: 2"); |
|
3802 /* : |
|
3803 check out on every phone before releasing whether videodisplay should be stopped before starting |
|
3804 asynchronous GetFrameL() |
|
3805 see how EStateGettingFrame is handled in SetPreviewState |
|
3806 Stopping frees memory and it is needed in memory sensible devices |
|
3807 */ |
|
3808 TRAPD( err, iTempVideoInfo->GetFrameL( *this, firstThumbNailIndex, &thumbResolution, |
|
3809 thumbnailDisplayMode ) ); |
|
3810 if (KErrNone == err) |
|
3811 { |
|
3812 SetPreviewState(EStateGettingFrame); |
|
3813 } |
|
3814 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipInfoReady: 3, err:%d", err); |
|
3815 if ( KErrNone != err ) |
|
3816 { |
|
3817 if ( iProgressDialog ) |
|
3818 { |
|
3819 iProgressDialog->GetProgressInfoL()->SetAndDraw( 100 ); |
|
3820 TRAP_IGNORE( iProgressDialog->ProcessFinishedL() ); |
|
3821 //iProgressDialog = NULL; |
|
3822 } |
|
3823 User::Panic( _L("VideoEditor"), 65 ); |
|
3824 } |
|
3825 } |
|
3826 |
|
3827 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipInfoReady: Out"); |
|
3828 } |
|
3829 |
|
3830 void CVeiEditVideoContainer::NotifyVideoClipFrameCompleted(CVedVideoClipInfo& /*aInfo*/, |
|
3831 TInt aError, |
|
3832 CFbsBitmap* aFrame) |
|
3833 { |
|
3834 LOGFMT2(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipFrameCompleted: In, aError:%d, iTakeSnapshot:%d", aError, iTakeSnapshot); |
|
3835 |
|
3836 iFrameReady = ETrue; |
|
3837 |
|
3838 if (EStateGettingFrame == iPreviewState) |
|
3839 { |
|
3840 SetPreviewState(iPreviousPreviewState); |
|
3841 // SetEditorState is effective because iPreviewState is changed |
|
3842 iView.SetEditorState( iView.EditorState() ); |
|
3843 } |
|
3844 |
|
3845 if(KErrNone == aError && aFrame) |
|
3846 { |
|
3847 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipFrameCompleted: 3 calling iVideoDisplay->ShowPictureL()"); |
|
3848 //TRAP_IGNORE(iVideoDisplay->ShowPictureL( *aFrame )); |
|
3849 |
|
3850 if ( iTakeSnapshot) |
|
3851 { |
|
3852 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipFrameCompleted: 2"); |
|
3853 |
|
3854 // For some reason some phones crash in taking snapshot if this progress note is started |
|
3855 // earlier from TakeSnapshotL, that is why it is started now here |
|
3856 //StartProgressDialogL(R_VEI_PROGRESS_NOTE_WITH_CANCEL, R_VEI_PROGRESS_NOTE_SAVING_IMAGE); |
|
3857 iConverter->SetBitmap( aFrame ); |
|
3858 SaveSnapshotL(); |
|
3859 return; |
|
3860 } |
|
3861 TRAP_IGNORE(iVideoDisplay->ShowPictureL( *aFrame )); |
|
3862 delete aFrame; |
|
3863 aFrame = NULL; |
|
3864 if (iProgressDialog ) |
|
3865 { |
|
3866 iProgressDialog->GetProgressInfoL()->SetAndDraw( 100 ); |
|
3867 TRAP_IGNORE( iProgressDialog->ProcessFinishedL() ); |
|
3868 //iProgressDialog = NULL; |
|
3869 } |
|
3870 DrawDeferred(); |
|
3871 if (iTakeSnapshotWaiting) |
|
3872 { |
|
3873 if (! iCallBack) |
|
3874 { |
|
3875 TCallBack cb (CVeiEditVideoContainer::AsyncTakeSnapshot, this); |
|
3876 iCallBack = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard); |
|
3877 } |
|
3878 iCallBack->CallBack(); |
|
3879 } |
|
3880 return; |
|
3881 } |
|
3882 |
|
3883 if ( aFrame ) |
|
3884 { |
|
3885 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipFrameCompleted: 4"); |
|
3886 delete aFrame; |
|
3887 aFrame = NULL; |
|
3888 } |
|
3889 |
|
3890 if (iProgressDialog ) |
|
3891 { |
|
3892 iProgressDialog->GetProgressInfoL()->SetAndDraw( 100 ); |
|
3893 TRAP_IGNORE( iProgressDialog->ProcessFinishedL() ); |
|
3894 //iProgressDialog = NULL; |
|
3895 } |
|
3896 else if ( KErrNone == aError) |
|
3897 { |
|
3898 iView.HandleCommandL( EAknSoftkeyOk ); |
|
3899 } |
|
3900 /* In case of an error, we'll do nothing. */ |
|
3901 /* If clip is too short, we won't get new thumbnail, so use old one->return; */ |
|
3902 if (KErrNone != aError) |
|
3903 { |
|
3904 iCurrentlyProcessedIndex = -1; |
|
3905 return; |
|
3906 } |
|
3907 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipFrameCompleted: Out"); |
|
3908 } |
|
3909 |
|
3910 void CVeiEditVideoContainer::NotifyVideoClipGeneratorSettingsChanged(CVedMovie& /*aMovie*/, |
|
3911 TInt aIndex) |
|
3912 { |
|
3913 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipGeneratorSettingsChanged: In"); |
|
3914 iCurrentlyProcessedIndex = aIndex; |
|
3915 StartFrameTakerL( aIndex ); |
|
3916 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipGeneratorSettingsChanged: Out"); |
|
3917 } |
|
3918 |
|
3919 void CVeiEditVideoContainer::NotifyVideoClipDescriptiveNameChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/) |
|
3920 { |
|
3921 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipDescriptiveNameChanged: In"); |
|
3922 TFileName fileName; |
|
3923 fileName = iMovie.VideoClipInfo( CurrentIndex() )->DescriptiveName(); |
|
3924 iInfoDisplay->SetName(fileName); |
|
3925 iVideoDisplay->DrawDeferred(); |
|
3926 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipDescriptiveNameChanged: Out"); |
|
3927 } |
|
3928 |
|
3929 void CVeiEditVideoContainer::NotifyMovieQualityChanged(CVedMovie& /*aMovie*/) |
|
3930 { |
|
3931 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyMovieQualityChanged: In and Out"); |
|
3932 } |
|
3933 void CVeiEditVideoContainer::NotifyVideoClipRemoved( |
|
3934 CVedMovie& /*aMovie*/, TInt aIndex ) |
|
3935 { |
|
3936 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipRemoved: In"); |
|
3937 CStoryboardVideoItem* item = iVideoItemArray[ aIndex ]; |
|
3938 iVideoItemArray.Remove( aIndex ); |
|
3939 delete item; |
|
3940 SetCursorLocation( ECursorOnClip ); |
|
3941 DrawDeferred(); |
|
3942 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipRemoved: Out"); |
|
3943 } |
|
3944 |
|
3945 void CVeiEditVideoContainer::NotifyVideoClipIndicesChanged( |
|
3946 CVedMovie& /*aMovie*/, TInt aOldIndex, TInt aNewIndex ) |
|
3947 { |
|
3948 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipIndicesChanged: In"); |
|
3949 CStoryboardVideoItem* item = iVideoItemArray[ aOldIndex ]; |
|
3950 iVideoItemArray.Remove( aOldIndex ); |
|
3951 iVideoItemArray.Insert( item, aNewIndex ); |
|
3952 DrawDeferred(); |
|
3953 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipIndicesChanged: Out"); |
|
3954 } |
|
3955 |
|
3956 void CVeiEditVideoContainer::NotifyVideoClipTimingsChanged( |
|
3957 CVedMovie& aMovie, TInt aIndex ) |
|
3958 { |
|
3959 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipTimingsChanged: In"); |
|
3960 /* Check is slowmotion on */ |
|
3961 if ( iMovie.VideoClipSpeed( iVideoCursorPos ) != 1000 ) |
|
3962 { |
|
3963 iEffectSymbols->SetSlowMotionIconVisibility(ETrue); |
|
3964 } |
|
3965 else |
|
3966 { |
|
3967 // Engine sets mute automatically on if speed is set under 1000, but it does not return |
|
3968 // mute state to original if speed is reset to 1000, reclaimed to nokia |
|
3969 // problem is that we should respect user's mute settings prior to slow motion |
|
3970 // i.e. when removing slow motion mute settings should be reset to user defined value |
|
3971 // iMovie.VideoClipSetMuted(aIndex, EFalse); |
|
3972 iEffectSymbols->SetSlowMotionIconVisibility(EFalse); |
|
3973 } |
|
3974 /* If SM is on, audio is muted */ |
|
3975 if ((iMovie.VideoClipIsMuted(aIndex) != EFalse) || |
|
3976 (iMovie.VideoClipEditedHasAudio(aIndex) == EFalse)) |
|
3977 { |
|
3978 iEffectSymbols->SetVolumeMuteIconVisibility(ETrue); |
|
3979 } |
|
3980 else |
|
3981 { |
|
3982 iEffectSymbols->SetVolumeMuteIconVisibility(EFalse); |
|
3983 } |
|
3984 |
|
3985 TTimeIntervalMicroSeconds editedDuration = aMovie.VideoClipEditedDuration( aIndex ); |
|
3986 |
|
3987 iInfoDisplay->SetDuration( editedDuration ); |
|
3988 |
|
3989 DrawTrackBoxes(); |
|
3990 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipTimingsChanged: Out"); |
|
3991 } |
|
3992 |
|
3993 void CVeiEditVideoContainer::NotifyVideoClipColorEffectChanged( |
|
3994 CVedMovie& /*aMovie*/, TInt aIndex ) |
|
3995 { |
|
3996 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipColorEffectChanged: In"); |
|
3997 |
|
3998 if ( iView.WaitMode() != CVeiEditVideoView::EDuplicating ) |
|
3999 TRAP_IGNORE( UpdateThumbnailL( aIndex ) ); |
|
4000 |
|
4001 SetColourToningIcons(aIndex); |
|
4002 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipColorEffectChanged: Out"); |
|
4003 } |
|
4004 |
|
4005 void CVeiEditVideoContainer::NotifyVideoClipAudioSettingsChanged( |
|
4006 CVedMovie& /*aMovie*/, TInt aIndex ) |
|
4007 { |
|
4008 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipAudioSettingsChanged: In"); |
|
4009 /* Check is Mute on */ |
|
4010 if ((iMovie.VideoClipIsMuted(aIndex) != EFalse) || |
|
4011 (iMovie.VideoClipEditedHasAudio(aIndex) == EFalse)) |
|
4012 { |
|
4013 iEffectSymbols->SetVolumeMuteIconVisibility(ETrue); |
|
4014 } |
|
4015 else |
|
4016 { |
|
4017 iEffectSymbols->SetVolumeMuteIconVisibility(EFalse); |
|
4018 } |
|
4019 DrawDeferred(); |
|
4020 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipAudioSettingsChanged: Out"); |
|
4021 } |
|
4022 |
|
4023 void CVeiEditVideoContainer::NotifyStartTransitionEffectChanged( |
|
4024 CVedMovie& aMovie ) |
|
4025 { |
|
4026 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyStartTransitionEffectChanged: In"); |
|
4027 iInfoDisplay->SetName( *iTransitionInfo->StartTransitionName( aMovie.StartTransitionEffect() ) ); |
|
4028 |
|
4029 ShowStartAnimationL( aMovie.StartTransitionEffect() ); |
|
4030 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyStartTransitionEffectChanged: Out"); |
|
4031 } |
|
4032 |
|
4033 void CVeiEditVideoContainer::NotifyMiddleTransitionEffectChanged( |
|
4034 CVedMovie& aMovie, TInt aIndex ) |
|
4035 { |
|
4036 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyMiddleTransitionEffectChanged: In"); |
|
4037 iInfoDisplay->SetName( *iTransitionInfo->MiddleTransitionName( aMovie.MiddleTransitionEffect( aIndex ) ) ); |
|
4038 |
|
4039 ShowMiddleAnimationL( aMovie.MiddleTransitionEffect( aIndex ) ); |
|
4040 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyMiddleTransitionEffectChanged: Out"); |
|
4041 } |
|
4042 |
|
4043 void CVeiEditVideoContainer::NotifyEndTransitionEffectChanged( |
|
4044 CVedMovie& aMovie ) |
|
4045 { |
|
4046 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyEndTransitionEffectChanged: In"); |
|
4047 iInfoDisplay->SetName( *iTransitionInfo->EndTransitionName( aMovie.EndTransitionEffect() ) ); |
|
4048 ShowEndAnimationL( aMovie.EndTransitionEffect() ); |
|
4049 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyEndTransitionEffectChanged: Out"); |
|
4050 } |
|
4051 |
|
4052 void CVeiEditVideoContainer::NotifyAudioClipAdded( |
|
4053 CVedMovie& aMovie, TInt aIndex ) |
|
4054 { |
|
4055 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipAdded: In"); |
|
4056 CStoryboardAudioItem* item; |
|
4057 /* When audio clip is duplicated, check if original was recorded. |
|
4058 TMPXXXXX.XXX name is not shown on main pane if iRecordedAudio is ETrue. |
|
4059 **/ |
|
4060 if ( (aIndex > 0 ) && (iView.WaitMode() == CVeiEditVideoView::EDuplicating )) |
|
4061 { |
|
4062 if ( iAudioItemArray[aIndex-1]->iRecordedAudio == 1 ) |
|
4063 { |
|
4064 iRecordedAudio = ETrue; |
|
4065 } |
|
4066 } |
|
4067 |
|
4068 if (CVeiEditVideoView::EDuplicating == iView.WaitMode()) |
|
4069 { |
|
4070 //copy adjust volume parameter from original clip (aIndex - 1) |
|
4071 TReal adjustVolume = aMovie.GetAudioClipVolumeGainL(aIndex-1); |
|
4072 aMovie.SetAudioClipVolumeGainL(aIndex, (TInt)(adjustVolume)); |
|
4073 } |
|
4074 item = CStoryboardAudioItem::NewLC( iRecordedAudio, |
|
4075 aMovie.AudioClipInfo( aIndex )->FileName() ); |
|
4076 |
|
4077 iAudioCursorPos = aIndex; |
|
4078 |
|
4079 iAudioItemArray.Insert( item, aIndex ); |
|
4080 CleanupStack::Pop( item ); |
|
4081 |
|
4082 iView.SetWaitMode( CVeiEditVideoView::ENotWaiting ); |
|
4083 SetCursorLocation( ECursorOnAudio ); |
|
4084 iRecordedAudio = EFalse; |
|
4085 DrawDeferred(); |
|
4086 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipAdded: Out"); |
|
4087 } |
|
4088 |
|
4089 void CVeiEditVideoContainer::NotifyAudioClipAddingFailed( |
|
4090 CVedMovie& /*aMovie*/, TInt DEBUGLOG_ARG(aError) ) |
|
4091 { |
|
4092 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipAddingFailed: In, aError:%d", aError); |
|
4093 DrawDeferred(); |
|
4094 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipAddingFailed: Out"); |
|
4095 } |
|
4096 |
|
4097 void CVeiEditVideoContainer::NotifyAudioClipRemoved( |
|
4098 CVedMovie& /*aMovie*/, TInt aIndex ) |
|
4099 { |
|
4100 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipRemoved: In"); |
|
4101 CStoryboardAudioItem* item = iAudioItemArray[aIndex]; |
|
4102 iAudioItemArray.Remove(aIndex); |
|
4103 delete item; |
|
4104 SetCursorLocation( ECursorOnAudio ); |
|
4105 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipRemoved: Out"); |
|
4106 } |
|
4107 |
|
4108 void CVeiEditVideoContainer::NotifyAudioClipIndicesChanged( |
|
4109 CVedMovie& /*aMovie*/, TInt aOldIndex, TInt aNewIndex ) |
|
4110 { |
|
4111 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipIndicesChanged: In"); |
|
4112 CStoryboardAudioItem* item = iAudioItemArray[ aOldIndex ]; |
|
4113 iAudioItemArray.Remove( aOldIndex ); |
|
4114 TInt err = iAudioItemArray.Insert( item, aNewIndex ); |
|
4115 if ( err != KErrNone ) |
|
4116 { |
|
4117 TBuf<30>buf; |
|
4118 buf.Format( _L("Audio clip moving failed (%d)."), err ); |
|
4119 } |
|
4120 |
|
4121 iAudioCursorPos = aNewIndex; |
|
4122 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipIndicesChanged: Out"); |
|
4123 } |
|
4124 |
|
4125 void CVeiEditVideoContainer::NotifyAudioClipTimingsChanged( |
|
4126 CVedMovie& /*aMovie*/, TInt /*aIndex*/ ) |
|
4127 { |
|
4128 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipTimingsChanged: In"); |
|
4129 IsAudioClipCutted(); |
|
4130 DrawDeferred(); |
|
4131 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipTimingsChanged: Out"); |
|
4132 } |
|
4133 |
|
4134 void CVeiEditVideoContainer::NotifyMovieReseted( CVedMovie& /*aMovie*/ ) |
|
4135 { |
|
4136 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyMovieReseted: In"); |
|
4137 iAudioItemArray.ResetAndDestroy(); |
|
4138 iVideoItemArray.ResetAndDestroy(); |
|
4139 iVideoCursorPos = 0; |
|
4140 iAudioCursorPos = 0; |
|
4141 iCursorLocation = ECursorOnClip; |
|
4142 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyMovieReseted: Out"); |
|
4143 } |
|
4144 |
|
4145 void CVeiEditVideoContainer::NotifyMovieOutputParametersChanged(CVedMovie& /*aMovie*/) |
|
4146 { |
|
4147 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyMovieOutputParametersChanged: In and Out"); |
|
4148 // @ |
|
4149 } |
|
4150 |
|
4151 void CVeiEditVideoContainer::NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/, |
|
4152 TInt /*aClipIndex*/, |
|
4153 TInt /*aMarkIndex*/) |
|
4154 { |
|
4155 // @ |
|
4156 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipDynamicLevelMarkInserted: In and out"); |
|
4157 } |
|
4158 |
|
4159 void CVeiEditVideoContainer::NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, |
|
4160 TInt /*aClipIndex*/, |
|
4161 TInt /*aMarkIndex*/) |
|
4162 { |
|
4163 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipDynamicLevelMarkRemoved: In and out"); |
|
4164 // @ |
|
4165 } |
|
4166 |
|
4167 void CVeiEditVideoContainer::NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/, |
|
4168 TInt /*aClipIndex*/, |
|
4169 TInt /*aMarkIndex*/) |
|
4170 { |
|
4171 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipDynamicLevelMarkInserted: In and out"); |
|
4172 // @ |
|
4173 } |
|
4174 |
|
4175 void CVeiEditVideoContainer::NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, |
|
4176 TInt /*aClipIndex*/, |
|
4177 TInt /*aMarkIndex*/) |
|
4178 { |
|
4179 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipDynamicLevelMarkRemoved: In and out"); |
|
4180 // @ |
|
4181 } |
|
4182 |
|
4183 void CVeiEditVideoContainer::UpdateThumbnailL( TInt aIndex ) |
|
4184 { |
|
4185 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::UpdateThumbnailL: In"); |
|
4186 /*HBufC* stringholder; |
|
4187 |
|
4188 if (iProgressNote) |
|
4189 { |
|
4190 delete iProgressNote; |
|
4191 iProgressNote = NULL; |
|
4192 } |
|
4193 |
|
4194 iProgressNote = |
|
4195 new (ELeave) CAknProgressDialog(REINTERPRET_CAST(CEikDialog**, |
|
4196 &iProgressNote), ETrue); |
|
4197 iProgressNote->SetCallback(this); |
|
4198 |
|
4199 if( iView.WaitMode() == CVeiEditVideoView::EProcessingMovieForCutting ) |
|
4200 { |
|
4201 stringholder = StringLoader::LoadLC( R_VEI_PROGRESS_NOTE_CUTTING_VIDEO, iEikonEnv ); |
|
4202 } |
|
4203 else |
|
4204 { |
|
4205 stringholder = StringLoader::LoadLC( R_VEI_PROGRESS_NOTE_COLOR_EFFECT, iEikonEnv ); |
|
4206 } |
|
4207 |
|
4208 iProgressNote->ExecuteDlgLD( R_VEI_PROGRESS_NOTE ); |
|
4209 iProgressNote->SetTextL( *stringholder ); |
|
4210 CleanupStack::PopAndDestroy( stringholder ); |
|
4211 |
|
4212 iProgressNote->GetProgressInfoL()->SetFinalValue(100); |
|
4213 */ |
|
4214 TInt resid; |
|
4215 if( iView.WaitMode() == CVeiEditVideoView::EProcessingMovieForCutting ) |
|
4216 { |
|
4217 resid = R_VEI_PROGRESS_NOTE_CUTTING_VIDEO; |
|
4218 } |
|
4219 else |
|
4220 { |
|
4221 resid = R_VEI_PROGRESS_NOTE_COLOR_EFFECT; |
|
4222 } |
|
4223 StartProgressDialogL(R_VEI_PROGRESS_NOTE, resid); |
|
4224 |
|
4225 iCurrentlyProcessedIndex = iVideoCursorPos; |
|
4226 |
|
4227 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::UpdateThumbnailL: 2"); |
|
4228 StartFrameTakerL( aIndex ); |
|
4229 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::UpdateThumbnailL: Out"); |
|
4230 } |
|
4231 |
|
4232 // --------------------------------------------------------- |
|
4233 // CVeiEditVideoContainer::ConvertBW(CFbsBitmap& aBitmap) |
|
4234 // --------------------------------------------------------- |
|
4235 // |
|
4236 void CVeiEditVideoContainer::ConvertBW( CFbsBitmap& aBitmap ) const |
|
4237 { |
|
4238 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConvertBW: In"); |
|
4239 TInt width = aBitmap.SizeInPixels().iWidth; |
|
4240 TInt height = aBitmap.SizeInPixels().iHeight; |
|
4241 |
|
4242 TBitmapUtil bitmapUtil( &aBitmap ); |
|
4243 bitmapUtil.Begin( TPoint(0,0) ); |
|
4244 |
|
4245 for ( TInt y=0;y<height;y++ ) |
|
4246 { |
|
4247 for ( TInt x=0;x<width;x++ ) |
|
4248 { |
|
4249 bitmapUtil.SetPos( TPoint( x,y ) ); |
|
4250 |
|
4251 TUint32 colorr = ( bitmapUtil.GetPixel() ); |
|
4252 |
|
4253 TRgb vari = TRgb::Color64K( colorr ); |
|
4254 |
|
4255 TInt red = vari.Red(); |
|
4256 TInt green = vari.Green(); |
|
4257 TInt blue = vari.Blue(); |
|
4258 |
|
4259 TUint Yy = STATIC_CAST( TUint, red*0.299 + green*0.587 + blue*0.114 ); |
|
4260 |
|
4261 bitmapUtil.SetPixel( TRgb(Yy,Yy,Yy).Color64K() ); |
|
4262 } |
|
4263 } |
|
4264 bitmapUtil.End(); |
|
4265 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConvertBW: Out"); |
|
4266 } |
|
4267 |
|
4268 // --------------------------------------------------------- |
|
4269 // CVeiEditVideoContainer::ConvertToning(CFbsBitmap& aBitmap) |
|
4270 // --------------------------------------------------------- |
|
4271 // |
|
4272 void CVeiEditVideoContainer::ConvertToning( CFbsBitmap& aBitmap ) const |
|
4273 { |
|
4274 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConvertToning: In"); |
|
4275 // TInt ind = CurrentIndex(); |
|
4276 TRgb toning = iMovie.VideoClipColorTone(CurrentIndex()); |
|
4277 |
|
4278 TInt width = aBitmap.SizeInPixels().iWidth; |
|
4279 TInt height = aBitmap.SizeInPixels().iHeight; |
|
4280 |
|
4281 TBitmapUtil bitmapUtil( &aBitmap ); |
|
4282 bitmapUtil.Begin( TPoint(0,0) ); |
|
4283 |
|
4284 TInt R_ct = toning.Red(); |
|
4285 TInt G_ct = toning.Green(); |
|
4286 TInt B_ct = toning.Blue(); |
|
4287 |
|
4288 /* |
|
4289 //vihreä |
|
4290 TInt R_ct = 185; |
|
4291 TInt G_ct = 255; |
|
4292 TInt B_ct = 0; |
|
4293 */ |
|
4294 |
|
4295 TInt kr = 45808*R_ct - 38446*G_ct - 7362*B_ct + 32768; |
|
4296 TInt kg = - 19496*R_ct + 26952*G_ct - 3750*B_ct + 32768; |
|
4297 TInt kb = - 19608*R_ct - 38184*G_ct + 57792*B_ct + 32768; |
|
4298 |
|
4299 for ( TInt y=0;y<height;y++ ) |
|
4300 { |
|
4301 for ( TInt x=0;x<width;x++ ) |
|
4302 { |
|
4303 bitmapUtil.SetPos( TPoint( x,y ) ); |
|
4304 |
|
4305 TUint32 colorr = ( bitmapUtil.GetPixel() ); |
|
4306 TRgb vari = TRgb::Color64K( colorr ); |
|
4307 |
|
4308 TInt alpha = 19668*vari.Red() + 38442*vari.Green() + 7450*vari.Blue(); |
|
4309 TInt R_out = (alpha + kr)>>16; |
|
4310 TInt G_out = (alpha + kg)>>16; |
|
4311 TInt B_out = (alpha + kb)>>16; |
|
4312 |
|
4313 if(R_out<0) R_out=0; if(R_out>255) R_out=255; |
|
4314 if(G_out<0) G_out=0; if(G_out>255) G_out=255; |
|
4315 if(B_out<0) B_out=0; if(B_out>255) B_out=255; |
|
4316 |
|
4317 bitmapUtil.SetPixel( TRgb(R_out,G_out,B_out).Color64K() ); |
|
4318 } |
|
4319 } |
|
4320 bitmapUtil.End(); |
|
4321 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConvertToning: Out"); |
|
4322 } |
|
4323 |
|
4324 |
|
4325 // --------------------------------------------------------- |
|
4326 // CVeiEditVideoContainer::HandleControlEventL( |
|
4327 // CCoeControl* aControl,TCoeEvent aEventType) |
|
4328 // --------------------------------------------------------- |
|
4329 // |
|
4330 void CVeiEditVideoContainer::HandleControlEventL( |
|
4331 CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) |
|
4332 { |
|
4333 // : Add your control event handler code here |
|
4334 } |
|
4335 |
|
4336 // ---------------------------------------------------------------------------- |
|
4337 // CVeiEditVideoContainer::HandlePointerEventL |
|
4338 // From CCoeControl |
|
4339 // ---------------------------------------------------------------------------- |
|
4340 // |
|
4341 void CVeiEditVideoContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
4342 { |
|
4343 LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::HandlePointerEventL(): In" ); |
|
4344 |
|
4345 if( AknLayoutUtils::PenEnabled() ) |
|
4346 { |
|
4347 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
4348 |
|
4349 switch( aPointerEvent.iType ) |
|
4350 { |
|
4351 case TPointerEvent::EButton1Down: |
|
4352 { |
|
4353 LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::HandlePointerEventL(): EButton1Down" ); |
|
4354 |
|
4355 // Initialise the touch related member variables |
|
4356 iIsVideoDrag = EFalse; |
|
4357 iIsVideoTapped = EFalse; |
|
4358 |
|
4359 // the user taps the timeline bar |
|
4360 if( iVideoBarBox.Contains( aPointerEvent.iPosition ) ) |
|
4361 { |
|
4362 iCursorLocation = ECursorOnClip; |
|
4363 HandleVideoTimelineTouchL( aPointerEvent ); |
|
4364 } |
|
4365 // the user double-taps the cut bar |
|
4366 else if (( iDummyCutBar->Rect().Contains( aPointerEvent.iPosition )) && |
|
4367 ( aPointerEvent.iModifiers & EModifierDoubleClick )) |
|
4368 { |
|
4369 // open cut view |
|
4370 iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoCutting ); |
|
4371 } |
|
4372 // : the user double taps the thumbnail (wait for the layout data) |
|
4373 // : the user taps the transition arrows (wait for the layout data) |
|
4374 |
|
4375 // the volume adjustment view is active and the user taps the volume slider |
|
4376 else if (( EModeAdjustVolume == iSelectionMode ) && |
|
4377 ( iVerticalSlider->Rect().Contains( aPointerEvent.iPosition ))) |
|
4378 { |
|
4379 HandleVolumeSliderTouchL( aPointerEvent ); |
|
4380 } |
|
4381 break; |
|
4382 } |
|
4383 case TPointerEvent::EDrag: |
|
4384 { |
|
4385 LOGFMT( KVideoEditorLogFile, "CVeiEditVideoContainer::HandlePointerEventL(): \ |
|
4386 EDrag, iIsVideoTapped = %d", iIsVideoTapped ); |
|
4387 |
|
4388 // video drag takes effect only when the pointer has gone down inside a |
|
4389 // video clip (i.e. iIsVideoTapped == ETrue) |
|
4390 if ( iVideoBarBox.Contains( aPointerEvent.iPosition ) && ( iIsVideoTapped )) |
|
4391 { |
|
4392 iIsVideoDrag = ETrue; |
|
4393 HandleVideoTimelineTouchL( aPointerEvent ); |
|
4394 } |
|
4395 // the volume adjustment view is active and the user taps the volume slider |
|
4396 else if (( EModeAdjustVolume == iSelectionMode ) && |
|
4397 ( iVerticalSlider->Rect().Contains( aPointerEvent.iPosition ))) |
|
4398 { |
|
4399 HandleVolumeSliderTouchL( aPointerEvent ); |
|
4400 } |
|
4401 break; |
|
4402 } |
|
4403 case TPointerEvent::EButton1Up: |
|
4404 { |
|
4405 // pen up event is handled if it was dragged |
|
4406 if (iIsVideoDrag) |
|
4407 { |
|
4408 iIsVideoDrag = EFalse; |
|
4409 // pressed position is inside the timeline bar |
|
4410 if( iVideoBarBox.Contains( aPointerEvent.iPosition ) ) |
|
4411 { |
|
4412 HandleVideoTimelineTouchL( aPointerEvent ); |
|
4413 } |
|
4414 else |
|
4415 { |
|
4416 // the new position indicator has to be removed from the UI |
|
4417 iNewClipPosition = iClickedClip; |
|
4418 DrawNow(); |
|
4419 } |
|
4420 } |
|
4421 |
|
4422 break; |
|
4423 } |
|
4424 default: |
|
4425 { |
|
4426 break; |
|
4427 } |
|
4428 } |
|
4429 } |
|
4430 LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::HandlePointerEventL(): Out" ); |
|
4431 } |
|
4432 |
|
4433 |
|
4434 // ---------------------------------------------------------------------------- |
|
4435 // CVeiEditVideoContainer::HandleVideoTimelineTouchL |
|
4436 // |
|
4437 // ---------------------------------------------------------------------------- |
|
4438 // |
|
4439 void CVeiEditVideoContainer::HandleVideoTimelineTouchL( TPointerEvent aPointerEvent ) |
|
4440 { |
|
4441 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVideoTimelineTouchL(): In" ); |
|
4442 |
|
4443 CVeiEditVideoView::TEditorState state = iView.EditorState(); |
|
4444 |
|
4445 if (( AknLayoutUtils::PenEnabled() ) && |
|
4446 ( state!=CVeiEditVideoView::EPreview ) && |
|
4447 ( state!=CVeiEditVideoView::EQuickPreview )) |
|
4448 { |
|
4449 |
|
4450 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVideoTimelineTouchL, \ |
|
4451 iClickedClip:%d", iClickedClip ); |
|
4452 |
|
4453 // move video clip by dragging |
|
4454 if ( aPointerEvent.iType == TPointerEvent::EDrag ) |
|
4455 { |
|
4456 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVideoTimelineTouchL, EDrag, \ |
|
4457 aPointerEvent.iPosition.iX = %d", aPointerEvent.iPosition.iX ); |
|
4458 |
|
4459 // Find the clip that includes the current pointer position. |
|
4460 TInt clipIncludingDrag = FindClickedClip( aPointerEvent.iPosition.iX ); |
|
4461 |
|
4462 // the pen is inside the same clip where it went down |
|
4463 if (( clipIncludingDrag == iClickedClip )) |
|
4464 { |
|
4465 // the new position indicator has to be removed from UI |
|
4466 iNewClipPosition = iClickedClip; |
|
4467 } |
|
4468 |
|
4469 // the pen is on the empty part of the timeline |
|
4470 else if ( aPointerEvent.iPosition.iX > iEmptyVideoTimeLineRect.iTl.iX ) |
|
4471 { |
|
4472 // the last clip can't be moved right |
|
4473 if ( iClickedClip < iMovie.VideoClipCount() - 1 ) |
|
4474 { |
|
4475 iNewClipPosition = iMovie.VideoClipCount() - 1; |
|
4476 } |
|
4477 } |
|
4478 // the pen is on the left end of a video clip |
|
4479 else if (( clipIncludingDrag >= 0) && |
|
4480 ( iVideoItemRectArray[ clipIncludingDrag ].Contains( TPoint( aPointerEvent.iPosition.iX, iVideoBarBox.Center().iY ))) && |
|
4481 ( aPointerEvent.iPosition.iX <= iVideoItemRectArray[ clipIncludingDrag ].iTl.iX + iVideoItemRectArray[ clipIncludingDrag ].Width()/2 )) |
|
4482 { |
|
4483 // moving a clip from left to right |
|
4484 if (( iClickedClip < clipIncludingDrag ) && ( iClickedClip < clipIncludingDrag - 1 )) |
|
4485 { |
|
4486 iNewClipPosition = clipIncludingDrag - 1; |
|
4487 } |
|
4488 // moving a clip from right to left |
|
4489 else if ( iClickedClip > clipIncludingDrag ) |
|
4490 { |
|
4491 iNewClipPosition = clipIncludingDrag; |
|
4492 } |
|
4493 else |
|
4494 { |
|
4495 iNewClipPosition = iClickedClip; |
|
4496 } |
|
4497 } |
|
4498 // the pen is on the right end of a video clip |
|
4499 else if (( clipIncludingDrag >= 0) && |
|
4500 ( iVideoItemRectArray[ clipIncludingDrag ].Contains( TPoint( aPointerEvent.iPosition.iX, iVideoBarBox.Center().iY ))) && |
|
4501 ( aPointerEvent.iPosition.iX > iVideoItemRectArray[ clipIncludingDrag ].iTl.iX + iVideoItemRectArray[ clipIncludingDrag ].Width()/2 )) |
|
4502 { |
|
4503 // moving a clip from left to right |
|
4504 if (( iClickedClip < clipIncludingDrag )) |
|
4505 { |
|
4506 iNewClipPosition = clipIncludingDrag; |
|
4507 } |
|
4508 // moving a clip from right to left |
|
4509 else if ( iClickedClip > clipIncludingDrag + 1) |
|
4510 { |
|
4511 iNewClipPosition = clipIncludingDrag + 1; |
|
4512 } |
|
4513 else |
|
4514 { |
|
4515 iNewClipPosition = iClickedClip; |
|
4516 } |
|
4517 } |
|
4518 } |
|
4519 |
|
4520 // pen up event after dragging |
|
4521 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
4522 { |
|
4523 iMovie.VideoClipSetIndex( iClickedClip, iNewClipPosition ); |
|
4524 if ( iVideoCursorPos != iNewClipPosition ) // eliminates blinking of the already selected clip |
|
4525 { |
|
4526 iVideoCursorPos = iNewClipPosition; |
|
4527 SetCursorLocation( ECursorOnClip ); |
|
4528 } |
|
4529 |
|
4530 } |
|
4531 // user taps a clip |
|
4532 else if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
4533 { |
|
4534 CalculateVideoClipRects(); |
|
4535 |
|
4536 iClickedClip = FindClickedClip( aPointerEvent.iPosition.iX ); |
|
4537 iNewClipPosition = iClickedClip; |
|
4538 |
|
4539 if ( iClickedClip >= 0 ) |
|
4540 { |
|
4541 iIsVideoTapped = ETrue; |
|
4542 if ( iClickedClip != iVideoCursorPos ) // eliminates blinking of the already selected clip |
|
4543 { |
|
4544 iVideoCursorPos = iClickedClip; |
|
4545 SetCursorLocation( ECursorOnClip ); |
|
4546 } |
|
4547 } |
|
4548 } |
|
4549 |
|
4550 // : when the user clicks a transition marker, the transition view should open |
|
4551 |
|
4552 DrawNow(); |
|
4553 LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVideoTimelineTouchL(): Out" ); |
|
4554 |
|
4555 }// PenEnabled |
|
4556 |
|
4557 } |
|
4558 |
|
4559 |
|
4560 // ---------------------------------------------------------------------------- |
|
4561 // CVeiEditVideoContainer::HandleVolumeSliderTouchL |
|
4562 // |
|
4563 // ---------------------------------------------------------------------------- |
|
4564 // |
|
4565 void CVeiEditVideoContainer::HandleVolumeSliderTouchL( TPointerEvent aPointerEvent ) |
|
4566 { |
|
4567 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVolumeSliderTouchL in"); |
|
4568 |
|
4569 // calculate the new slider position |
|
4570 TInt newSliderPosition; |
|
4571 TInt volumeSliderSteps = KVolumeSliderMax - KVolumeSliderMin + 1; |
|
4572 TInt pointerPosInSlider = aPointerEvent.iPosition.iY - iVerticalSlider->Rect().iTl.iY; |
|
4573 newSliderPosition = (( volumeSliderSteps * pointerPosInSlider ) / iVerticalSlider->Rect().Height()) + KVolumeSliderMin; |
|
4574 |
|
4575 iVerticalSlider->SetPosition( newSliderPosition); |
|
4576 iVerticalSlider->DrawNow(); |
|
4577 |
|
4578 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVolumeSliderTouchL out"); |
|
4579 } |
|
4580 |
|
4581 |
|
4582 // ---------------------------------------------------------------------------- |
|
4583 // CVeiEditVideoContainer::ClipContainingClick |
|
4584 // |
|
4585 // ---------------------------------------------------------------------------- |
|
4586 // |
|
4587 TInt CVeiEditVideoContainer::FindClickedClip( TInt aPressedPointX ) |
|
4588 { |
|
4589 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::FindClickedClip in"); |
|
4590 // Video Timeline start and end points, and length |
|
4591 TInt timelineLeftEnd( iVideoBarBox.iTl.iX ); |
|
4592 TInt timelineRightEnd( iVideoBarBox.iBr.iX ); |
|
4593 TInt totalPBLength( timelineRightEnd - timelineLeftEnd ); |
|
4594 |
|
4595 // check which part of the timeline contains the click |
|
4596 TInt clickedClip = -1; |
|
4597 TInt i = 0; |
|
4598 while (( clickedClip < 0) && ( i < iMovie.VideoClipCount() )) |
|
4599 { |
|
4600 if ( ( aPressedPointX > iVideoItemRectArray[i].iTl.iX ) && |
|
4601 ( aPressedPointX < iVideoItemRectArray[i].iBr.iX )) |
|
4602 { |
|
4603 clickedClip = i; |
|
4604 } |
|
4605 else |
|
4606 { |
|
4607 i++; |
|
4608 } |
|
4609 } |
|
4610 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::FindClickedClip out"); |
|
4611 return clickedClip; |
|
4612 } |
|
4613 |
|
4614 |
|
4615 |
|
4616 void CVeiEditVideoContainer::SetCursorLocation( TCursorLocation aCursorLocation ) |
|
4617 { |
|
4618 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::SetCursorLocation in"); |
|
4619 |
|
4620 iCursorLocation = aCursorLocation; |
|
4621 |
|
4622 if ( iView.EditorState() == CVeiEditVideoView::EMixAudio) |
|
4623 { |
|
4624 iVideoDisplay->MakeVisible( ETrue ); |
|
4625 iVideoDisplay->SetRect( iVideoDisplayBox ); |
|
4626 iVideoDisplay->ShowPictureL(*iAudioMixingIcon); |
|
4627 iInfoDisplay->MakeVisible(EFalse); |
|
4628 iHorizontalSlider->MakeVisible(ETrue); |
|
4629 return; |
|
4630 } |
|
4631 |
|
4632 iTransitionDisplayLeft->MakeVisible( EFalse ); |
|
4633 iTransitionDisplayRight->MakeVisible( EFalse ); |
|
4634 iDummyCutBarLeft->MakeVisible( EFalse ); |
|
4635 iInfoDisplay->SetRect( iInfoDisplayBox ); |
|
4636 iEffectSymbols->MakeVisible( EFalse ); |
|
4637 if (CVeiEditVideoContainer::EModeSlowMotion != iSelectionMode) |
|
4638 { |
|
4639 // currently slow motion wastes processing time in background |
|
4640 iVideoDisplay->StopAnimation(); |
|
4641 } |
|
4642 |
|
4643 if ( iCursorLocation == ECursorOnClip && iInfoDisplay ) |
|
4644 { |
|
4645 iVideoDisplay->MakeVisible( ETrue ); |
|
4646 iVideoDisplay->SetRect( iVideoDisplayBox ); |
|
4647 |
|
4648 if ( iMovie.VideoClipCount() > 0 ) |
|
4649 { |
|
4650 if ( (iVideoCursorPos > (iMovie.VideoClipCount()-1))) |
|
4651 { |
|
4652 iVideoCursorPos--; |
|
4653 } |
|
4654 |
|
4655 TParse parser; |
|
4656 |
|
4657 parser.Set( iVideoItemArray[ CurrentIndex() ]->iFilename->Des(), NULL, NULL ); |
|
4658 iVideoDisplay->ShowPictureL( *iVideoItemArray[CurrentIndex()]->iIconBitmap, |
|
4659 *iVideoItemArray[CurrentIndex()]->iIconMask ); |
|
4660 |
|
4661 iDummyCutBar->SetRect( iDummyCutBarBox ); |
|
4662 iDummyCutBar->Dim( EFalse ); |
|
4663 |
|
4664 // : start using LAF data when it is available |
|
4665 // iDummyCutBar->Rect() == (80, 160, 273, 204) includes the scissor icon and the progress bar |
|
4666 iDummyCutBar->SetComponentRect( CVeiCutterBar::EProgressBar, TRect(115, 160,273,204)); |
|
4667 iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, TRect(115, 160,135,204) ); |
|
4668 iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderMiddleIcon, TRect(135,160,244,204) ); |
|
4669 iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon,TRect(244,160,273,204) ); |
|
4670 iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderSelectedLeftEndIcon, TRect(115, 160,135,204) ); |
|
4671 iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderSelectedMiddleIcon, TRect(135,160,244,204) ); |
|
4672 iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderSelectedRightEndIcon,TRect(244,160,273,204) ); |
|
4673 iDummyCutBar->SetComponentRect( CVeiCutterBar::EScissorsIcon, TRect(80, 167,110,197) ); |
|
4674 iDummyCutBar->SetComponentRect( CVeiCutterBar::ECutAreaBorderIcon,TRect(115,160,124,204) ); |
|
4675 |
|
4676 TTimeIntervalMicroSeconds clipDuration = iMovie.VideoClipInfo( CurrentIndex())->Duration(); |
|
4677 TTimeIntervalMicroSeconds clipCutInTime = iMovie.VideoClipCutInTime( CurrentIndex() ); |
|
4678 TTimeIntervalMicroSeconds clipCutOutTime = iMovie.VideoClipCutOutTime( CurrentIndex() ); |
|
4679 |
|
4680 iDummyCutBar->SetTotalDuration( clipDuration ); |
|
4681 iDummyCutBar->SetInPoint( clipCutInTime ); |
|
4682 iDummyCutBar->SetOutPoint( clipCutOutTime ); |
|
4683 |
|
4684 TTime fileModified; |
|
4685 |
|
4686 RFs& fs = iEikonEnv->FsSession(); |
|
4687 if ( parser.ExtPresent() ) |
|
4688 { |
|
4689 fs.Modified( *iVideoItemArray[CurrentIndex()]->iFilename, fileModified ); |
|
4690 } |
|
4691 else |
|
4692 { |
|
4693 fileModified = iVideoItemArray[CurrentIndex()]->iDateModified; |
|
4694 } |
|
4695 |
|
4696 if ( VideoEditorUtils::IsLandscapeScreenOrientation() ) //Landscape |
|
4697 { |
|
4698 iInfoDisplay->SetLayout( CVeiTextDisplay::EEverything ); |
|
4699 } |
|
4700 else |
|
4701 { |
|
4702 iInfoDisplay->SetLayout( CVeiTextDisplay::ENameAndDuration ); |
|
4703 } |
|
4704 |
|
4705 iInfoDisplay->SetLocation( *iVideoItemArray[CurrentIndex()]->iAlbumName ); |
|
4706 |
|
4707 TFileName clipName = parser.Name(); |
|
4708 TTimeIntervalMicroSeconds editedDuration = iMovie.VideoClipEditedDuration( CurrentIndex() ); |
|
4709 iInfoDisplay->MakeVisible( ETrue ); |
|
4710 |
|
4711 if( !CurrentClipIsFile() ) |
|
4712 { |
|
4713 TFileName fileName; |
|
4714 fileName = iMovie.VideoClipInfo( CurrentIndex() )->DescriptiveName(); |
|
4715 iInfoDisplay->SetName(fileName); |
|
4716 } |
|
4717 else |
|
4718 { |
|
4719 iInfoDisplay->SetName( clipName ); |
|
4720 } |
|
4721 |
|
4722 iInfoDisplay->SetDuration( editedDuration ); |
|
4723 iInfoDisplay->SetTime( fileModified ); |
|
4724 |
|
4725 // *** IconBox drawing **** |
|
4726 // indicator icons are hidden in preview state |
|
4727 CVeiEditVideoView::TEditorState state = iView.EditorState(); |
|
4728 if (state != CVeiEditVideoView::EPreview && state != CVeiEditVideoView::EQuickPreview) |
|
4729 { |
|
4730 if ((iMovie.VideoClipIsMuted(iVideoCursorPos) != EFalse) || |
|
4731 (iMovie.VideoClipEditedHasAudio(iVideoCursorPos) == EFalse)) |
|
4732 { |
|
4733 iEffectSymbols->SetVolumeMuteIconVisibility(ETrue); |
|
4734 } |
|
4735 else |
|
4736 { |
|
4737 iEffectSymbols->SetVolumeMuteIconVisibility(EFalse); |
|
4738 } |
|
4739 |
|
4740 if ( iMovie.VideoClipSpeed( iVideoCursorPos ) != 1000 ) |
|
4741 { |
|
4742 iEffectSymbols->SetSlowMotionIconVisibility(ETrue); |
|
4743 } |
|
4744 else |
|
4745 { |
|
4746 iEffectSymbols->SetSlowMotionIconVisibility(EFalse); |
|
4747 } |
|
4748 |
|
4749 SetColourToningIcons(iVideoCursorPos); |
|
4750 |
|
4751 iEffectSymbols->MakeVisible( ETrue ); |
|
4752 iEffectSymbols->SetRect( iEffectSymbolBox ); |
|
4753 } |
|
4754 } |
|
4755 else |
|
4756 { |
|
4757 iInfoDisplay->SetLayout( CVeiTextDisplay::EOnlyName ); |
|
4758 iVideoDisplay->ShowBlankScreen(); |
|
4759 |
|
4760 iDummyCutBar->Dim( ETrue ); |
|
4761 HBufC* stringholder = StringLoader::LoadLC( R_VEI_EDIT_VIEW_NO_VIDEO, iEikonEnv ); |
|
4762 iInfoDisplay->SetName( *stringholder ); |
|
4763 CleanupStack::PopAndDestroy( stringholder ); |
|
4764 } |
|
4765 StartZooming(); |
|
4766 } |
|
4767 else if ( iCursorLocation == ECursorOnEmptyVideoTrack ) |
|
4768 { |
|
4769 iVideoDisplay->MakeVisible( ETrue ); |
|
4770 iVideoDisplay->SetRect( iVideoDisplayBox ); |
|
4771 iDummyCutBar->SetRect( iDummyCutBarBox ); |
|
4772 iDummyCutBar->Dim( ETrue ); |
|
4773 iDummyCutBar->MakeVisible( EFalse); |
|
4774 |
|
4775 iInfoDisplay->SetLayout( CVeiTextDisplay::EOnlyName ); |
|
4776 iVideoDisplay->ShowBlankScreen(); |
|
4777 iInfoDisplay->MakeVisible( ETrue ); |
|
4778 |
|
4779 HBufC* stringholder = StringLoader::LoadLC( R_VEI_EDIT_VIEW_NO_VIDEO, iEikonEnv ); |
|
4780 iInfoDisplay->SetName( *stringholder ); |
|
4781 CleanupStack::PopAndDestroy( stringholder ); |
|
4782 } |
|
4783 else if (( iCursorLocation == ECursorOnAudio ) && |
|
4784 (( iSelectionMode == EModeRecordingSetStart ) || |
|
4785 ( iSelectionMode == EModeRecording ))) |
|
4786 { |
|
4787 HBufC* stringholder = StringLoader::LoadLC( R_VEI_EDIT_VIEW_NEW_AUDIO, iEikonEnv ); |
|
4788 |
|
4789 iVideoDisplay->MakeVisible( ETrue ); |
|
4790 iInfoDisplay->MakeVisible( ETrue ); |
|
4791 iInfoDisplay->SetName( *stringholder ); |
|
4792 iVideoDisplay->ShowPictureL( *iAudioIcon ); |
|
4793 |
|
4794 iEffectSymbols->SetVolumeMuteIconVisibility( EFalse ); |
|
4795 iEffectSymbols->SetBlackAndWhiteIconVisibility( EFalse ); |
|
4796 iEffectSymbols->SetColourIconVisibility( EFalse ); |
|
4797 iEffectSymbols->SetSlowMotionIconVisibility( EFalse ); |
|
4798 |
|
4799 iVideoDisplay->SetRect( iVideoDisplayBox ); |
|
4800 iDummyCutBar->SetRect( iDummyCutBarBox ); |
|
4801 |
|
4802 if ( iSelectionMode == EModeRecordingSetStart ) |
|
4803 { |
|
4804 TTimeIntervalMicroSeconds duration = TTimeIntervalMicroSeconds(0); |
|
4805 iInfoDisplay->SetDuration( duration ); |
|
4806 } |
|
4807 else |
|
4808 { |
|
4809 iInfoDisplay->SetDuration( iRecordedAudioDuration ); |
|
4810 } |
|
4811 CleanupStack::PopAndDestroy( stringholder ); |
|
4812 } |
|
4813 else if ( iCursorLocation == ECursorOnAudio ) |
|
4814 { |
|
4815 |
|
4816 iVideoDisplay->MakeVisible( ETrue ); |
|
4817 iEffectSymbols->SetVolumeMuteIconVisibility( EFalse ); |
|
4818 iEffectSymbols->SetBlackAndWhiteIconVisibility( EFalse ); |
|
4819 iEffectSymbols->SetColourIconVisibility( EFalse ); |
|
4820 iEffectSymbols->SetSlowMotionIconVisibility( EFalse ); |
|
4821 |
|
4822 iVideoDisplay->SetRect( iVideoDisplayBox ); |
|
4823 iDummyCutBar->SetRect( iDummyCutBarBox ); |
|
4824 |
|
4825 if ( iMovie.AudioClipCount() > 0 ) |
|
4826 { |
|
4827 |
|
4828 CVedAudioClipInfo* audioclipinfo = iMovie.AudioClipInfo( CurrentIndex() ); |
|
4829 |
|
4830 TTimeIntervalMicroSeconds audioClipEditedDuration = iMovie.AudioClipEditedDuration( CurrentIndex() ); |
|
4831 TTimeIntervalMicroSeconds audioClipDuration = audioclipinfo->Duration(); |
|
4832 TTimeIntervalMicroSeconds audioClipCutInTime = iMovie.AudioClipCutInTime( CurrentIndex() ); |
|
4833 TTimeIntervalMicroSeconds audioClipCutOutTime = iMovie.AudioClipCutOutTime( CurrentIndex() ); |
|
4834 |
|
4835 iDummyCutBar->Dim( EFalse ); |
|
4836 |
|
4837 iDummyCutBar->SetTotalDuration( audioClipDuration ); |
|
4838 iDummyCutBar->SetInPoint( audioClipCutInTime ); |
|
4839 iDummyCutBar->SetOutPoint( audioClipCutOutTime ); |
|
4840 |
|
4841 TParse parser; |
|
4842 parser.Set( *iAudioItemArray[CurrentIndex()]->iFilename, NULL, NULL ); |
|
4843 iVideoDisplay->ShowPictureL( *iAudioIcon ); |
|
4844 |
|
4845 TTime fileModified; |
|
4846 |
|
4847 RFs& fs = iEikonEnv->FsSession(); |
|
4848 fs.Modified( parser.FullName(), fileModified ); |
|
4849 |
|
4850 if ( VideoEditorUtils::IsLandscapeScreenOrientation() ) //Landscape |
|
4851 { |
|
4852 iInfoDisplay->SetLayout( CVeiTextDisplay::EEverything ); |
|
4853 } |
|
4854 else |
|
4855 { |
|
4856 iInfoDisplay->SetLayout( CVeiTextDisplay::ENameAndDuration ); |
|
4857 } |
|
4858 TFileName audioClipName; |
|
4859 |
|
4860 if ( iAudioItemArray[CurrentIndex()]->iRecordedAudio ) |
|
4861 { |
|
4862 HBufC* stringholder = StringLoader::LoadLC( R_VEI_EDIT_VIEW_NEW_AUDIO, iEikonEnv ); |
|
4863 audioClipName = *stringholder; |
|
4864 CleanupStack::PopAndDestroy( stringholder ); |
|
4865 } |
|
4866 else |
|
4867 { |
|
4868 audioClipName = parser.Name(); |
|
4869 } |
|
4870 |
|
4871 iInfoDisplay->MakeVisible( ETrue ); |
|
4872 iInfoDisplay->SetName( audioClipName ); |
|
4873 iInfoDisplay->SetDuration( audioClipEditedDuration ); |
|
4874 iInfoDisplay->SetTime( fileModified ); |
|
4875 } |
|
4876 else |
|
4877 { |
|
4878 iVideoDisplay->MakeVisible( ETrue ); |
|
4879 iInfoDisplay->SetLayout( CVeiTextDisplay::EOnlyName ); |
|
4880 iVideoDisplay->ShowBlankScreen(); |
|
4881 iDummyCutBar->Dim( ETrue ); |
|
4882 iInfoDisplay->MakeVisible( ETrue ); |
|
4883 HBufC* stringholder = StringLoader::LoadLC( R_VEI_EDIT_VIEW_NO_AUDIO, iEikonEnv ); |
|
4884 iInfoDisplay->SetName( *stringholder ); |
|
4885 CleanupStack::PopAndDestroy( stringholder ); |
|
4886 } |
|
4887 StartZooming(); |
|
4888 } |
|
4889 else if ( iCursorLocation == ECursorOnTransition ) |
|
4890 { |
|
4891 iVideoDisplay->MakeVisible( ETrue ); |
|
4892 iTransitionDisplayLeft->MakeVisible( ETrue ); |
|
4893 iTransitionDisplayRight->MakeVisible( ETrue ); |
|
4894 |
|
4895 TTimeIntervalMicroSeconds clipDuration; |
|
4896 TTimeIntervalMicroSeconds clipCutInTime; |
|
4897 TTimeIntervalMicroSeconds clipCutOutTime; |
|
4898 |
|
4899 TInt nextIndex; |
|
4900 nextIndex = iVideoCursorPos; |
|
4901 |
|
4902 if ( ( nextIndex < iMovie.VideoClipCount() ) ) // video on both sides OR no video on the left hand side |
|
4903 { |
|
4904 CStoryboardVideoItem* item = iVideoItemArray[ nextIndex ]; |
|
4905 |
|
4906 iConverter->ScaleL( item->iIconBitmap, item->iIconBitmap, iTransitionDisplayRight->GetScreenSize() ); |
|
4907 |
|
4908 clipDuration = iMovie.VideoClipInfo( nextIndex )->Duration(); |
|
4909 clipCutInTime = iMovie.VideoClipCutInTime( nextIndex ); |
|
4910 clipCutOutTime = iMovie.VideoClipCutOutTime( nextIndex ); |
|
4911 |
|
4912 iDummyCutBar->Dim( EFalse ); |
|
4913 iDummyCutBar->SetTotalDuration( clipDuration ); |
|
4914 iDummyCutBar->SetInPoint( clipCutInTime ); |
|
4915 iDummyCutBar->SetOutPoint( clipCutOutTime ); |
|
4916 } |
|
4917 else // no video on the right hand side |
|
4918 { |
|
4919 iTransitionDisplayRight->ShowBlankScreen(); |
|
4920 iDummyCutBar->Dim( ETrue ); |
|
4921 } |
|
4922 nextIndex--; |
|
4923 |
|
4924 if ( nextIndex >= 0 ) // video on both sides OR no video on the right hand side |
|
4925 { |
|
4926 CStoryboardVideoItem* item = iVideoItemArray[ nextIndex ]; |
|
4927 if ( item->iLastFrameBitmap != NULL ) |
|
4928 { |
|
4929 iTransitionDisplayLeft->ShowPictureL( *item->iLastFrameBitmap, *item->iLastFrameMask); |
|
4930 } |
|
4931 iDummyCutBarLeft->Dim( EFalse ); |
|
4932 |
|
4933 clipDuration = iMovie.VideoClipInfo( nextIndex )->Duration(); |
|
4934 clipCutInTime = iMovie.VideoClipCutInTime( nextIndex ); |
|
4935 clipCutOutTime = iMovie.VideoClipCutOutTime( nextIndex ); |
|
4936 |
|
4937 iDummyCutBarLeft->SetTotalDuration( clipDuration ); |
|
4938 iDummyCutBarLeft->SetInPoint( clipCutInTime ); |
|
4939 iDummyCutBarLeft->SetOutPoint( clipCutOutTime ); |
|
4940 } |
|
4941 else // no video on the left hand side |
|
4942 { |
|
4943 iTransitionDisplayLeft->ShowBlankScreen(); |
|
4944 iDummyCutBarLeft->Dim( ETrue ); |
|
4945 } |
|
4946 |
|
4947 iVideoDisplay->ShowBlankScreen(); |
|
4948 |
|
4949 iVideoDisplay->SetRect( iVideoDisplayBoxOnTransition ); |
|
4950 iDummyCutBar->SetRect( iDummyCutBarBoxOnTransition ); |
|
4951 |
|
4952 // : start using LAF data when it is available |
|
4953 // iDummyCutBar->Rect() == (321, 107, 433, 151) includes the scissor icon and the progress bar |
|
4954 iDummyCutBar->SetComponentRect( CVeiCutterBar::EProgressBar, TRect(355,107,433,151)); |
|
4955 iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, TRect(355,107,360 ,151) ); |
|
4956 iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderMiddleIcon, TRect(360,107,400 ,151) ); |
|
4957 iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon,TRect(400,107,433 ,151) ); |
|
4958 iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderSelectedLeftEndIcon, TRect(355,107,360 ,151) ); |
|
4959 iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderSelectedMiddleIcon, TRect(360,107,400 ,151) ); |
|
4960 iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderSelectedRightEndIcon,TRect(400,107,433 ,151) ); |
|
4961 iDummyCutBar->SetComponentRect( CVeiCutterBar::EScissorsIcon, TRect(321,107,350 ,151) ); |
|
4962 iDummyCutBar->SetComponentRect( CVeiCutterBar::ECutAreaBorderIcon,TRect(321,107,350 ,151) ); |
|
4963 |
|
4964 iDummyCutBarLeft->MakeVisible( ETrue ); |
|
4965 iDummyCutBarLeft->SetPosition( TPoint(iTransitionDisplayLeftBox.iTl.iX, |
|
4966 iTransitionDisplayLeftBox.iBr.iY- iVideoDisplay->GetBorderWidth() ) ); |
|
4967 iDummyCutBarLeft->SetSize( TSize( iTransitionDisplayLeftBox.Width(), iDummyCutBarBox.Height() ) ); |
|
4968 |
|
4969 // : start using LAF data when it is available |
|
4970 // iDummyCutBarLeft->Rect() == (5, 107, 117, 151) includes the scissor icon and the progress bar |
|
4971 iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::EProgressBar, TRect(35,107,117,151)); |
|
4972 iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, TRect(35,107,55 ,151) ); |
|
4973 iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::ESliderMiddleIcon, TRect(55,107,100 ,151) ); |
|
4974 iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon,TRect(100,107,117 ,151) ); |
|
4975 iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::ESliderSelectedLeftEndIcon, TRect(35,107,55 ,151) ); |
|
4976 iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::ESliderSelectedMiddleIcon, TRect(55,107,100 ,151) ); |
|
4977 iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::ESliderSelectedRightEndIcon,TRect(100,107,117 ,151) ); |
|
4978 iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::EScissorsIcon, TRect(5,107,30 ,151) ); |
|
4979 iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::ECutAreaBorderIcon,TRect(5,107,30 ,151) ); |
|
4980 |
|
4981 ArrowsControl(); |
|
4982 |
|
4983 if ( iVideoCursorPos == 0 ) |
|
4984 { |
|
4985 ShowStartAnimationL( iMovie.StartTransitionEffect() ); |
|
4986 iInfoDisplay->SetName( *iTransitionInfo->StartTransitionName( iMovie.StartTransitionEffect() ) ); |
|
4987 } |
|
4988 else if ( iVideoCursorPos == iMovie.VideoClipCount() ) |
|
4989 { |
|
4990 iInfoDisplay->SetName( *iTransitionInfo->EndTransitionName( iMovie.EndTransitionEffect() ) ); |
|
4991 ShowEndAnimationL( iMovie.EndTransitionEffect() ); |
|
4992 } |
|
4993 else |
|
4994 { |
|
4995 iInfoDisplay->SetName( *iTransitionInfo->MiddleTransitionName( iMovie.MiddleTransitionEffect( CurrentIndex() - 1 ) ) ); |
|
4996 ShowMiddleAnimationL( iMovie.MiddleTransitionEffect( CurrentIndex() - 1 ) ); |
|
4997 } |
|
4998 StartZooming(); |
|
4999 } |
|
5000 else if ( iCursorLocation == ECursorOnEmptyAudioTrack ) |
|
5001 { |
|
5002 iVideoDisplay->MakeVisible( ETrue ); |
|
5003 iInfoDisplay->SetLayout( CVeiTextDisplay::EOnlyName ); |
|
5004 iVideoDisplay->ShowBlankScreen(); |
|
5005 iInfoDisplay->MakeVisible( ETrue ); |
|
5006 |
|
5007 HBufC* stringholder = StringLoader::LoadLC( R_VEI_EDIT_VIEW_NO_AUDIO, iEikonEnv ); |
|
5008 iInfoDisplay->SetName( *stringholder ); |
|
5009 CleanupStack::PopAndDestroy( stringholder ); |
|
5010 |
|
5011 iVideoDisplay->SetRect( iVideoDisplayBox ); |
|
5012 iDummyCutBar->SetRect( iDummyCutBarBox ); |
|
5013 iDummyCutBar->Dim( ETrue ); |
|
5014 } |
|
5015 if ( iView.EditorState() == CVeiEditVideoView::EQuickPreview) |
|
5016 { |
|
5017 TFileName newname; |
|
5018 TVeiSettings movieSaveSettings; |
|
5019 STATIC_CAST( CVeiAppUi*, iEikonEnv->AppUi() )->ReadSettingsL( movieSaveSettings ); |
|
5020 newname.Append( movieSaveSettings.DefaultVideoName() ); |
|
5021 iInfoDisplay->SetName( newname ); |
|
5022 |
|
5023 TTimeIntervalMicroSeconds tempFileDuration; |
|
5024 tempFileDuration = iVideoDisplay->TotalLengthL(); |
|
5025 iInfoDisplay->SetDuration( tempFileDuration ); |
|
5026 } |
|
5027 /*if ( iView.EditorState() == CVeiEditVideoView::EMixAudio) |
|
5028 { |
|
5029 |
|
5030 //iHorizontalSliderSize = TSize(iHorizontalSlider->MinimumSize().iWidth, 50); |
|
5031 // iHorizontalSliderPoint = TPoint( videoScreenX - 25, + videoScreenY + videoScreenSize.iHeight + 70); |
|
5032 iHorizontalSlider->SetExtent( iHorizontalSliderPoint, iHorizontalSliderSize ); |
|
5033 iHorizontalSlider->MakeVisible(ETrue); |
|
5034 iHorizontalSlider->DrawDeferred(); |
|
5035 iVideoDisplay->ShowPictureL(*iAudioMixingIcon); |
|
5036 } |
|
5037 */ |
|
5038 } |
|
5039 |
|
5040 TBool CVeiEditVideoContainer::CurrentClipIsFile() |
|
5041 { |
|
5042 if ( (iCursorLocation == ECursorOnClip) && (iMovie.VideoClipCount() > 0 ) ) |
|
5043 { |
|
5044 return iVideoItemArray[ CurrentIndex() ]->iIsFile; |
|
5045 } |
|
5046 else |
|
5047 return EFalse; |
|
5048 } |
|
5049 |
|
5050 |
|
5051 void CVeiEditVideoContainer::ShowMiddleAnimationL( TVedMiddleTransitionEffect aMiddleEffect ) |
|
5052 { |
|
5053 switch( aMiddleEffect ) |
|
5054 { |
|
5055 case EVedMiddleTransitionEffectNone: |
|
5056 iVideoDisplay->StopAnimation(); |
|
5057 break; |
|
5058 case EVedMiddleTransitionEffectDipToBlack: |
|
5059 iVideoDisplay->ShowAnimationL( R_VEI_DIP_TO_BLACK_ANIMATION ); |
|
5060 break; |
|
5061 case EVedMiddleTransitionEffectDipToWhite: |
|
5062 iVideoDisplay->ShowAnimationL( R_VEI_DIP_TO_WHITE_ANIMATION ); |
|
5063 break; |
|
5064 case EVedMiddleTransitionEffectCrossfade: |
|
5065 iVideoDisplay->ShowAnimationL( R_VEI_CROSSFADE_ANIMATION ); |
|
5066 break; |
|
5067 case EVedMiddleTransitionEffectWipeLeftToRight: |
|
5068 iVideoDisplay->ShowAnimationL( R_VEI_WIPE_LEFT_ANIMATION ); |
|
5069 break; |
|
5070 case EVedMiddleTransitionEffectWipeRightToLeft: |
|
5071 iVideoDisplay->ShowAnimationL( R_VEI_WIPE_RIGHT_ANIMATION ); |
|
5072 break; |
|
5073 case EVedMiddleTransitionEffectWipeTopToBottom: |
|
5074 iVideoDisplay->ShowAnimationL( R_VEI_WIPE_TOP_TO_BOTTOM_ANIMATION ); |
|
5075 break; |
|
5076 case EVedMiddleTransitionEffectWipeBottomToTop: |
|
5077 iVideoDisplay->ShowAnimationL( R_VEI_WIPE_BOTTOM_TO_TOP_ANIMATION ); |
|
5078 break; |
|
5079 default: |
|
5080 break; |
|
5081 } |
|
5082 } |
|
5083 |
|
5084 |
|
5085 void CVeiEditVideoContainer::ShowStartAnimationL( TVedStartTransitionEffect aStartEffect ) |
|
5086 { |
|
5087 switch( aStartEffect ) |
|
5088 { |
|
5089 case EVedStartTransitionEffectNone: |
|
5090 iVideoDisplay->StopAnimation(); |
|
5091 break; |
|
5092 case EVedStartTransitionEffectFadeFromBlack: |
|
5093 iVideoDisplay->ShowAnimationL( R_VEI_FADE_FROM_BLACK_ANIMATION ); |
|
5094 break; |
|
5095 case EVedStartTransitionEffectFadeFromWhite: |
|
5096 iVideoDisplay->ShowAnimationL( R_VEI_FADE_FROM_WHITE_ANIMATION ); |
|
5097 break; |
|
5098 default: |
|
5099 break; |
|
5100 } |
|
5101 } |
|
5102 |
|
5103 void CVeiEditVideoContainer::ShowEndAnimationL( TVedEndTransitionEffect aEndEffect ) |
|
5104 { |
|
5105 switch( aEndEffect ) |
|
5106 { |
|
5107 case EVedEndTransitionEffectNone: |
|
5108 iVideoDisplay->StopAnimation(); |
|
5109 break; |
|
5110 case EVedEndTransitionEffectFadeToBlack: |
|
5111 iVideoDisplay->ShowAnimationL( R_VEI_FADE_TO_BLACK_ANIMATION ); |
|
5112 break; |
|
5113 case EVedEndTransitionEffectFadeToWhite: |
|
5114 iVideoDisplay->ShowAnimationL( R_VEI_FADE_TO_WHITE_ANIMATION ); |
|
5115 break; |
|
5116 default: |
|
5117 break; |
|
5118 } |
|
5119 } |
|
5120 |
|
5121 |
|
5122 void CVeiEditVideoContainer::NotifyVideoDisplayEvent( const TPlayerEvent aEvent, const TInt& aInfo ) |
|
5123 { |
|
5124 LOGFMT4(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() In, \ |
|
5125 aEvent:%d, iFullScreenSelected:%d, iView.EditorState():%d, iPreviewState:%d", \ |
|
5126 aEvent, iFullScreenSelected, iView.EditorState(), iPreviewState); |
|
5127 |
|
5128 if (EStateTerminating == iPreviewState) |
|
5129 { |
|
5130 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent(): app is closing..."); |
|
5131 return; |
|
5132 } |
|
5133 |
|
5134 switch (aEvent) |
|
5135 { |
|
5136 case MVeiVideoDisplayObserver::ELoadingStarted: |
|
5137 { |
|
5138 SetPreviewState(EStateOpening); |
|
5139 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::ELoadingStarted"); |
|
5140 break; |
|
5141 } |
|
5142 case MVeiVideoDisplayObserver::EOpenComplete: |
|
5143 { |
|
5144 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EOpenComplete 1:%Ld", iVideoDisplay->PositionL().Int64()); |
|
5145 |
|
5146 iCursorPreviousLocation = CursorLocation(); |
|
5147 |
|
5148 if ( !iFullScreenSelected ) |
|
5149 { |
|
5150 TRAP_IGNORE( (/*iTempVideoInfo =*/ CVedVideoClipInfo::NewL( *iTempFileName,*this) ) ); |
|
5151 |
|
5152 //for draw function |
|
5153 iCursorLocation = ECursorOnClip; |
|
5154 } |
|
5155 |
|
5156 if ( CVeiEditVideoView::EPreview == iView.EditorState() )//Large preview |
|
5157 { |
|
5158 TRect wholeScreenRect = iView.ClientOrApplicationRect( iFullScreenSelected ); |
|
5159 SetRect( iView.ClientOrApplicationRect( iFullScreenSelected ) ); |
|
5160 iVideoDisplay->SetRect( wholeScreenRect ); |
|
5161 |
|
5162 if ( !VideoEditorUtils::IsLandscapeScreenOrientation() ) //Portrait |
|
5163 { |
|
5164 iVideoDisplay->SetRotationL( EVideoRotationClockwise90 ); |
|
5165 } |
|
5166 |
|
5167 if ( iView.IsForeground() ) |
|
5168 { |
|
5169 iVideoDisplay->ShowBlackScreen(); |
|
5170 DrawDeferred(); |
|
5171 if ( iTempVideoInfo && !iFrameReady) |
|
5172 { |
|
5173 iTempVideoInfo->CancelFrame(); |
|
5174 } |
|
5175 iVideoDisplay->Play(); |
|
5176 } |
|
5177 else |
|
5178 { |
|
5179 iView.SetEditorState( CVeiEditVideoView::EEdit ); |
|
5180 SetBlackScreen( EFalse ); |
|
5181 iView.SetFullScreenSelected( EFalse ); |
|
5182 iVideoDisplay->Stop( ETrue ); |
|
5183 } |
|
5184 |
|
5185 } |
|
5186 else //Small preview |
|
5187 { |
|
5188 iVideoDisplay->SetRect( iVideoDisplayBox ); |
|
5189 iInfoDisplay->SetRect( iInfoDisplayBox ); |
|
5190 iVideoDisplay->SetRotationL( EVideoRotationNone ); |
|
5191 |
|
5192 if ( !VideoEditorUtils::IsLandscapeScreenOrientation() ) //Portrait |
|
5193 { |
|
5194 iInfoDisplay->SetLayout( CVeiTextDisplay::ENameAndDuration ); |
|
5195 iInfoDisplay->MakeVisible( ETrue ); |
|
5196 } |
|
5197 else //Landscape |
|
5198 { |
|
5199 iInfoDisplay->SetLayout( CVeiTextDisplay::EEverything ); |
|
5200 iInfoDisplay->MakeVisible( ETrue ); |
|
5201 } |
|
5202 |
|
5203 if ( iView.IsForeground() ) |
|
5204 { |
|
5205 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EOpenComplete 2"); |
|
5206 iVideoDisplay->ShowBlackScreen(); |
|
5207 DrawDeferred(); |
|
5208 if ( iTempVideoInfo && !iFrameReady) |
|
5209 { |
|
5210 iTempVideoInfo->CancelFrame(); |
|
5211 } |
|
5212 iVideoDisplay->Play(); |
|
5213 } |
|
5214 else |
|
5215 { |
|
5216 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EOpenComplete 3"); |
|
5217 PauseVideoL(); |
|
5218 } |
|
5219 } |
|
5220 break; |
|
5221 } |
|
5222 case MVeiVideoDisplayObserver::EBufferingStarted: |
|
5223 { |
|
5224 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EBufferingStarted"); |
|
5225 SetPreviewState( EStateBuffering ); |
|
5226 if ( iPeriodic ) |
|
5227 { |
|
5228 iPeriodic->Cancel(); |
|
5229 } |
|
5230 break; |
|
5231 } |
|
5232 case MVeiVideoDisplayObserver::ELoadingComplete: |
|
5233 { |
|
5234 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::ELoadingComplete 1"); |
|
5235 |
|
5236 if (EStatePaused == iPreviewState) |
|
5237 { |
|
5238 iVideoDisplay->PauseL(); |
|
5239 } |
|
5240 else |
|
5241 { |
|
5242 SetPreviewState( EStatePlaying ); |
|
5243 |
|
5244 if (iFullScreenSelected) |
|
5245 { |
|
5246 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::ELoadingComplete 2"); |
|
5247 iView.SetEditorState( CVeiEditVideoView::EPreview); |
|
5248 } |
|
5249 else |
|
5250 { |
|
5251 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::ELoadingComplete 3"); |
|
5252 iView.SetEditorState( CVeiEditVideoView::EQuickPreview); |
|
5253 DrawDeferred(); |
|
5254 iVideoDisplay->ShowBlackScreen(); |
|
5255 iScreenLight->Start(); |
|
5256 const TUint delay = 100000; |
|
5257 iPeriodic->Start( delay, delay, TCallBack( CVeiEditVideoContainer::UpdatePosition, this ) ); |
|
5258 TRAP_IGNORE(iView.StartNaviPaneUpdateL()); |
|
5259 } |
|
5260 } |
|
5261 break; |
|
5262 } |
|
5263 case MVeiVideoDisplayObserver::EPlayComplete: |
|
5264 { |
|
5265 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EPlayComplete 1"); |
|
5266 iScreenLight->Stop(); |
|
5267 if ( iPeriodic ) |
|
5268 { |
|
5269 iPeriodic->Cancel(); |
|
5270 } |
|
5271 |
|
5272 if ( !iFullScreenSelected ) |
|
5273 { |
|
5274 SetPreviewState(EStateStopped); |
|
5275 |
|
5276 iLastPosition = iVideoDisplay->TotalLengthL(); |
|
5277 iSeekPos = TTimeIntervalMicroSeconds( 0 ); |
|
5278 |
|
5279 SetFinishedStatus( ETrue ); |
|
5280 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EPlayComplete 2"); |
|
5281 GetThumbAtL(0); |
|
5282 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EPlayComplete 3"); |
|
5283 |
|
5284 iView.SetEditorState( CVeiEditVideoView::EQuickPreview ); |
|
5285 iView.StopNaviPaneUpdateL(); |
|
5286 } |
|
5287 else |
|
5288 { |
|
5289 if (EModeMixingAudio != iSelectionMode) |
|
5290 { |
|
5291 iView.SetEditorState( CVeiEditVideoView::EEdit ); |
|
5292 } |
|
5293 else |
|
5294 { |
|
5295 iView.SetEditorState(CVeiEditVideoView::EMixAudio); |
|
5296 } |
|
5297 |
|
5298 SetBlackScreen( EFalse ); |
|
5299 iView.SetFullScreenSelected( EFalse ); |
|
5300 iVideoDisplay->Stop( ETrue ); |
|
5301 DrawDeferred(); |
|
5302 } |
|
5303 |
|
5304 if (KErrNoMemory == aInfo || KErrSessionClosed == aInfo) |
|
5305 { |
|
5306 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EPlayComplete 4"); |
|
5307 iView.ShowGlobalErrorNote( aInfo ); |
|
5308 StopVideo(ETrue); |
|
5309 } |
|
5310 |
|
5311 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EPlayComplete 5"); |
|
5312 break; |
|
5313 } |
|
5314 case MVeiVideoDisplayObserver::EStop: |
|
5315 { |
|
5316 LOGFMT3(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EStop 1, \ |
|
5317 iFullScreenSelected:%d, iSelectionMode:%d, iCloseStream:%d", \ |
|
5318 iFullScreenSelected, iSelectionMode, iCloseStream); |
|
5319 |
|
5320 if ( iPeriodic ) |
|
5321 { |
|
5322 iPeriodic->Cancel(); |
|
5323 } |
|
5324 iView.StopNaviPaneUpdateL(); |
|
5325 |
|
5326 if (EStateGettingFrame == iPreviewState) |
|
5327 { |
|
5328 break; |
|
5329 } |
|
5330 // position must be set here to 0 because state EStateGettingFrame cannot be resoluted in player |
|
5331 // and position must not be set to 0 in that state |
|
5332 iVideoDisplay->SetPositionL(TTimeIntervalMicroSeconds( 0 )); |
|
5333 |
|
5334 if ( iFullScreenSelected || iCloseStream ) |
|
5335 { |
|
5336 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EStop 4"); |
|
5337 SetPreviewState(EStateClosed); |
|
5338 iVideoDisplay->SetBlackScreen( EFalse ); |
|
5339 iDummyCutBar->MakeVisible( ETrue ); |
|
5340 |
|
5341 if (EModeMixingAudio != iSelectionMode) |
|
5342 { |
|
5343 iView.SetEditorState( CVeiEditVideoView::EEdit ); |
|
5344 SetSelectionMode( EModeNavigation ); |
|
5345 } |
|
5346 else |
|
5347 { |
|
5348 iView.SetEditorState(CVeiEditVideoView::EMixAudio); |
|
5349 break; |
|
5350 } |
|
5351 SetCursorLocation( iCursorPreviousLocation ); |
|
5352 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EStop 5"); |
|
5353 DrawDeferred(); |
|
5354 iCloseStream = EFalse; |
|
5355 break; |
|
5356 } |
|
5357 |
|
5358 if (EModeMixingAudio != iSelectionMode) |
|
5359 { |
|
5360 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EStop 2"); |
|
5361 GetThumbAtL(0); |
|
5362 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EStop 3"); |
|
5363 } |
|
5364 |
|
5365 SetPreviewState(EStateStopped); |
|
5366 iLastPosition = iVideoDisplay->TotalLengthL(); |
|
5367 iSeekPos = TTimeIntervalMicroSeconds( 0 ); |
|
5368 iView.DoUpdateEditNaviLabelL(); |
|
5369 SetFinishedStatus( ETrue ); |
|
5370 iView.SetEditorState( CVeiEditVideoView::EQuickPreview ); |
|
5371 // redraw needed at least to erase pause icon |
|
5372 DrawDeferred(); |
|
5373 break; |
|
5374 } |
|
5375 case MVeiVideoDisplayObserver::EVolumeLevelChanged: |
|
5376 { |
|
5377 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EVolumeLevelChanged 1"); |
|
5378 TInt playerVolume = iVideoDisplay->Volume(); |
|
5379 iView.ShowVolumeLabelL( playerVolume ); |
|
5380 break; |
|
5381 } |
|
5382 case MVeiVideoDisplayObserver::EError: |
|
5383 { |
|
5384 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EError 1"); |
|
5385 iView.ShowGlobalErrorNote( aInfo ); |
|
5386 if (KErrMMAudioDevice == aInfo) |
|
5387 { |
|
5388 PauseVideoL(); |
|
5389 } |
|
5390 else |
|
5391 { |
|
5392 StopVideo(ETrue); |
|
5393 } |
|
5394 break; |
|
5395 } |
|
5396 default: |
|
5397 { |
|
5398 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() default case, aEvent:%d", aEvent); |
|
5399 }; |
|
5400 } |
|
5401 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() Out"); |
|
5402 } |
|
5403 |
|
5404 |
|
5405 void CVeiEditVideoContainer::StartFrameTakerL( TInt aIndex ) |
|
5406 { |
|
5407 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartFrameTakerL: In"); |
|
5408 |
|
5409 // First frame is shown in main display so it is bigger.. Last frame is always |
|
5410 // on transition display and one frame for the video timeline. |
|
5411 TSize firstThumbResolution = iVideoDisplay->GetScreenSize(); |
|
5412 TSize lastThumbResolution = iTransitionDisplayLeft->GetScreenSize(); |
|
5413 TSize timelineThumbResolution = TSize( 34, /*iVideoBarBox.Height()-2*/28 ); |
|
5414 |
|
5415 TTimeIntervalMicroSeconds cutInTime = iMovie.VideoClipCutInTime( aIndex ); |
|
5416 TTimeIntervalMicroSeconds cutOutTime = iMovie.VideoClipCutOutTime( aIndex ); |
|
5417 |
|
5418 |
|
5419 TInt frameCount = iMovie.VideoClipInfo(aIndex)->VideoFrameCount(); |
|
5420 |
|
5421 TInt firstThumbNailIndex = iMovie.VideoClipInfo(aIndex)->GetVideoFrameIndexL( cutInTime ); |
|
5422 TInt lastThumbNailIndex = iMovie.VideoClipInfo(aIndex)->GetVideoFrameIndexL( cutOutTime ); |
|
5423 if ( lastThumbNailIndex >= frameCount ) |
|
5424 { |
|
5425 lastThumbNailIndex = frameCount-1; |
|
5426 } |
|
5427 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartFrameTakerL: 2"); |
|
5428 |
|
5429 iFrameTaker->GetFramesL( *iMovie.VideoClipInfo(aIndex), |
|
5430 firstThumbNailIndex, &firstThumbResolution, |
|
5431 lastThumbNailIndex, &lastThumbResolution, |
|
5432 firstThumbNailIndex, &timelineThumbResolution, |
|
5433 EPriorityLow ); |
|
5434 |
|
5435 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartFrameTakerL: Out"); |
|
5436 } |
|
5437 |
|
5438 void CVeiEditVideoContainer::NotifyFramesCompleted( CFbsBitmap* aFirstFrame, |
|
5439 CFbsBitmap* aLastFrame, CFbsBitmap* aTimelineFrame, TInt aError ) |
|
5440 { |
|
5441 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyFramesCompleted: In, aError:%d", aError); |
|
5442 CStoryboardVideoItem* item; |
|
5443 if( aError==KErrNone ) |
|
5444 { |
|
5445 if ( iMovie.VideoClipColorEffect( iVideoCursorPos ) == EVedColorEffectBlackAndWhite ) |
|
5446 { |
|
5447 ConvertBW( *aFirstFrame ); |
|
5448 ConvertBW( *aLastFrame ); |
|
5449 ConvertBW( *aTimelineFrame ); |
|
5450 } |
|
5451 if ( iMovie.VideoClipColorEffect( iVideoCursorPos ) == EVedColorEffectToning ) |
|
5452 { |
|
5453 //TRgb toning = iMovie.VideoClipColorTone(CurrentIndex()); |
|
5454 ConvertToning(*aFirstFrame); |
|
5455 ConvertToning(*aLastFrame); |
|
5456 ConvertToning(*aTimelineFrame); |
|
5457 } |
|
5458 |
|
5459 item = iVideoItemArray[ iCurrentlyProcessedIndex ]; |
|
5460 TRAP_IGNORE( |
|
5461 item->InsertLastFrameL( *aLastFrame, *aLastFrame ); |
|
5462 item->InsertFirstFrameL( *aFirstFrame, *aFirstFrame ); |
|
5463 item->InsertTimelineFrameL( *aTimelineFrame, *aTimelineFrame ); |
|
5464 iVideoDisplay->ShowPictureL( *item->iIconBitmap, *item->iIconMask); |
|
5465 ); |
|
5466 |
|
5467 // UpdateThumbnail launches progressnote. |
|
5468 if (iProgressDialog ) |
|
5469 { |
|
5470 iProgressDialog->GetProgressInfoL()->SetAndDraw( 100 ); |
|
5471 TRAP_IGNORE( iProgressDialog->ProcessFinishedL() ); |
|
5472 //iProgressDialog = NULL; |
|
5473 } |
|
5474 iView.HandleCommandL( EAknSoftkeyOk ); |
|
5475 } |
|
5476 |
|
5477 // UpdateThumbnail launches progressnote. |
|
5478 if (iProgressDialog ) |
|
5479 { |
|
5480 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyFramesCompleted: 2"); |
|
5481 iProgressDialog->GetProgressInfoL()->SetAndDraw( 100 ); |
|
5482 TRAP_IGNORE( iProgressDialog->ProcessFinishedL() ); |
|
5483 //iProgressDialog = NULL; |
|
5484 } |
|
5485 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyFramesCompleted: 3"); |
|
5486 iCurrentlyProcessedIndex = -1; |
|
5487 iView.SetWaitMode( CVeiEditVideoView::ENotWaiting ); |
|
5488 SetCursorLocation( CursorLocation() ); |
|
5489 |
|
5490 iView.CancelWaitDialog(aError); |
|
5491 iView.AddNext(); |
|
5492 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyFramesCompleted: Out"); |
|
5493 } |
|
5494 |
|
5495 void CVeiEditVideoContainer::NotifyCompletion( TInt DEBUGLOG_ARG(aErr) ) |
|
5496 { |
|
5497 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyCompletion: In, err:%d", aErr); |
|
5498 |
|
5499 if (EStateTerminating == iPreviewState) |
|
5500 { |
|
5501 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyCompletion(): app is closing..."); |
|
5502 return; |
|
5503 } |
|
5504 |
|
5505 if ( iTakeSnapshot ) |
|
5506 { |
|
5507 // to eliminate previous (wrong) output file from being deleted in CancelSnapshotSave() |
|
5508 delete iSaveToFileName; |
|
5509 iSaveToFileName = NULL; |
|
5510 |
|
5511 if ( iProgressDialog ) |
|
5512 { |
|
5513 iProgressDialog->GetProgressInfoL()->SetAndDraw( 100 ); |
|
5514 TRAP_IGNORE( iProgressDialog->ProcessFinishedL() ); |
|
5515 //iProgressDialog = NULL; |
|
5516 } |
|
5517 return; |
|
5518 } |
|
5519 |
|
5520 TRAP_IGNORE(iTransitionDisplayRight->ShowPictureL( *iConverter->GetBitmap())); |
|
5521 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyCompletion: Out"); |
|
5522 } |
|
5523 |
|
5524 void CVeiEditVideoContainer::SetSlowMotionStartValueL(TInt aSlowMotionStartValue) |
|
5525 { |
|
5526 iSlowMotionValue = aSlowMotionStartValue; |
|
5527 iArrowsDisplay->SetSlowMotionPreset( iSlowMotionValue / 10 ); |
|
5528 |
|
5529 TInt frameInterval = (1000-iSlowMotionValue)/2; |
|
5530 |
|
5531 iVideoDisplay->ShowAnimationL( R_VEI_SLOW_MOTION_ANIMATION, frameInterval ); |
|
5532 } |
|
5533 |
|
5534 void CVeiEditVideoContainer::SetRecordedAudioDuration( const TTimeIntervalMicroSeconds& aDuration ) |
|
5535 { |
|
5536 iRecordedAudioDuration = aDuration; |
|
5537 |
|
5538 if ( (iCursorLocation==ECursorOnTransition) && (CurrentIndex() > 0) ) |
|
5539 { |
|
5540 iVideoCursorPos--; |
|
5541 } |
|
5542 iInfoDisplay->SetLayout( CVeiTextDisplay::ERecording ); // Name and duration RED |
|
5543 iInfoDisplay->SetDuration( iRecordedAudioDuration ); |
|
5544 } |
|
5545 |
|
5546 |
|
5547 TBool CVeiEditVideoContainer::IsAudioClipCutted() |
|
5548 { |
|
5549 TTimeIntervalMicroSeconds audioClipDuration = iMovie.AudioClipInfo( CurrentIndex())->Duration(); |
|
5550 TTimeIntervalMicroSeconds audioClipCutInTime = iMovie.AudioClipCutInTime( CurrentIndex() ); |
|
5551 TTimeIntervalMicroSeconds audioClipCutOutTime = iMovie.AudioClipCutOutTime( CurrentIndex() ); |
|
5552 |
|
5553 TTimeIntervalMicroSeconds appendTime(500000); |
|
5554 TTimeIntervalMicroSeconds cuttedAudioDuration = ( audioClipCutOutTime.Int64() - audioClipCutInTime.Int64() ) + appendTime.Int64(); |
|
5555 iInfoDisplay->SetDuration( cuttedAudioDuration ); |
|
5556 |
|
5557 iDummyCutBar->SetTotalDuration( audioClipDuration ); |
|
5558 iDummyCutBar->SetInPoint( audioClipCutInTime ); |
|
5559 iDummyCutBar->SetOutPoint( audioClipCutOutTime ); |
|
5560 iDummyCutBar->Dim( EFalse ); |
|
5561 |
|
5562 if ( ( audioClipCutOutTime.Int64() - audioClipCutInTime.Int64() ) == audioClipDuration.Int64() ) |
|
5563 { |
|
5564 return EFalse; |
|
5565 } |
|
5566 else |
|
5567 { |
|
5568 return ETrue; |
|
5569 } |
|
5570 } |
|
5571 |
|
5572 /* Checks if aFilename is belongs to any album. Album name is returned, or KNullDesC |
|
5573 if aFilename does not belong to album. */ |
|
5574 void CVeiEditVideoContainer::GetAlbumL( const TDesC& aFilename, TDes& aAlbumName ) const |
|
5575 { |
|
5576 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetAlbumL: in"); |
|
5577 |
|
5578 CMGAlbumManager* albumManager = MGAlbumManagerFactory::NewAlbumManagerL(); |
|
5579 TInt albumCount = albumManager->AlbumCount(); |
|
5580 |
|
5581 // Get album Id |
|
5582 for( TInt i=0;i<albumCount;i++ ) |
|
5583 { |
|
5584 CMGAlbumInfo* albumInfo = albumManager->AlbumInfoLC( i ); |
|
5585 TInt albumId = albumInfo->Id(); |
|
5586 TInt itemCount = albumInfo->ItemCount(); |
|
5587 |
|
5588 TFileName albumName = albumInfo->Name(); |
|
5589 CleanupStack::PopAndDestroy(albumInfo); |
|
5590 |
|
5591 if ( itemCount > 0 ) |
|
5592 { |
|
5593 TInt itemPos; |
|
5594 CDesCArrayFlat* filenameArray = new (ELeave) CDesCArrayFlat( itemCount ); |
|
5595 CleanupStack::PushL (filenameArray); |
|
5596 |
|
5597 albumManager->GetAlbumFileArrayL( albumId, *filenameArray ); |
|
5598 |
|
5599 TInt isFound = filenameArray->Find( aFilename, itemPos ); |
|
5600 CleanupStack::PopAndDestroy (filenameArray); |
|
5601 |
|
5602 if ( isFound == KErrNone ) /* filename was found on filenamearray */ |
|
5603 { |
|
5604 delete albumManager; |
|
5605 aAlbumName.Append(albumName); |
|
5606 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetAlbumL: out1"); |
|
5607 return; |
|
5608 } |
|
5609 } |
|
5610 } |
|
5611 delete albumManager; |
|
5612 |
|
5613 aAlbumName = KNullDesC; |
|
5614 |
|
5615 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetAlbumL: out2"); |
|
5616 } |
|
5617 |
|
5618 |
|
5619 void CVeiEditVideoContainer::SetBlackScreen( TBool aBlack ) |
|
5620 { |
|
5621 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::SetBlackScreen: In, aBlack:%d", aBlack); |
|
5622 |
|
5623 iBlackScreen = aBlack; |
|
5624 |
|
5625 // Black backbround for the preview |
|
5626 if ( iBlackScreen ) |
|
5627 { |
|
5628 iVideoDisplay->MakeVisible( EFalse ); |
|
5629 /* Video Display components for transitioin state*/ |
|
5630 iTransitionDisplayRight->MakeVisible( EFalse ); |
|
5631 iTransitionDisplayLeft->MakeVisible( EFalse ); |
|
5632 |
|
5633 iDummyCutBar->MakeVisible( EFalse ); |
|
5634 iDummyCutBarLeft->MakeVisible( EFalse ); |
|
5635 |
|
5636 /* IconBox */ |
|
5637 iEffectSymbols->MakeVisible( EFalse ); |
|
5638 iInfoDisplay->MakeVisible( EFalse ); |
|
5639 iArrowsDisplay->MakeVisible( EFalse ); |
|
5640 |
|
5641 iHorizontalSlider->MakeVisible( EFalse ); |
|
5642 iVerticalSlider->MakeVisible( EFalse ); |
|
5643 |
|
5644 if( iCursorLocation == ECursorOnTransition ) |
|
5645 { |
|
5646 iVideoDisplay->StopAnimation(); |
|
5647 } |
|
5648 } |
|
5649 else |
|
5650 { |
|
5651 SetCursorLocation( CursorLocation() ); |
|
5652 } |
|
5653 DrawDeferred(); |
|
5654 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::SetBlackScreen: Out"); |
|
5655 } |
|
5656 |
|
5657 TInt CVeiEditVideoContainer::SnapshotSize() |
|
5658 { |
|
5659 TInt sizeEstimate = 0; |
|
5660 |
|
5661 if( iTempVideoInfo ) |
|
5662 { |
|
5663 TTimeIntervalMicroSeconds playBackPos = PlaybackPositionL(); |
|
5664 TInt frame = iTempVideoInfo->GetVideoFrameIndexL( playBackPos ); |
|
5665 sizeEstimate = iTempVideoInfo->VideoFrameSizeL( frame ); |
|
5666 } |
|
5667 |
|
5668 return sizeEstimate; |
|
5669 } |
|
5670 |
|
5671 TInt CVeiEditVideoContainer::AudioMixingRatio() const |
|
5672 { |
|
5673 return iHorizontalSlider->SliderPosition(); |
|
5674 } |
|
5675 |
|
5676 |
|
5677 TInt CVeiEditVideoContainer::Volume() const |
|
5678 { |
|
5679 return -(iVerticalSlider->SliderPosition()); |
|
5680 } |
|
5681 |
|
5682 //============================================================================= |
|
5683 void CVeiEditVideoContainer::SetColourToningIcons(TInt /*aIndex*/) |
|
5684 { |
|
5685 if ( ( iMovie.VideoClipColorEffect( iVideoCursorPos ) ) == EVedColorEffectBlackAndWhite ) |
|
5686 { |
|
5687 iEffectSymbols->SetBlackAndWhiteIconVisibility(ETrue); |
|
5688 } |
|
5689 else |
|
5690 { |
|
5691 iEffectSymbols->SetBlackAndWhiteIconVisibility(EFalse); |
|
5692 } |
|
5693 if ( ( iMovie.VideoClipColorEffect( iVideoCursorPos ) ) == EVedColorEffectToning ) |
|
5694 { |
|
5695 iEffectSymbols->SetColourIconVisibility(ETrue); |
|
5696 } |
|
5697 else |
|
5698 { |
|
5699 iEffectSymbols->SetColourIconVisibility(EFalse); |
|
5700 } |
|
5701 } |
|
5702 //======================================================================================================= |
|
5703 void CVeiEditVideoContainer::StartProgressDialogL(const TInt aDialogResId, const TInt aTextResId) |
|
5704 { |
|
5705 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartProgressDialogL: In"); |
|
5706 |
|
5707 if (iProgressDialog) |
|
5708 { |
|
5709 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartProgressDialogL: 1"); |
|
5710 delete iProgressDialog; |
|
5711 iProgressDialog = NULL; |
|
5712 } |
|
5713 |
|
5714 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartProgressDialogL: 2"); |
|
5715 |
|
5716 iProgressDialog = new (ELeave) CAknProgressDialog( |
|
5717 reinterpret_cast<CEikDialog**>(&iProgressDialog), ETrue ); |
|
5718 iProgressDialog->PrepareLC(aDialogResId); |
|
5719 iProgressDialog->SetCallback( this ); |
|
5720 |
|
5721 |
|
5722 HBufC* stringholder = StringLoader::LoadLC( aTextResId, iEikonEnv ); |
|
5723 iProgressDialog->SetTextL( *stringholder ); |
|
5724 CleanupStack::PopAndDestroy(stringholder); |
|
5725 |
|
5726 iProgressDialog->GetProgressInfoL()->SetFinalValue( 100 ); |
|
5727 iProgressDialog->RunLD(); |
|
5728 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartProgressDialogL: Out"); |
|
5729 } |
|
5730 |
|
5731 //============================================================================= |
|
5732 void CVeiEditVideoContainer::SetPreviewState(const TPreviewState aNewState) |
|
5733 { |
|
5734 LOGFMT3(KVideoEditorLogFile, "CVeiEditVideoContainer::SetPreviewState In, aNewState:%d, iPreviewState:%d, iPreviousPreviewState:%d", aNewState, iPreviewState, iPreviousPreviewState); |
|
5735 |
|
5736 if (EStateGettingFrame == aNewState) |
|
5737 { |
|
5738 iPreviousPreviewState = iPreviewState; |
|
5739 } |
|
5740 iPreviewState = aNewState; |
|
5741 iSeeking = EFalse; |
|
5742 |
|
5743 /*if (EStateTerminating != iPreviewState) |
|
5744 { |
|
5745 iView.SetEditorState( iView.EditorState() ); |
|
5746 } |
|
5747 */ |
|
5748 |
|
5749 // Make sure that the pause indicator is drawn immediately |
|
5750 if (EStatePaused == iPreviewState) |
|
5751 { |
|
5752 DrawNow(); |
|
5753 } |
|
5754 |
|
5755 // While playing, grab the volume keys for adjusting playback volume. |
|
5756 // In other states let them pass e.g. to the music player. |
|
5757 if(EStatePlaying == aNewState) |
|
5758 { |
|
5759 if (!iRemConTarget) |
|
5760 { |
|
5761 // We can ignore the possible error - the if the remote connection |
|
5762 // fails, we just won't receive volume keys, which is a minor problem. |
|
5763 TRAPD(err, iRemConTarget = CVeiRemConTarget::NewL( *this ) ); |
|
5764 if (KErrNone != err) |
|
5765 { |
|
5766 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::SetPreviewState: CVeiRemConTarget::NewL failed: %d", err); |
|
5767 } |
|
5768 } |
|
5769 } |
|
5770 else |
|
5771 { |
|
5772 delete iRemConTarget; |
|
5773 iRemConTarget = NULL; |
|
5774 } |
|
5775 |
|
5776 // : implement #ifdef here to facilitate easy remove of unnecessary stopping |
|
5777 //#ifdef STOP_PLAYER_DURING_GETFRAME |
|
5778 if (EStateGettingFrame == aNewState) |
|
5779 { |
|
5780 /* : |
|
5781 check out on every phone before releasing whether videodisplay should be stopped before starting |
|
5782 asynchronous GetFrameL() |
|
5783 see how EStateGettingFrame is handled in SetPreviewState |
|
5784 Stopping frees memory and it is needed in memory sensible devices |
|
5785 */ |
|
5786 //iVideoDisplay->Stop(ETrue); |
|
5787 // SetEditorState is effective because iPreviewState is changed |
|
5788 iView.SetEditorState( iView.EditorState() ); |
|
5789 } |
|
5790 //#endif |
|
5791 } |
|
5792 |
|
5793 //============================================================================= |
|
5794 void CVeiEditVideoContainer::HandleVolumeUpL() |
|
5795 { |
|
5796 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVolumeUpL: in"); |
|
5797 |
|
5798 iVideoDisplay->AdjustVolumeL( 1 ); |
|
5799 |
|
5800 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVolumeUpL: out"); |
|
5801 } |
|
5802 |
|
5803 //============================================================================= |
|
5804 void CVeiEditVideoContainer::HandleVolumeDownL() |
|
5805 { |
|
5806 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVolumeDownL: in"); |
|
5807 |
|
5808 iVideoDisplay->AdjustVolumeL( -1 ); |
|
5809 |
|
5810 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVolumeDownL: out"); |
|
5811 } |
|
5812 |
|
5813 //============================================================================= |
|
5814 void CVeiEditVideoContainer::PrepareForTerminationL() |
|
5815 { |
|
5816 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PrepareForTerminationL: in"); |
|
5817 |
|
5818 SetPreviewState( EStateTerminating ); |
|
5819 iVideoDisplay->Stop(ETrue); |
|
5820 iScreenLight->Stop(); |
|
5821 |
|
5822 LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PrepareForTerminationL: out"); |
|
5823 } |
|
5824 |
|
5825 //============================================================================= |
|
5826 TInt CVeiEditVideoContainer::AsyncTakeSnapshot(TAny* aThis) |
|
5827 { |
|
5828 LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::AsyncTakeSnapshot"); |
|
5829 |
|
5830 // In the asynchronous version, trap the rest of the functions |
|
5831 // to make sure that the caller's TRequestStatus is always |
|
5832 // completed, also in case of failures. |
|
5833 CVeiEditVideoContainer* container = static_cast<CVeiEditVideoContainer*>(aThis); |
|
5834 TInt err = KErrNone; |
|
5835 TRAP(err, container->TakeSnapshotL()); |
|
5836 LOGFMT( KVideoEditorLogFile, "CVeiEditVideoContainer::AsyncTakeSnapshot 1, err:%d", err); |
|
5837 User::LeaveIfError(err); |
|
5838 return KErrNone; |
|
5839 } |
|
5840 |
|
5841 //============================================================================= |
|
5842 void CVeiEditVideoContainer::CalculateVideoClipRects() |
|
5843 { |
|
5844 LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::CalculateVideoClipRects: in" ); |
|
5845 iVideoItemRectArray.Reset(); |
|
5846 |
|
5847 TRect selectedRect; // rect of the highlighted clip |
|
5848 TRect videoClipRect; // rect of the video clip in timeline |
|
5849 TInt barWidth = iVideoBarBox.Width(); |
|
5850 TInt64 barDuration = iMovie.Duration().Int64(); |
|
5851 |
|
5852 TInt64 audioDuration(0); |
|
5853 if ( (iMovie.AudioClipCount() != 0) && ((iSelectionMode == EModeRecording ) || |
|
5854 (iSelectionMode == EModeRecordingPaused))) |
|
5855 { |
|
5856 audioDuration = (iMovie.AudioClipEndTime( iMovie.AudioClipCount() - 1 )).Int64(); |
|
5857 } |
|
5858 |
|
5859 audioDuration+= iRecordedAudioDuration.Int64(); |
|
5860 |
|
5861 if ( audioDuration > barDuration ) |
|
5862 { |
|
5863 barDuration = audioDuration; |
|
5864 } |
|
5865 if ( iRecordedAudioStartTime > barDuration ) |
|
5866 { |
|
5867 barDuration = iRecordedAudioStartTime.Int64(); |
|
5868 } |
|
5869 if (barDuration < 30000000) |
|
5870 { |
|
5871 barDuration = 30000000; |
|
5872 } |
|
5873 else if (barDuration < 45000000) |
|
5874 { |
|
5875 barDuration = 45000000; |
|
5876 } |
|
5877 else{ |
|
5878 barDuration = ((barDuration / 30000000) + 1) * 30000000; |
|
5879 } |
|
5880 |
|
5881 videoClipRect.iTl.iY = iVideoBarBox.iTl.iY; |
|
5882 videoClipRect.iBr.iY = iVideoBarBox.iBr.iY; |
|
5883 |
|
5884 // calculate the rect of each of the video clip |
|
5885 for (TInt i = 0; i < iMovie.VideoClipCount(); i++ ) |
|
5886 { |
|
5887 videoClipRect.iTl.iX = iVideoBarBox.iTl.iX |
|
5888 + static_cast<TInt32>( (iMovie.VideoClipStartTime( i ).Int64() * barWidth ) / barDuration ); |
|
5889 videoClipRect.iBr.iX = iVideoBarBox.iTl.iX |
|
5890 + static_cast<TInt32>( (iMovie.VideoClipEndTime( i ).Int64() * barWidth ) / barDuration )+ 1; |
|
5891 |
|
5892 if ((iCursorLocation == ECursorOnClip) |
|
5893 && (i == CurrentIndex()) && ( iView.EditorState() == CVeiEditVideoView::EEdit )) |
|
5894 // the current video clip selected |
|
5895 { |
|
5896 LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::CalculateVideoClipRects: selected clip" ); |
|
5897 selectedRect = videoClipRect; |
|
5898 selectedRect.Grow( iZoomFactorX,iZoomFactorY ); |
|
5899 iVideoItemRectArray.Insert( selectedRect, i ); |
|
5900 } |
|
5901 else |
|
5902 { |
|
5903 iVideoItemRectArray.Insert( videoClipRect, i ); |
|
5904 } |
|
5905 |
|
5906 LOGFMT6( KVideoEditorLogFile, "CVeiEditVideoContainer::CalculateVideoClipRects, iVideoItemRectArray.[%d]->Rect(): \ |
|
5907 (%d,%d,%d,%d), barWidth = %d ", \ |
|
5908 i, |
|
5909 iVideoItemRectArray[i].iTl.iX, |
|
5910 iVideoItemRectArray[i].iTl.iY, |
|
5911 iVideoItemRectArray[i].iBr.iX, |
|
5912 iVideoItemRectArray[i].iBr.iY, |
|
5913 barWidth ); |
|
5914 } |
|
5915 |
|
5916 // Calculate the empty rect of the timeline |
|
5917 if ( iMovie.VideoClipCount() > 0 ) |
|
5918 { |
|
5919 iEmptyVideoTimeLineRect.iTl = TPoint ( iVideoItemRectArray[ iMovie.VideoClipCount()-1 ].iBr.iX, iVideoBarBox.iTl.iY ); |
|
5920 iEmptyVideoTimeLineRect.iBr = iVideoBarBox.iBr; |
|
5921 } |
|
5922 else |
|
5923 { |
|
5924 iEmptyVideoTimeLineRect = iVideoBarBox; |
|
5925 } |
|
5926 |
|
5927 LOGFMT4( KVideoEditorLogFile, "CVeiEditVideoContainer::CalculateVideoClipRects, iEmptyVideoTimeLineRect: \ |
|
5928 (%d,%d,%d,%d) ", \ |
|
5929 iEmptyVideoTimeLineRect.iTl.iX, |
|
5930 iEmptyVideoTimeLineRect.iTl.iY, |
|
5931 iEmptyVideoTimeLineRect.iBr.iX, |
|
5932 iEmptyVideoTimeLineRect.iBr.iY ); |
|
5933 |
|
5934 LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::CalculateVideoClipRects: out" ); |
|
5935 } |
|
5936 // End of File |
|