|
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 |
|
21 // INCLUDE FILES |
|
22 // System includes |
|
23 #include <VedSimpleCutVideo.rsg> |
|
24 #include <videoeditoruicomponents.mbg> |
|
25 #include <eikbtgpc.h> |
|
26 #include <vedvideoclipinfo.h> |
|
27 #include <coemain.h> |
|
28 #include <eikenv.h> |
|
29 //#include <CMGXFileManager.h> |
|
30 //#include <MGXFileManagerFactory.h> |
|
31 #include <aknsbasicbackgroundcontrolcontext.h> |
|
32 #include <aknsdrawutils.h> |
|
33 #include <aknsdatacontext.h> |
|
34 #include <stringloader.h> |
|
35 #include <aknnotewrappers.h> |
|
36 #include <pathinfo.h> |
|
37 #include <eikprogi.h> |
|
38 #include <aknlayoutscalable_avkon.cdl.h> |
|
39 #include <aknlayoutscalable_apps.cdl.h> |
|
40 #include <CAknMemorySelectionDialog.h> |
|
41 #include <CAknFileNamePromptDialog.h> |
|
42 #include <AknCommonDialogsDynMem.h> |
|
43 #include <CAknMemorySelectionDialogMultiDrive.h> |
|
44 #include <apgcli.h> |
|
45 #include <csxhelp/vided.hlp.hrh> |
|
46 |
|
47 #ifdef RD_TACTILE_FEEDBACK |
|
48 #include <touchfeedback.h> |
|
49 #endif /* RD_TACTILE_FEEDBACK */ |
|
50 |
|
51 // User includes |
|
52 #include "VeiSimpleCutVideoAppUi.h" |
|
53 #include "VeiCutterBar.h" |
|
54 #include "VeiSimpleCutVideoContainer.h" |
|
55 #include "VeiSimpleCutVideoView.h" |
|
56 #include "veitextdisplay.h" |
|
57 #include "VideoEditorCommon.h" |
|
58 #include "VideoEditorUtils.h" |
|
59 #include "VeiErrorUi.h" |
|
60 #include "VedSimpleCutVideo.hrh" |
|
61 |
|
62 #define KMediaGalleryUID3 0x101F8599 |
|
63 |
|
64 // ================= MEMBER FUNCTIONS ======================= |
|
65 void CleanupRarray( TAny* object ) |
|
66 { |
|
67 (( RImageTypeDescriptionArray*)object)->ResetAndDestroy(); |
|
68 } |
|
69 |
|
70 CVeiSimpleCutVideoContainer* CVeiSimpleCutVideoContainer::NewL( const TRect& aRect, CVeiSimpleCutVideoView& aView, CVeiErrorUI& aErrorUI ) |
|
71 { |
|
72 CVeiSimpleCutVideoContainer* self = CVeiSimpleCutVideoContainer::NewLC( aRect, aView, aErrorUI ); |
|
73 CleanupStack::Pop( self ); |
|
74 return self; |
|
75 } |
|
76 |
|
77 CVeiSimpleCutVideoContainer* CVeiSimpleCutVideoContainer::NewLC( const TRect& aRect, CVeiSimpleCutVideoView& aView, CVeiErrorUI& aErrorUI ) |
|
78 { |
|
79 CVeiSimpleCutVideoContainer* self = new (ELeave) CVeiSimpleCutVideoContainer( aRect, aView, aErrorUI ); |
|
80 CleanupStack::PushL( self ); |
|
81 self->ConstructL( aRect, aView, aErrorUI ); |
|
82 return self; |
|
83 } |
|
84 |
|
85 void CVeiSimpleCutVideoContainer::ConstructL( const TRect& aRect, CVeiSimpleCutVideoView& /*aView*/, CVeiErrorUI& /*aErrorUI*/ ) |
|
86 { |
|
87 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::ConstructL: in"); |
|
88 CreateWindowL(); |
|
89 |
|
90 iState = EStateInitializing; |
|
91 iFrameReady = EFalse; |
|
92 iPlayOrPlayMarked = EFalse; |
|
93 |
|
94 iSeekPos = TTimeIntervalMicroSeconds( 0 ); |
|
95 iSeeking = EFalse; |
|
96 iCutVideoBar = CVeiCutterBar::NewL( this ); |
|
97 |
|
98 iConverter = CVeiImageConverter::NewL( this ); |
|
99 iTakeSnapshot = EFalse; |
|
100 iVideoDisplay = CVeiVideoDisplay::NewL( iDisplayRect, this, *this ); |
|
101 |
|
102 TFileName mbmPath( VideoEditorUtils::IconFileNameAndPath(KVideoEditorUiComponentsIconFileId) ); |
|
103 |
|
104 if( !AknLayoutUtils::PenEnabled() ) |
|
105 { |
|
106 iCutTimeDisplay = CVeiTextDisplay::NewL( iCutTimeDisplayRect, this ); |
|
107 |
|
108 // A new icon. Temporarely same bitmap is used for non touch pause as in touch devices |
|
109 // A new icon has been requested and it should be changed here as soon as it's in the build |
|
110 AknIconUtils::CreateIconL( iPauseBitmap, iPauseBitmapMask, |
|
111 mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded_pause, |
|
112 EMbmVideoeditoruicomponentsQgn_indi_vded_pause_mask ); |
|
113 } |
|
114 else |
|
115 { |
|
116 AknIconUtils::CreateIconL( iPlayBitmap, iPlayBitmapMask, |
|
117 mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded2_play, |
|
118 EMbmVideoeditoruicomponentsQgn_indi_vded2_play_mask ); |
|
119 |
|
120 AknIconUtils::CreateIconL( iPauseBitmap, iPauseBitmapMask, |
|
121 mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded2_pause, |
|
122 EMbmVideoeditoruicomponentsQgn_indi_vded2_pause_mask ); |
|
123 } |
|
124 |
|
125 SetRect( aRect ); |
|
126 |
|
127 iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse ); |
|
128 iVideoBarTimer = CPeriodic::NewL( CActive::EPriorityLow ); |
|
129 |
|
130 #ifdef RD_TACTILE_FEEDBACK |
|
131 iTouchFeedBack = MTouchFeedback::Instance(); |
|
132 #endif /* RD_TACTILE_FEEDBACK */ |
|
133 |
|
134 iRemConTarget = CVeiRemConTarget::NewL( *this ); |
|
135 |
|
136 EnableDragEvents(); |
|
137 |
|
138 ActivateL(); |
|
139 |
|
140 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::ConstructL: out"); |
|
141 } |
|
142 |
|
143 CVeiSimpleCutVideoContainer::CVeiSimpleCutVideoContainer( |
|
144 const TRect& /*aRect*/, CVeiSimpleCutVideoView& aView, |
|
145 CVeiErrorUI& aErrorUI ) : iView( aView ), iErrorUI( aErrorUI ) |
|
146 { |
|
147 } |
|
148 |
|
149 CVeiSimpleCutVideoContainer::~CVeiSimpleCutVideoContainer() |
|
150 { |
|
151 if ( iCutVideoBar ) |
|
152 { |
|
153 delete iCutVideoBar; |
|
154 } |
|
155 if ( iBgContext ) |
|
156 { |
|
157 delete iBgContext; |
|
158 } |
|
159 if ( iVideoDisplay ) |
|
160 { |
|
161 delete iVideoDisplay; |
|
162 } |
|
163 if ( iCutTimeDisplay ) |
|
164 { |
|
165 delete iCutTimeDisplay; |
|
166 } |
|
167 if ( iVideoClipInfo ) |
|
168 { |
|
169 delete iVideoClipInfo; |
|
170 iVideoClipInfo = NULL; |
|
171 } |
|
172 if ( iConverter ) |
|
173 { |
|
174 iConverter->Cancel(); |
|
175 delete iConverter; |
|
176 } |
|
177 if ( iVideoBarTimer ) |
|
178 { |
|
179 iVideoBarTimer->Cancel(); |
|
180 delete iVideoBarTimer; |
|
181 } |
|
182 |
|
183 if ( iProgressDialog ) |
|
184 { |
|
185 delete iProgressDialog; |
|
186 iProgressDialog = NULL; |
|
187 } |
|
188 if ( iSaveToFileName ) |
|
189 { |
|
190 delete iSaveToFileName; |
|
191 iSaveToFileName = NULL; |
|
192 } |
|
193 |
|
194 delete iCallBackSaveSnapshot; |
|
195 delete iCallBackTakeSnapshot; |
|
196 |
|
197 if ( iPlayBitmap ) |
|
198 { |
|
199 delete iPlayBitmap; |
|
200 } |
|
201 if ( iPlayBitmapMask ) |
|
202 { |
|
203 delete iPlayBitmapMask; |
|
204 } |
|
205 delete iPauseBitmap; |
|
206 delete iPauseBitmapMask; |
|
207 |
|
208 delete iRemConTarget; |
|
209 } |
|
210 |
|
211 void CVeiSimpleCutVideoContainer::DialogDismissedL( TInt aButtonId ) |
|
212 { |
|
213 if ( aButtonId == -1 ) |
|
214 { // when pressing cancel button. |
|
215 CancelSnapshotSave(); |
|
216 } |
|
217 iTakeSnapshot = EFalse; |
|
218 } |
|
219 |
|
220 void CVeiSimpleCutVideoContainer::SizeChanged() |
|
221 { |
|
222 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SizeChanged(): In"); |
|
223 TSize videoScreenSize; |
|
224 TRect rect( Rect() ); |
|
225 if ( iBgContext ) |
|
226 { |
|
227 iBgContext->SetRect( rect ); |
|
228 } |
|
229 LOGFMT2(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SizeChanged(): Rect(): %d,%d", rect.iBr.iX, rect.iBr.iY); |
|
230 |
|
231 TInt variety = 0; |
|
232 if (VideoEditorUtils::IsLandscapeScreenOrientation()) |
|
233 { |
|
234 variety = 1; |
|
235 } |
|
236 |
|
237 if( !AknLayoutUtils::PenEnabled() ) |
|
238 { |
|
239 // Progress bar |
|
240 TAknLayoutRect progressBarLayout; |
|
241 progressBarLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::vded_slider_pane()); |
|
242 iCutVideoBar->SetComponentRect(CVeiCutterBar::EProgressBar, progressBarLayout.Rect()); |
|
243 |
|
244 TAknLayoutRect sliderLeftEndLayout; |
|
245 TAknLayoutRect sliderRightEndLayout; |
|
246 if ( AknLayoutUtils::LayoutMirrored () ) |
|
247 { |
|
248 // left end of the slider when that part is unselected |
|
249 sliderLeftEndLayout.LayoutRect( progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g4() ); |
|
250 iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, sliderLeftEndLayout.Rect() ); |
|
251 |
|
252 // right end of the slider when that part is unselected |
|
253 sliderRightEndLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g3()); |
|
254 iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon, sliderRightEndLayout.Rect() ); |
|
255 } |
|
256 else |
|
257 { |
|
258 // left end of the slider when that part is unselected |
|
259 sliderLeftEndLayout.LayoutRect( progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g3() ); |
|
260 iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, sliderLeftEndLayout.Rect() ); |
|
261 |
|
262 // right end of the slider when that part is unselected |
|
263 sliderRightEndLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g4()); |
|
264 iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon, sliderRightEndLayout.Rect() ); |
|
265 } |
|
266 |
|
267 // middle part of the slider when that part is unselected |
|
268 TAknLayoutRect sliderMiddleLayout; |
|
269 sliderMiddleLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g5()); |
|
270 iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderMiddleIcon, sliderMiddleLayout.Rect() ); |
|
271 |
|
272 // left end of the cut selection slider |
|
273 TAknLayoutRect sliderSelectedLeftEndLayout; |
|
274 sliderSelectedLeftEndLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g3()); |
|
275 iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderSelectedLeftEndIcon, sliderSelectedLeftEndLayout.Rect() ); |
|
276 |
|
277 // middle part of the cut selection slider |
|
278 TAknLayoutRect sliderSelectedMiddleLayout; |
|
279 sliderSelectedMiddleLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g5()); |
|
280 iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderSelectedMiddleIcon, sliderSelectedMiddleLayout.Rect() ); |
|
281 |
|
282 // right end of the cut selection slider |
|
283 TAknLayoutRect sliderSelectedRightEndLayout; |
|
284 sliderSelectedRightEndLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g4()); |
|
285 iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderSelectedRightEndIcon, sliderSelectedRightEndLayout.Rect() ); |
|
286 |
|
287 // playhead |
|
288 TAknLayoutRect playheadLayout; |
|
289 playheadLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g1()); |
|
290 iCutVideoBar->SetComponentRect( CVeiCutterBar::EPlayheadIcon, playheadLayout.Rect() ); |
|
291 |
|
292 // left/right border of cut selection slider |
|
293 TAknLayoutRect cutAreaBorderLayout; |
|
294 cutAreaBorderLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g2()); |
|
295 iCutVideoBar->SetComponentRect( CVeiCutterBar::ECutAreaBorderIcon, cutAreaBorderLayout.Rect() ); |
|
296 |
|
297 TAknLayoutText startTimeTextLayout; |
|
298 TAknLayoutText endTimeTextLayout; |
|
299 TAknLayoutRect startTimeIconLayout; |
|
300 TAknLayoutRect endTimeIconLayout; |
|
301 |
|
302 // Video Display |
|
303 TAknLayoutRect videoDisplayLayout; |
|
304 videoDisplayLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::vded_video_pane()); |
|
305 iVideoDisplay->SetRect(videoDisplayLayout.Rect()); |
|
306 |
|
307 iDisplayRect = videoDisplayLayout.Rect(); |
|
308 iIconDisplayRect = videoDisplayLayout.Rect(); |
|
309 LOGFMT2(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SizeChanged(): iDisplayRect: %d,%d", iDisplayRect.iBr.iX, iDisplayRect.iBr.iY); |
|
310 |
|
311 //CVeiCutterBar |
|
312 TRect cutBarRect( sliderLeftEndLayout.Rect().iTl, sliderRightEndLayout.Rect().iBr ); |
|
313 iCutVideoBar->SetRect( cutBarRect ); |
|
314 |
|
315 TInt iconWidth = STATIC_CAST( TInt, rect.iBr.iX * 0.07954545455 ); |
|
316 AknIconUtils::SetSize( iPauseBitmap, TSize(iconWidth,iconWidth), EAspectRatioNotPreserved ); |
|
317 } |
|
318 else |
|
319 { |
|
320 // Progress bar |
|
321 TAknLayoutRect progressBarLayout; |
|
322 progressBarLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::vded2_slider_pane(variety)); |
|
323 |
|
324 TAknLayoutRect progressBGLayout; |
|
325 progressBGLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_bg_pane()); |
|
326 iCutVideoBar->SetComponentRect(CVeiCutterBar::EProgressBar, progressBGLayout.Rect()); |
|
327 |
|
328 TAknLayoutRect sliderLeftEndLayout; |
|
329 TAknLayoutRect sliderRightEndLayout; |
|
330 if ( AknLayoutUtils::LayoutMirrored () ) |
|
331 { |
|
332 // left end of the slider when that part is unselected |
|
333 sliderLeftEndLayout.LayoutRect( progressBGLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_bg_pane_g2()); |
|
334 iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, sliderLeftEndLayout.Rect() ); |
|
335 |
|
336 // right end of the slider when that part is unselected |
|
337 sliderRightEndLayout.LayoutRect(progressBGLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_bg_pane_g1()); |
|
338 iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon, sliderRightEndLayout.Rect() ); |
|
339 |
|
340 } |
|
341 else |
|
342 { |
|
343 // left end of the slider when that part is unselected |
|
344 sliderLeftEndLayout.LayoutRect( progressBGLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_bg_pane_g1()); |
|
345 iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, sliderLeftEndLayout.Rect() ); |
|
346 |
|
347 // right end of the slider when that part is unselected |
|
348 sliderRightEndLayout.LayoutRect(progressBGLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_bg_pane_g2()); |
|
349 iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon, sliderRightEndLayout.Rect() ); |
|
350 } |
|
351 |
|
352 // middle part of the slider when that part is unselected |
|
353 TAknLayoutRect sliderMiddleLayout; |
|
354 sliderMiddleLayout.LayoutRect(progressBGLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_bg_pane_g3()); |
|
355 iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderMiddleIcon, sliderMiddleLayout.Rect() ); |
|
356 |
|
357 // middle part of the cut selection slider |
|
358 TAknLayoutRect sliderSelectedMiddleLayout; |
|
359 sliderSelectedMiddleLayout.LayoutRect(progressBGLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_bg_pane_g3()); |
|
360 iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderSelectedMiddleIcon, sliderSelectedMiddleLayout.Rect() ); |
|
361 |
|
362 // playhead |
|
363 TAknLayoutRect playheadLayout; |
|
364 playheadLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_pane_g3()); |
|
365 iCutVideoBar->SetComponentRect( CVeiCutterBar::EPlayheadIcon, playheadLayout.Rect() ); |
|
366 |
|
367 // left/right border of cut selection slider |
|
368 TAknLayoutRect cutAreaBorderLayout; |
|
369 cutAreaBorderLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_pane_g1()); |
|
370 iCutVideoBar->SetComponentRect( CVeiCutterBar::EStartMarkIcon, cutAreaBorderLayout.Rect() ); |
|
371 cutAreaBorderLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_pane_g2()); |
|
372 iCutVideoBar->SetComponentRect( CVeiCutterBar::EEndMarkIcon, cutAreaBorderLayout.Rect() ); |
|
373 |
|
374 // Video Display |
|
375 TAknLayoutRect videoDisplayLayout; |
|
376 videoDisplayLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::vded_video_pane()); |
|
377 iVideoDisplay->SetRect(videoDisplayLayout.Rect()); |
|
378 |
|
379 iDisplayRect = videoDisplayLayout.Rect(); |
|
380 iIconDisplayRect = videoDisplayLayout.Rect(); |
|
381 LOGFMT2(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SizeChanged(): iDisplayRect: %d,%d", iDisplayRect.iBr.iX, iDisplayRect.iBr.iY); |
|
382 |
|
383 // CVeiCutterBar |
|
384 TRect cutBarRect( progressBarLayout.Rect().iTl, progressBarLayout.Rect().iBr ); |
|
385 iCutVideoBar->SetRect( cutBarRect ); |
|
386 |
|
387 // pause icon |
|
388 TAknLayoutRect iconLayout; |
|
389 iconLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::main_vded2_pane_g2(variety)); |
|
390 iIconDisplayRect = iconLayout.Rect(); |
|
391 AknIconUtils::SetSize( iPlayBitmap, iIconDisplayRect.Size(), EAspectRatioNotPreserved ); |
|
392 AknIconUtils::SetSize( iPauseBitmap, iIconDisplayRect.Size(), EAspectRatioNotPreserved ); |
|
393 |
|
394 // cut bar touch areas |
|
395 TAknLayoutRect touchAreaLayout; |
|
396 touchAreaLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::aid_size_touch_vded2_playhead()); |
|
397 iCutVideoBar->SetComponentRect( CVeiCutterBar::EPlayheadTouch, touchAreaLayout.Rect() ); |
|
398 touchAreaLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::aid_size_touch_vded2_start()); |
|
399 iCutVideoBar->SetComponentRect( CVeiCutterBar::EStartMarkTouch, touchAreaLayout.Rect() ); |
|
400 touchAreaLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::aid_size_touch_vded2_end()); |
|
401 iCutVideoBar->SetComponentRect( CVeiCutterBar::EEndMarkTouch, touchAreaLayout.Rect() ); |
|
402 } |
|
403 |
|
404 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SizeChanged(): Out"); |
|
405 } |
|
406 |
|
407 TTypeUid::Ptr CVeiSimpleCutVideoContainer::MopSupplyObject( TTypeUid aId ) |
|
408 { |
|
409 if ( aId.iUid == MAknsControlContext::ETypeId && iBgContext ) |
|
410 { |
|
411 return MAknsControlContext::SupplyMopObject( aId, iBgContext ); |
|
412 } |
|
413 return CCoeControl::MopSupplyObject( aId ); |
|
414 } |
|
415 |
|
416 TInt CVeiSimpleCutVideoContainer::CountComponentControls() const |
|
417 { |
|
418 if( !AknLayoutUtils::PenEnabled() ) |
|
419 { |
|
420 return 3; |
|
421 } |
|
422 else |
|
423 { |
|
424 return 2; |
|
425 } |
|
426 } |
|
427 |
|
428 CCoeControl* CVeiSimpleCutVideoContainer::ComponentControl( TInt aIndex ) const |
|
429 { |
|
430 switch ( aIndex ) |
|
431 { |
|
432 case 0: |
|
433 return iCutVideoBar; |
|
434 case 1: |
|
435 return iVideoDisplay; |
|
436 case 2: |
|
437 return iCutTimeDisplay; |
|
438 default: |
|
439 return NULL; |
|
440 } |
|
441 } |
|
442 |
|
443 void CVeiSimpleCutVideoContainer::Draw( const TRect& aRect ) const |
|
444 { |
|
445 CWindowGc& gc = SystemGc(); |
|
446 // draw skin background |
|
447 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
448 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
449 AknsDrawUtils::Background( skin, cc, this, gc, aRect ); |
|
450 |
|
451 if ( EStatePlaying != iState && EStatePlayingMenuOpen != iState |
|
452 && AknLayoutUtils::PenEnabled() ) |
|
453 { |
|
454 gc.BitBltMasked( iIconDisplayRect.iTl, iPlayBitmap, |
|
455 TRect(iIconDisplayRect.Size()), |
|
456 iPlayBitmapMask, EFalse ); |
|
457 } |
|
458 else if ( ( EStatePlaying == iState || EStatePlayingMenuOpen == iState ) |
|
459 && AknLayoutUtils::PenEnabled() ) |
|
460 { |
|
461 gc.BitBltMasked( iIconDisplayRect.iTl, iPauseBitmap, |
|
462 TRect(iIconDisplayRect.Size()), |
|
463 iPauseBitmapMask, EFalse ); |
|
464 } |
|
465 |
|
466 if ( EStatePaused == iState && !AknLayoutUtils::PenEnabled() ) |
|
467 { |
|
468 TPoint pauseIconTl = TPoint( iIconDisplayRect.iTl.iX - STATIC_CAST( TInt, Rect().iBr.iX*0.105), |
|
469 iIconDisplayRect.iTl.iY + STATIC_CAST( TInt, Rect().iBr.iY*0.178 )); |
|
470 gc.BitBltMasked( pauseIconTl, iPauseBitmap, |
|
471 TRect( TPoint(0,0), iPauseBitmap->SizeInPixels() ), |
|
472 iPauseBitmapMask, EFalse ); |
|
473 } |
|
474 } |
|
475 |
|
476 // ---------------------------------------------------------------------------- |
|
477 // CVeiSimpleCutVideoContainer::GetHelpContext(...) const |
|
478 // |
|
479 // Gets the control's help context. Associates the control with a particular |
|
480 // Help file and topic in a context sensitive application. |
|
481 // ---------------------------------------------------------------------------- |
|
482 // |
|
483 void CVeiSimpleCutVideoContainer::GetHelpContext( TCoeHelpContext& aContext ) const |
|
484 { |
|
485 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetHelpContext(): In"); |
|
486 |
|
487 // Set UID of the CS Help file (same as application UID). |
|
488 aContext.iMajor = KUidVideoEditor; |
|
489 |
|
490 // Set the context/topic. |
|
491 aContext.iContext = KVIE_HLP_CUT; |
|
492 |
|
493 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetHelpContext(): Out"); |
|
494 } |
|
495 |
|
496 |
|
497 void CVeiSimpleCutVideoContainer::HandleControlEventL( |
|
498 CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) |
|
499 { |
|
500 } |
|
501 |
|
502 // ---------------------------------------------------------------------------- |
|
503 // CVeiSimpleCutVideoContainer::HandlePointerEventL |
|
504 // From CCoeControl |
|
505 // ---------------------------------------------------------------------------- |
|
506 // |
|
507 void CVeiSimpleCutVideoContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent ) |
|
508 { |
|
509 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandlePointerEventL(): In"); |
|
510 if( AknLayoutUtils::PenEnabled() && iCutVideoBar ) |
|
511 { |
|
512 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
513 |
|
514 switch( aPointerEvent.iType ) |
|
515 { |
|
516 case TPointerEvent::EButton1Down: |
|
517 { |
|
518 iButtonDownPoint = aPointerEvent.iPosition; |
|
519 iIsMarkDrag = EFalse; |
|
520 iIsMarkTapped = EFalse; |
|
521 iIsIconOrDisplayTapped = EFalse; |
|
522 TRect startMarkRect = iCutVideoBar->StartMarkRect(); |
|
523 TRect endMarkRect = iCutVideoBar->EndMarkRect(); |
|
524 TRect playheadRect = iCutVideoBar->PlayHeadRect(); |
|
525 // check if the pen goes down inside the start mark |
|
526 if (startMarkRect.Contains(aPointerEvent.iPosition)) |
|
527 { |
|
528 iIsMarkTapped = ETrue; |
|
529 iTappedMark = EStartMark; |
|
530 iCutVideoBar->SetPressedComponent( CVeiCutterBar::EPressedStartMarkTouch ); |
|
531 } |
|
532 // check if the pen goes down inside the end mark |
|
533 else if (endMarkRect.Contains(aPointerEvent.iPosition)) |
|
534 { |
|
535 iIsMarkTapped = ETrue; |
|
536 iTappedMark = EEndMark; |
|
537 iCutVideoBar->SetPressedComponent( CVeiCutterBar::EPressedEndMarkTouch ); |
|
538 } |
|
539 // check if the pen goes down inside the playhead |
|
540 else if (playheadRect.Contains(aPointerEvent.iPosition)) |
|
541 { |
|
542 iIsMarkTapped = ETrue; |
|
543 iTappedMark = EPlayHead; |
|
544 iCutVideoBar->SetPressedComponent( CVeiCutterBar::EPressedPlayheadTouch ); |
|
545 } |
|
546 else if ( iDisplayRect.Contains( iButtonDownPoint ) || |
|
547 iIconDisplayRect.Contains( iButtonDownPoint ) ) |
|
548 { |
|
549 iIsIconOrDisplayTapped = ETrue; |
|
550 } |
|
551 |
|
552 if ( iIsMarkTapped ) |
|
553 { |
|
554 DrawDeferred(); |
|
555 } |
|
556 |
|
557 #ifdef RD_TACTILE_FEEDBACK |
|
558 if ( iTouchFeedBack && ( iIsMarkTapped || iIsIconOrDisplayTapped )) |
|
559 { |
|
560 iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic ); |
|
561 } |
|
562 #endif /* RD_TACTILE_FEEDBACK */ |
|
563 |
|
564 // TRect progressBarRect(iCutVideoBar->ProgressBarRect()); |
|
565 // check if the pen goes down inside the progress bar |
|
566 // if( progressBarRect.Contains( aPointerEvent.iPosition ) ) |
|
567 // { |
|
568 // iIsMarkDrag = EFalse; |
|
569 // } |
|
570 break; |
|
571 } |
|
572 case TPointerEvent::EDrag: |
|
573 { |
|
574 if (iIsMarkTapped) |
|
575 { |
|
576 TRect touchRect(iCutVideoBar->ProgressBarRect()); |
|
577 TRect smallRect(iCutVideoBar->EndMarkRect()); |
|
578 TInt pressPoint = aPointerEvent.iPosition.iX; |
|
579 TBool dragMarks = ETrue; |
|
580 if (iTappedMark == EStartMark) |
|
581 { |
|
582 pressPoint += iCutVideoBar->StartMarkRect().Width()/2; |
|
583 } |
|
584 if (iTappedMark == EEndMark) |
|
585 { |
|
586 pressPoint -= iCutVideoBar->StartMarkRect().Width()/2; |
|
587 } |
|
588 if (iTappedMark == EPlayHead) |
|
589 { |
|
590 smallRect = iCutVideoBar->PlayHeadRect(); |
|
591 dragMarks = EFalse; |
|
592 } |
|
593 touchRect.iTl.iY = smallRect.iTl.iY; |
|
594 touchRect.iBr.iY = smallRect.iBr.iY; |
|
595 HandleProgressBarTouchL( touchRect, |
|
596 pressPoint, |
|
597 dragMarks, |
|
598 iTappedMark ); |
|
599 iIsMarkDrag = ETrue; |
|
600 } |
|
601 break; |
|
602 } |
|
603 case TPointerEvent::EButton1Up: |
|
604 { |
|
605 // pen up event is handled if it wasn't dragged |
|
606 // if (!iIsMarkDrag) |
|
607 if (0) |
|
608 { |
|
609 TRect progressBarRect(iCutVideoBar->ProgressBarRect()); |
|
610 // Check if pressed position is in progress bar's rect |
|
611 if( progressBarRect.Contains( aPointerEvent.iPosition ) ) |
|
612 { |
|
613 HandleProgressBarTouchL( progressBarRect, |
|
614 aPointerEvent.iPosition.iX, |
|
615 EFalse); |
|
616 } |
|
617 } |
|
618 |
|
619 if ((iDisplayRect.Contains(aPointerEvent.iPosition) && |
|
620 iDisplayRect.Contains(iButtonDownPoint)) || |
|
621 (iIconDisplayRect.Contains(aPointerEvent.iPosition) && |
|
622 iIconDisplayRect.Contains(iButtonDownPoint))) |
|
623 { |
|
624 HandleVideoClickedL(); |
|
625 } |
|
626 iCutVideoBar->SetPressedComponent( CVeiCutterBar::ENoPressedIcon ); |
|
627 DrawDeferred(); |
|
628 break; |
|
629 } |
|
630 default: |
|
631 { |
|
632 break; |
|
633 } |
|
634 } |
|
635 } |
|
636 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandlePointerEventL(): Out"); |
|
637 } |
|
638 |
|
639 |
|
640 // ---------------------------------------------------------------------------- |
|
641 // CVeiSimpleCutVideoContainer::HandleProgressBarTouchL |
|
642 // |
|
643 // ---------------------------------------------------------------------------- |
|
644 // |
|
645 void CVeiSimpleCutVideoContainer::HandleProgressBarTouchL( TRect aPBRect, |
|
646 TInt aPressedPoint, |
|
647 TBool aDragMarks, |
|
648 CVeiSimpleCutVideoContainer::TCutMark aCutMark ) |
|
649 { |
|
650 if ( (AknLayoutUtils::PenEnabled()) && ( iState!=EStateInitializing )) |
|
651 { |
|
652 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandleProgressBarTouchL(): In"); |
|
653 |
|
654 if (iState == EStatePlaying) |
|
655 { |
|
656 PauseL(); |
|
657 } |
|
658 |
|
659 // Progress Bar start and end points, and length |
|
660 TInt pbEndPoint( aPBRect.iBr.iX ); |
|
661 TInt pbStartPoint = ( aPBRect.iTl.iX ); |
|
662 TInt totalPBLength( pbEndPoint - pbStartPoint ); |
|
663 |
|
664 // calculate the time position from the tapped progress bar coordinates |
|
665 TTimeIntervalMicroSeconds newPosition( |
|
666 ( ( aPressedPoint - pbStartPoint ) * |
|
667 iVideoClipInfo->Duration().Int64() ) / |
|
668 totalPBLength ); |
|
669 if (newPosition >= iVideoClipInfo->Duration()) |
|
670 { |
|
671 newPosition = TTimeIntervalMicroSeconds( iVideoClipInfo->Duration().Int64() - 1 ); |
|
672 } |
|
673 if (newPosition <= 0) |
|
674 { |
|
675 newPosition = 0; |
|
676 } |
|
677 |
|
678 TBool movePlayhead = ETrue; |
|
679 |
|
680 // move cut marks |
|
681 if (aDragMarks) |
|
682 { |
|
683 movePlayhead = EFalse; |
|
684 //one sec buffer: |
|
685 const TUint markBuffer = ((KMinCutVideoLength * totalPBLength) / iVideoClipInfo->Duration().Int64()); |
|
686 // check that the start mark doesn't go past the end mark - 1 sec buffer |
|
687 // and not to the beginning |
|
688 if ((aCutMark == EStartMark) && |
|
689 (newPosition.Int64() >= 0) && |
|
690 (aPressedPoint < (iCutVideoBar->EndMarkPoint() - markBuffer ) /*- 2*iCutVideoBar->EndMarkRect().Width()*/)) |
|
691 { |
|
692 iView.MoveStartOrEndMarkL(newPosition, EStartMark); |
|
693 iCutVideoBar->SetInPoint( newPosition ); |
|
694 movePlayhead = ETrue; |
|
695 } |
|
696 // check that the end mark doesn't go before the start mark - +1 sec buffer |
|
697 // and not too close to the beginning |
|
698 else if ((aCutMark == EEndMark) && |
|
699 (newPosition.Int64() >= KMinCutVideoLength) && |
|
700 (aPressedPoint > (iCutVideoBar->StartMarkPoint() + markBuffer)/* + 2*iCutVideoBar->StartMarkRect().Width()*/)) |
|
701 { |
|
702 iView.MoveStartOrEndMarkL(newPosition, EEndMark); |
|
703 iCutVideoBar->SetOutPoint( newPosition ); |
|
704 movePlayhead = ETrue; |
|
705 } |
|
706 } |
|
707 |
|
708 // move playhead |
|
709 // else if (( newPosition != iLastPosition ) && !aDragMarks) |
|
710 if (( newPosition != iLastPosition ) && movePlayhead) |
|
711 { |
|
712 iLastPosition = newPosition; |
|
713 |
|
714 iSeekPos = TTimeIntervalMicroSeconds( newPosition ); |
|
715 |
|
716 iCutVideoBar->SetCurrentPoint( (static_cast<TInt32>(iSeekPos.Int64() / 1000))); |
|
717 iVideoDisplay->SetPositionL( iSeekPos ); |
|
718 GetThumbAtL( iSeekPos ); |
|
719 |
|
720 iView.UpdateTimeL(); |
|
721 } |
|
722 |
|
723 iView.UpdateCBAL(iState); |
|
724 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandleProgressBarTouchL(): Out"); |
|
725 |
|
726 }// PenEnabled |
|
727 |
|
728 } |
|
729 |
|
730 |
|
731 void CVeiSimpleCutVideoContainer::PlayL( const TDesC& aFilename ) |
|
732 { |
|
733 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::PlayL: in"); |
|
734 iVideoDisplay->SetPositionL( iSeekPos ); |
|
735 |
|
736 if (iVideoClipInfo && !iFrameReady) |
|
737 { |
|
738 iVideoClipInfo->CancelFrame(); |
|
739 } |
|
740 iVideoDisplay->PlayL( aFilename ); |
|
741 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::PlayL: out"); |
|
742 } |
|
743 |
|
744 void CVeiSimpleCutVideoContainer::PlayMarkedL( const TDesC& aFilename, |
|
745 const TTimeIntervalMicroSeconds& aStartTime, |
|
746 const TTimeIntervalMicroSeconds& aEndTime ) |
|
747 { |
|
748 LOGFMT3(KVideoEditorLogFile, "CVeisimpleCutVideoContainer::PlayMarkedL, In, aStartTime:%Ld, aEndTime:%Ld, aFilename:%S", aStartTime.Int64(), aEndTime.Int64(), &aFilename); |
|
749 iPlayOrPlayMarked = ETrue; |
|
750 |
|
751 if (iVideoClipInfo && !iFrameReady) |
|
752 { |
|
753 iVideoClipInfo->CancelFrame(); |
|
754 } |
|
755 iVideoDisplay->PlayL( aFilename, aStartTime, aEndTime ); |
|
756 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::PlayMarkedL, Out"); |
|
757 } |
|
758 |
|
759 void CVeiSimpleCutVideoContainer::StopL() |
|
760 { |
|
761 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::StopL, in"); |
|
762 iVideoDisplay->Stop( EFalse ); |
|
763 |
|
764 iSeekPos = TTimeIntervalMicroSeconds( 0 ); |
|
765 |
|
766 // When adding a new video clip after saving, PlaybackPositionL() |
|
767 // returns a value > 0 eventhough the playhead is in the beginning |
|
768 // so iLastPosition has to be set to the beginning. |
|
769 iLastPosition = TTimeIntervalMicroSeconds( 0 ); |
|
770 |
|
771 SetStateL( EStateStopped ); |
|
772 PlaybackPositionL(); |
|
773 |
|
774 if (iVideoBarTimer) |
|
775 { |
|
776 iVideoBarTimer->Cancel(); |
|
777 } |
|
778 |
|
779 iCutVideoBar->SetFinishedStatus( ETrue ); |
|
780 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::StopL, in"); |
|
781 } |
|
782 |
|
783 |
|
784 void CVeiSimpleCutVideoContainer::TakeSnapshotL() |
|
785 { |
|
786 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::TakeSnapshotL in"); |
|
787 |
|
788 if( !iVideoClipInfo || !iFrameReady ) |
|
789 { |
|
790 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::TakeSnapshotL: 1"); |
|
791 if (!iFrameReady) |
|
792 { |
|
793 iTakeSnapshotWaiting = ETrue; |
|
794 } |
|
795 return; |
|
796 } |
|
797 |
|
798 iTakeSnapshotWaiting = EFalse; |
|
799 iTakeSnapshot = ETrue; |
|
800 const TTimeIntervalMicroSeconds& pos = PlaybackPositionL(); |
|
801 |
|
802 GetThumbAtL( pos ); |
|
803 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::TakeSnapshotL out"); |
|
804 } |
|
805 |
|
806 void CVeiSimpleCutVideoContainer::PauseL( TBool aUpdateCBA ) |
|
807 { |
|
808 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::PauseL: In"); |
|
809 |
|
810 if (EStatePlaying == iState) |
|
811 { |
|
812 iLastPosition = iVideoDisplay->PositionL(); |
|
813 iSeekPos = iLastPosition; |
|
814 // to set next start point |
|
815 iVideoDisplay->SetPositionL(iSeekPos); |
|
816 } |
|
817 |
|
818 iVideoDisplay->PauseL(); |
|
819 if (iVideoBarTimer) |
|
820 { |
|
821 iVideoBarTimer->Cancel(); |
|
822 } |
|
823 |
|
824 #ifdef GET_PAUSE_THUMBNAIL |
|
825 GetThumbAtL( iLastPosition ); |
|
826 #endif |
|
827 |
|
828 if (EStateStoppedInitial == iState || EStateStopped == iState) |
|
829 { |
|
830 // just to trigger cba-update |
|
831 SetStateL( iState, aUpdateCBA ); |
|
832 } |
|
833 else if (EStateInitializing != iState) |
|
834 { |
|
835 SetStateL( EStatePaused, aUpdateCBA ); |
|
836 } |
|
837 else |
|
838 { |
|
839 SetStateL( EStateStoppedInitial ); |
|
840 } |
|
841 |
|
842 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::PauseL: Out"); |
|
843 } |
|
844 |
|
845 void CVeiSimpleCutVideoContainer::SaveSnapshotL() |
|
846 { |
|
847 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SaveSnapshotL: In"); |
|
848 |
|
849 if (LaunchSavingDialogsL()) |
|
850 { |
|
851 //first we have to encode bitmap |
|
852 // get encoder types |
|
853 RImageTypeDescriptionArray imageTypes; |
|
854 iConverter->GetEncoderImageTypesL( imageTypes ); |
|
855 |
|
856 CleanupStack::PushL( TCleanupItem( CleanupRarray, &imageTypes ) ); |
|
857 |
|
858 TInt selectedIdx = 0; |
|
859 |
|
860 for( TInt i=0; i<imageTypes.Count(); i++ ) |
|
861 { |
|
862 if ( imageTypes[i]->Description() == KEncoderType ) |
|
863 { |
|
864 selectedIdx = i; |
|
865 } |
|
866 } |
|
867 |
|
868 //for cancellation |
|
869 if ( iSaveToFileName ) |
|
870 { |
|
871 delete iSaveToFileName; |
|
872 iSaveToFileName = NULL; |
|
873 } |
|
874 iSaveToFileName = HBufC::NewL( iSnapshotFileName.Length() ); |
|
875 *iSaveToFileName = iSnapshotFileName; |
|
876 |
|
877 // request the actuall save/encode |
|
878 // asynchronous, the result is reported via callback NotifyCompletion |
|
879 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SaveSnapshotL: 1, calling iConverter->StartToEncodeL"); |
|
880 iConverter->StartToEncodeL( iSnapshotFileName, |
|
881 imageTypes[selectedIdx]->ImageType(), imageTypes[selectedIdx]->SubType()); |
|
882 |
|
883 CleanupStack::PopAndDestroy( &imageTypes ); |
|
884 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SaveSnapshotL: Out"); |
|
885 |
|
886 ShowProgressNoteL(); |
|
887 } |
|
888 } |
|
889 |
|
890 |
|
891 TBool CVeiSimpleCutVideoContainer::LaunchSavingDialogsL() |
|
892 { |
|
893 TBool ret = EFalse; |
|
894 RFs fs = CCoeEnv::Static()->FsSession(); |
|
895 |
|
896 iSnapshotFileName.Zero(); |
|
897 iSnapshotFileName.Append( iView.Settings().DefaultSnapshotName() ); |
|
898 iSnapshotFileName.Append( _L(".JPEG") ); |
|
899 |
|
900 // Multiple drive support |
|
901 #ifdef RD_MULTIPLE_DRIVE |
|
902 TDriveNumber driveNumber; |
|
903 TFileName driveAndPath; |
|
904 CAknMemorySelectionDialogMultiDrive* multiDriveDlg = |
|
905 CAknMemorySelectionDialogMultiDrive::NewL(ECFDDialogTypeSave, EFalse ); |
|
906 |
|
907 CleanupStack::PushL(multiDriveDlg); |
|
908 |
|
909 // launch "Select memory" query |
|
910 if (multiDriveDlg->ExecuteL( driveNumber, &driveAndPath, NULL )) |
|
911 { |
|
912 driveAndPath.Append( PathInfo::ImagesPath() ); |
|
913 |
|
914 iSnapshotFileName.Insert(0,driveAndPath); |
|
915 |
|
916 // Generate a default name for the new file |
|
917 CApaApplication::GenerateFileName( fs, iSnapshotFileName ); |
|
918 |
|
919 // launch file name prompt dialog |
|
920 if (CAknFileNamePromptDialog::RunDlgLD(iSnapshotFileName, driveAndPath, KNullDesC)) |
|
921 { |
|
922 driveAndPath.Append(iSnapshotFileName); |
|
923 iSnapshotFileName = driveAndPath; |
|
924 ret = ETrue; |
|
925 } |
|
926 else |
|
927 { |
|
928 iTakeSnapshot = EFalse; |
|
929 iTakeSnapshotWaiting = EFalse; |
|
930 } |
|
931 } |
|
932 else |
|
933 { |
|
934 iTakeSnapshot = EFalse; |
|
935 iTakeSnapshotWaiting = EFalse; |
|
936 } |
|
937 CleanupStack::PopAndDestroy( multiDriveDlg ); |
|
938 #else // no multiple drive support |
|
939 CAknMemorySelectionDialog::TMemory selectedMemory(CAknMemorySelectionDialog::EPhoneMemory); |
|
940 // launch "Select memory" query |
|
941 if (CAknMemorySelectionDialog::RunDlgLD(selectedMemory)) |
|
942 { |
|
943 // create path for the image |
|
944 TFileName driveAndPath; |
|
945 if (selectedMemory == CAknMemorySelectionDialog::EPhoneMemory) |
|
946 { |
|
947 driveAndPath.Copy( PathInfo::PhoneMemoryRootPath() ); |
|
948 driveAndPath.Append( PathInfo::ImagesPath() ); |
|
949 } |
|
950 else if (selectedMemory == CAknMemorySelectionDialog::EMemoryCard) |
|
951 { |
|
952 driveAndPath.Copy( PathInfo::MemoryCardRootPath() ); |
|
953 driveAndPath.Append( PathInfo::ImagesPath() ); |
|
954 } |
|
955 |
|
956 iSnapshotFileName.Insert(0,driveAndPath); |
|
957 |
|
958 // Generate a default name for the new file |
|
959 CApaApplication::GenerateFileName( fs, iSnapshotFileName ); |
|
960 |
|
961 // launch file name prompt dialog |
|
962 if (CAknFileNamePromptDialog::RunDlgLD(iSnapshotFileName, driveAndPath, KNullDesC)) |
|
963 { |
|
964 driveAndPath.Append(iSnapshotFileName); |
|
965 iSnapshotFileName = driveAndPath; |
|
966 ret = ETrue; |
|
967 } |
|
968 else |
|
969 { |
|
970 iTakeSnapshot = EFalse; |
|
971 iTakeSnapshotWaiting = EFalse; |
|
972 } |
|
973 } |
|
974 else |
|
975 { |
|
976 iTakeSnapshot = EFalse; |
|
977 iTakeSnapshotWaiting = EFalse; |
|
978 } |
|
979 #endif |
|
980 return ret; |
|
981 } |
|
982 |
|
983 void CVeiSimpleCutVideoContainer::CancelSnapshotSave() |
|
984 { |
|
985 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::CancelSnapshotSave: in"); |
|
986 if ( iConverter ) |
|
987 { |
|
988 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::CancelSnapshotSave: 1"); |
|
989 iConverter->Cancel(); |
|
990 iConverter->CancelEncoding(); //also close the file |
|
991 } |
|
992 if ( iSaveToFileName ) |
|
993 { |
|
994 LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::CancelSnapshotSave: 2, iSaveToFileName:%S", iSaveToFileName); |
|
995 |
|
996 RFs& fs = iEikonEnv->FsSession(); |
|
997 /*TInt result =*/ fs.Delete( *iSaveToFileName ); |
|
998 delete iSaveToFileName; |
|
999 iSaveToFileName = NULL; |
|
1000 } |
|
1001 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::CancelSnapshotSave: out"); |
|
1002 } |
|
1003 |
|
1004 void CVeiSimpleCutVideoContainer::CloseStreamL() |
|
1005 { |
|
1006 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::CloseStreamL, in"); |
|
1007 if( !iFrameReady && iVideoClipInfo ) |
|
1008 { |
|
1009 iVideoClipInfo->CancelFrame(); |
|
1010 } |
|
1011 PlaybackPositionL(); |
|
1012 iState = EStateStopped; |
|
1013 iView.UpdateCBAL(iState); |
|
1014 |
|
1015 iVideoDisplay->Stop( ETrue ); |
|
1016 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::CloseStreamL, out"); |
|
1017 } |
|
1018 |
|
1019 void CVeiSimpleCutVideoContainer::SetInTime( const TTimeIntervalMicroSeconds& aTime ) |
|
1020 { |
|
1021 if ( iCutTimeDisplay ) |
|
1022 { |
|
1023 iCutTimeDisplay->SetCutIn( aTime ); |
|
1024 } |
|
1025 if ( iCutVideoBar ) |
|
1026 { |
|
1027 iCutVideoBar->SetInPoint( aTime ); |
|
1028 } |
|
1029 } |
|
1030 |
|
1031 void CVeiSimpleCutVideoContainer::SetOutTime( const TTimeIntervalMicroSeconds& aTime ) |
|
1032 { |
|
1033 if ( iCutTimeDisplay ) |
|
1034 { |
|
1035 iCutTimeDisplay->SetCutOut( aTime ); |
|
1036 } |
|
1037 if ( iCutVideoBar ) |
|
1038 { |
|
1039 iCutVideoBar->SetOutPoint( aTime ); |
|
1040 } |
|
1041 } |
|
1042 |
|
1043 TTimeIntervalMicroSeconds CVeiSimpleCutVideoContainer::PlaybackPositionL() |
|
1044 { |
|
1045 if ( ( iSeeking ) || ( EStateStopped == iState ) ) |
|
1046 { |
|
1047 return iSeekPos; |
|
1048 } |
|
1049 if ( iState != EStatePlaying ) |
|
1050 { |
|
1051 return iLastPosition; |
|
1052 } |
|
1053 |
|
1054 if ( iVideoClipInfo && (iVideoDisplay->PositionL() < iVideoClipInfo->Duration()) ) |
|
1055 { |
|
1056 iLastPosition = iVideoDisplay->PositionL(); |
|
1057 } |
|
1058 |
|
1059 if ( ( iLastPosition == TTimeIntervalMicroSeconds( 0 ) ) && |
|
1060 ( iSeekPos != TTimeIntervalMicroSeconds( 0 ) ) ) |
|
1061 { |
|
1062 return iSeekPos; |
|
1063 } |
|
1064 |
|
1065 return iLastPosition; |
|
1066 } |
|
1067 |
|
1068 TKeyResponse CVeiSimpleCutVideoContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
|
1069 { |
|
1070 if ( aType == EEventKeyDown ) |
|
1071 { |
|
1072 iKeyRepeatCount = 0; |
|
1073 if(aKeyEvent.iScanCode == EStdKeyDevice7) //for camera key |
|
1074 { |
|
1075 PauseL(ETrue); |
|
1076 } |
|
1077 TBool shiftKeyPressed = (aKeyEvent.iModifiers & EModifierShift ); |
|
1078 if( shiftKeyPressed ) |
|
1079 { |
|
1080 if( iView.IsEnoughFreeSpaceToSaveL() && (iTakeSnapshot == EFalse )) |
|
1081 { |
|
1082 /*if (EStatePlaying == iState) |
|
1083 { |
|
1084 PauseL(); |
|
1085 } |
|
1086 */ |
|
1087 TakeSnapshotL(); |
|
1088 } |
|
1089 return EKeyWasConsumed; |
|
1090 } |
|
1091 |
|
1092 return EKeyWasNotConsumed; |
|
1093 } |
|
1094 else if ( aType == EEventKeyUp ) |
|
1095 { |
|
1096 if ( iSeeking == EFalse ) |
|
1097 { |
|
1098 return EKeyWasNotConsumed; |
|
1099 } |
|
1100 iLastPosition = iSeekPos; |
|
1101 iVideoDisplay->SetPositionL( iSeekPos ); |
|
1102 |
|
1103 iSeeking = EFalse; |
|
1104 |
|
1105 if ( ( ( EStateStopped == iState ) || ( EStateStoppedInitial == iState ) |
|
1106 || ( EStatePaused == iState )) && |
|
1107 ( ( iLastKeyCode == EKeyLeftArrow ) || ( iLastKeyCode == EKeyRightArrow ) ) ) |
|
1108 { |
|
1109 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::OfferKeyEventL: 1, calling GetThumbAtL()"); |
|
1110 GetThumbAtL( iSeekPos ); |
|
1111 return EKeyWasConsumed; |
|
1112 } |
|
1113 else if ( EStatePlaying == iState ) |
|
1114 { |
|
1115 if ( iVideoBarTimer->IsActive() ) |
|
1116 { |
|
1117 iVideoBarTimer->Cancel(); |
|
1118 } |
|
1119 |
|
1120 if ( iVideoClipInfo && (iSeekPos >= iVideoClipInfo->Duration()) ) |
|
1121 { |
|
1122 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::OfferKeyEventL: 2, calling iVideoDisplay->Stop"); |
|
1123 iVideoDisplay->Stop( EFalse ); |
|
1124 } |
|
1125 else |
|
1126 { |
|
1127 iVideoDisplay->SetPositionL( iSeekPos ); |
|
1128 iVideoDisplay->ShowBlackScreen(); |
|
1129 if (iVideoClipInfo && !iFrameReady) |
|
1130 { |
|
1131 iVideoClipInfo->CancelFrame(); |
|
1132 } |
|
1133 iVideoDisplay->Play(); |
|
1134 } |
|
1135 return EKeyWasConsumed; |
|
1136 } |
|
1137 else |
|
1138 { |
|
1139 return EKeyWasConsumed; |
|
1140 } |
|
1141 } |
|
1142 else if ( aType == EEventKey ) |
|
1143 { |
|
1144 iLastKeyCode = aKeyEvent.iCode; |
|
1145 |
|
1146 switch (aKeyEvent.iCode) |
|
1147 { |
|
1148 case EKeyEnter: |
|
1149 { |
|
1150 if ( EStateStoppedInitial == iState ) |
|
1151 { |
|
1152 iView.HandleCommandL( EVeiCmdCutVideoViewPlay ); |
|
1153 } |
|
1154 else |
|
1155 { |
|
1156 if ( EStatePlaying == iState || EStatePlayingMenuOpen == iState ) |
|
1157 { |
|
1158 PauseL(); |
|
1159 } |
|
1160 iView.ProcessCommandL( EAknSoftkeyOptions ); |
|
1161 } |
|
1162 return EKeyWasConsumed; |
|
1163 } |
|
1164 case EKeyOK: |
|
1165 { |
|
1166 iView.HandleCommandL( EAknSoftkeyOk ); |
|
1167 return EKeyWasConsumed; |
|
1168 } |
|
1169 case EKeyDownArrow: |
|
1170 case EKeyUpArrow: |
|
1171 { |
|
1172 iVideoDisplay->OfferKeyEventL( aKeyEvent, aType ); |
|
1173 return EKeyWasConsumed; |
|
1174 } |
|
1175 case EKeyRightArrow: |
|
1176 { |
|
1177 iKeyRepeatCount++; |
|
1178 |
|
1179 if ( (iKeyRepeatCount > 2) && (iSeeking == EFalse) ) |
|
1180 { |
|
1181 if ( EStatePlaying == iState ) |
|
1182 { |
|
1183 iSeekPos = iVideoDisplay->PositionL(); |
|
1184 } |
|
1185 |
|
1186 iVideoDisplay->PauseL(); |
|
1187 iSeeking = ETrue; |
|
1188 iKeyRepeatCount = 0; |
|
1189 } |
|
1190 |
|
1191 if ( iSeeking && ( iState!=EStateInitializing ) && |
|
1192 ( iState!=EStatePlayingMenuOpen ) ) |
|
1193 { |
|
1194 TInt adjustment = TimeIncrement( iKeyRepeatCount ); |
|
1195 |
|
1196 TInt64 newPos = iSeekPos.Int64() + adjustment; |
|
1197 if ( iVideoClipInfo && (newPos > iVideoClipInfo->Duration().Int64()) ) |
|
1198 { |
|
1199 newPos = iVideoClipInfo->Duration().Int64(); |
|
1200 } |
|
1201 |
|
1202 iSeekPos = TTimeIntervalMicroSeconds( newPos ); |
|
1203 |
|
1204 iCutVideoBar->SetCurrentPoint( (static_cast<TInt32>(iSeekPos.Int64() / 1000))); |
|
1205 |
|
1206 iView.UpdateTimeL(); |
|
1207 return EKeyWasConsumed; |
|
1208 } |
|
1209 return EKeyWasNotConsumed; |
|
1210 } |
|
1211 |
|
1212 case EKeyLeftArrow: |
|
1213 { |
|
1214 iKeyRepeatCount++; |
|
1215 |
|
1216 if ( (iKeyRepeatCount > 2) && (iSeeking == EFalse) ) |
|
1217 { |
|
1218 |
|
1219 if ( EStatePlaying == iState ) |
|
1220 { |
|
1221 iSeekPos = iVideoDisplay->PositionL(); |
|
1222 } |
|
1223 |
|
1224 iVideoDisplay->PauseL(); |
|
1225 iSeeking = ETrue; |
|
1226 iKeyRepeatCount = 0; |
|
1227 } |
|
1228 |
|
1229 if ( iSeeking && ( iState!=EStateInitializing ) && |
|
1230 ( iState!=EStatePlayingMenuOpen ) ) |
|
1231 { |
|
1232 |
|
1233 TInt adjustment = TimeIncrement( iKeyRepeatCount ); |
|
1234 |
|
1235 TInt64 newPos = iSeekPos.Int64() - adjustment; |
|
1236 if ( newPos < 0 ) |
|
1237 { |
|
1238 newPos = 0; |
|
1239 } |
|
1240 iSeekPos = TTimeIntervalMicroSeconds( newPos ); |
|
1241 |
|
1242 iCutVideoBar->SetCurrentPoint( static_cast<TInt32>((iSeekPos.Int64() / 1000)) ); |
|
1243 |
|
1244 iView.UpdateTimeL(); |
|
1245 |
|
1246 return EKeyWasConsumed; |
|
1247 } |
|
1248 return EKeyWasNotConsumed; |
|
1249 } |
|
1250 case EKeyBackspace: //Clear |
|
1251 { |
|
1252 if (EStatePlaying != iState) |
|
1253 { |
|
1254 iView.ClearInOutL( ETrue, ETrue ); |
|
1255 } |
|
1256 |
|
1257 return EKeyWasConsumed; |
|
1258 } |
|
1259 default: |
|
1260 { |
|
1261 return EKeyWasNotConsumed; |
|
1262 } |
|
1263 } |
|
1264 } |
|
1265 else |
|
1266 { |
|
1267 return EKeyWasNotConsumed; |
|
1268 } |
|
1269 } |
|
1270 |
|
1271 TInt CVeiSimpleCutVideoContainer::TimeIncrement(TInt aKeyCount) const |
|
1272 { |
|
1273 if ( aKeyCount < 3 ) |
|
1274 { |
|
1275 return 100000; |
|
1276 } |
|
1277 else if ( aKeyCount < 4 ) |
|
1278 { |
|
1279 return 300000; |
|
1280 } |
|
1281 else if ( aKeyCount < 5 ) |
|
1282 { |
|
1283 return 500000; |
|
1284 } |
|
1285 else if ( aKeyCount < 10 ) |
|
1286 { |
|
1287 return 1000000; |
|
1288 } |
|
1289 else if ( aKeyCount < 13 ) |
|
1290 { |
|
1291 return 2000000; |
|
1292 } |
|
1293 else if ( aKeyCount < 15 ) |
|
1294 { |
|
1295 return 3000000; |
|
1296 } |
|
1297 else |
|
1298 { |
|
1299 return 5000000; |
|
1300 } |
|
1301 } |
|
1302 |
|
1303 TInt CVeiSimpleCutVideoContainer::UpdateProgressNote() |
|
1304 { |
|
1305 TTime intervalTime; |
|
1306 intervalTime.HomeTime(); |
|
1307 intervalTime += TTimeIntervalMicroSeconds( 50000 ); |
|
1308 TTime currentTime; |
|
1309 currentTime.HomeTime(); |
|
1310 while ( intervalTime > currentTime ) |
|
1311 { |
|
1312 currentTime.HomeTime(); |
|
1313 } |
|
1314 |
|
1315 iProgressDialog->GetProgressInfoL()->IncrementAndDraw( 1 ); |
|
1316 |
|
1317 if ( KProgressbarFinalValue <= iProgressDialog->GetProgressInfoL()->CurrentValue() ) |
|
1318 { |
|
1319 return 0; |
|
1320 } |
|
1321 return 1; |
|
1322 } |
|
1323 |
|
1324 |
|
1325 void CVeiSimpleCutVideoContainer::GetThumbL( const TDesC& aFilename ) |
|
1326 { |
|
1327 if ( iVideoClipInfo ) |
|
1328 { |
|
1329 delete iVideoClipInfo; |
|
1330 iVideoClipInfo = NULL; |
|
1331 } |
|
1332 |
|
1333 /*iVideoClipInfo = */CVedVideoClipInfo::NewL( aFilename, *this ); |
|
1334 } |
|
1335 |
|
1336 |
|
1337 void CVeiSimpleCutVideoContainer::GetThumbAtL( const TTimeIntervalMicroSeconds& aTime ) |
|
1338 { |
|
1339 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetThumbAtL: In"); |
|
1340 if( !iVideoClipInfo ) |
|
1341 { |
|
1342 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetThumbAtL: 1"); |
|
1343 return; |
|
1344 } |
|
1345 if ( !iFrameReady ) |
|
1346 { |
|
1347 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetThumbAtL: 1.5"); |
|
1348 iVideoClipInfo->CancelFrame(); |
|
1349 } |
|
1350 |
|
1351 TRect clipResolution = iVideoClipInfo->Resolution(); |
|
1352 TSize resolution( iVideoDisplay->Size() ); |
|
1353 |
|
1354 TInt frameIndex; |
|
1355 TInt totalFrameCount; |
|
1356 |
|
1357 frameIndex = iVideoClipInfo->GetVideoFrameIndexL( aTime ); |
|
1358 totalFrameCount = iVideoClipInfo->VideoFrameCount(); |
|
1359 |
|
1360 if ( frameIndex > totalFrameCount ) |
|
1361 { |
|
1362 frameIndex = totalFrameCount; |
|
1363 } |
|
1364 |
|
1365 //Generates a thumbnail bitmap of the given frame from video clip |
|
1366 if ( iTakeSnapshot ) |
|
1367 { |
|
1368 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetThumbAtL: 2"); |
|
1369 TDisplayMode displayMode = ENone; |
|
1370 TBool enhance = EFalse; |
|
1371 TSize resol( clipResolution.iBr.iX, clipResolution.iBr.iY ); |
|
1372 /* : |
|
1373 check out on every phone before releasing whether videodisplay should be stopped before starting |
|
1374 asynchronous GetFrameL() |
|
1375 see how EStateGettingFrame is handled in SetPreviewState |
|
1376 Stopping frees memory and it is needed in memory sensible devices |
|
1377 */ |
|
1378 iVideoClipInfo->GetFrameL( *this, frameIndex, &resol ); //, displayMode, enhance ); |
|
1379 SetStateL( EStateGettingFrame ); |
|
1380 iFrameReady = EFalse; |
|
1381 // ShowProgressNoteL(); |
|
1382 } |
|
1383 else |
|
1384 { |
|
1385 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetThumbAtL: 3"); |
|
1386 /* : |
|
1387 check out on every phone before releasing whether videodisplay should be stopped before starting |
|
1388 asynchronous GetFrameL() |
|
1389 see how EStateGettingFrame is handled in SetPreviewState |
|
1390 Stopping frees memory and it is needed in memory sensible devices |
|
1391 */ |
|
1392 TSize resol( clipResolution.iBr.iX, clipResolution.iBr.iY ); |
|
1393 iVideoClipInfo->GetFrameL( *this, frameIndex, &resol ); |
|
1394 SetStateL( EStateGettingFrame ); |
|
1395 iFrameReady = EFalse; |
|
1396 } |
|
1397 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetThumbAtL: out"); |
|
1398 } |
|
1399 |
|
1400 void CVeiSimpleCutVideoContainer::NotifyCompletion( TInt aErr ) |
|
1401 { |
|
1402 LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyCompletion: In, aErr:%d", aErr); |
|
1403 |
|
1404 if (EStateTerminating == iState) |
|
1405 { |
|
1406 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyCompletion(): 1, app is closing..."); |
|
1407 return; |
|
1408 } |
|
1409 |
|
1410 if ( KErrNone == aErr ) |
|
1411 { |
|
1412 //Update notification to Media Gallery |
|
1413 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyCompletion: 2"); |
|
1414 |
|
1415 if (iProgressDialog) |
|
1416 { |
|
1417 TRAP_IGNORE(iProgressDialog->GetProgressInfoL()->SetAndDraw( KProgressbarFinalValue ); |
|
1418 iProgressDialog->ProcessFinishedL()); |
|
1419 } |
|
1420 } |
|
1421 else |
|
1422 { |
|
1423 if (iProgressDialog) |
|
1424 { |
|
1425 TRAP_IGNORE(iProgressDialog->GetProgressInfoL()->SetAndDraw( KProgressbarFinalValue ); |
|
1426 iProgressDialog->ProcessFinishedL()); |
|
1427 } |
|
1428 iErrorUI.ShowGlobalErrorNote( aErr ); |
|
1429 } |
|
1430 |
|
1431 // to eliminate previous (wrong) output file from being deleted in CancelSnapshotSave() |
|
1432 delete iSaveToFileName; |
|
1433 iSaveToFileName = NULL; |
|
1434 |
|
1435 // to fix progress bar shadow |
|
1436 DrawDeferred(); |
|
1437 |
|
1438 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyCompletion: Out"); |
|
1439 } |
|
1440 |
|
1441 void CVeiSimpleCutVideoContainer::NotifyVideoClipInfoReady( CVedVideoClipInfo& aInfo, |
|
1442 TInt aError ) |
|
1443 { |
|
1444 LOGFMT(KVideoEditorLogFile, "CVeisimpleCutVideoContainer::NotifyVideoClipInfoReady, In, aError:%d", aError); |
|
1445 if (KErrNone == aError) |
|
1446 { |
|
1447 if (iVideoClipInfo) |
|
1448 { |
|
1449 delete iVideoClipInfo; |
|
1450 iVideoClipInfo = NULL; |
|
1451 } |
|
1452 iVideoClipInfo = &aInfo; |
|
1453 |
|
1454 TRect clipResolution = iVideoClipInfo->Resolution(); |
|
1455 iDuration = iVideoClipInfo->Duration(); |
|
1456 iCutVideoBar->SetTotalDuration( iDuration ); |
|
1457 iView.DrawTimeNaviL(); |
|
1458 |
|
1459 TSize resolution( clipResolution.iBr.iX, clipResolution.iBr.iY ); |
|
1460 iFrameReady = EFalse; |
|
1461 iVideoClipInfo->GetFrameL( *this, 0, &resolution ); |
|
1462 } |
|
1463 SetStateL( EStateStoppedInitial ); |
|
1464 LOG(KVideoEditorLogFile, "CVeisimpleCutVideoContainer::NotifyVideoClipInfoReady, Out"); |
|
1465 } |
|
1466 |
|
1467 |
|
1468 void CVeiSimpleCutVideoContainer::NotifyVideoClipFrameCompleted(CVedVideoClipInfo& /*aInfo*/, |
|
1469 TInt aError, |
|
1470 CFbsBitmap* aFrame) |
|
1471 { |
|
1472 LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoClipFrameCompleted, In, aError:%d", aError); |
|
1473 iFrameReady = ETrue; |
|
1474 |
|
1475 if (EStateGettingFrame == iState) |
|
1476 { |
|
1477 SetStateL(iPreviousState); |
|
1478 } |
|
1479 |
|
1480 if (KErrNone == aError && aFrame) |
|
1481 { |
|
1482 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoClipFrameCompleted 1"); |
|
1483 |
|
1484 if ( iTakeSnapshot ) |
|
1485 { |
|
1486 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoClipFrameCompleted 2"); |
|
1487 iConverter->SetBitmap( aFrame ); |
|
1488 if (! iCallBackSaveSnapshot) |
|
1489 { |
|
1490 TCallBack cb (CVeiSimpleCutVideoContainer::AsyncSaveSnapshot, this); |
|
1491 iCallBackSaveSnapshot = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard); |
|
1492 } |
|
1493 iCallBackSaveSnapshot->CallBack(); |
|
1494 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoClipFrameCompleted 3"); |
|
1495 } |
|
1496 else |
|
1497 { |
|
1498 LOG(KVideoEditorLogFile, "CVeisimpleCutVideoContainer::NotifyVideoClipFrameCompleted 4"); |
|
1499 TRAP_IGNORE(iVideoDisplay->ShowPictureL( *aFrame )); |
|
1500 delete aFrame; |
|
1501 aFrame = NULL; |
|
1502 |
|
1503 if (iTakeSnapshotWaiting) |
|
1504 { |
|
1505 if (! iCallBackTakeSnapshot) |
|
1506 { |
|
1507 TCallBack cb (CVeiSimpleCutVideoContainer::AsyncTakeSnapshot, this); |
|
1508 iCallBackTakeSnapshot = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard); |
|
1509 } |
|
1510 iCallBackTakeSnapshot->CallBack(); |
|
1511 } |
|
1512 } |
|
1513 } |
|
1514 else |
|
1515 { |
|
1516 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoClipFrameCompleted 5"); |
|
1517 if (aFrame) |
|
1518 { |
|
1519 delete aFrame; |
|
1520 aFrame = NULL; |
|
1521 } |
|
1522 |
|
1523 if (iProgressDialog) |
|
1524 { |
|
1525 iProgressDialog->GetProgressInfoL()->SetAndDraw( KProgressbarFinalValue ); |
|
1526 TRAP_IGNORE(iProgressDialog->ProcessFinishedL()); |
|
1527 } |
|
1528 } |
|
1529 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoClipFrameCompleted, Out"); |
|
1530 } |
|
1531 |
|
1532 TInt CVeiSimpleCutVideoContainer::AsyncSaveSnapshot(TAny* aThis) |
|
1533 { |
|
1534 LOG( KVideoEditorLogFile, "CVeiSimpleCutVideoView::AsyncSaveSnapshot in"); |
|
1535 |
|
1536 // In the asynchronous version, trap the rest of the functions |
|
1537 // to make sure that the caller's TRequestStatus is always |
|
1538 // completed, also in case of failures. |
|
1539 CVeiSimpleCutVideoContainer* container = static_cast<CVeiSimpleCutVideoContainer*>(aThis); |
|
1540 TInt err = KErrNone; |
|
1541 TRAP(err, container->SaveSnapshotL()); |
|
1542 LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::AsyncSaveSnapshot 2, err:%d", err); |
|
1543 |
|
1544 if (KErrNone != err) |
|
1545 { |
|
1546 container->StopProgressDialog(); |
|
1547 container->ShowGlobalErrorNote(err); |
|
1548 } |
|
1549 LOG( KVideoEditorLogFile, "CVeiEditVideoView::AsyncSaveSnapshot 3, returning"); |
|
1550 return KErrNone; |
|
1551 } |
|
1552 |
|
1553 void CVeiSimpleCutVideoContainer::ShowGlobalErrorNote(const TInt aErr) |
|
1554 { |
|
1555 iErrorUI.ShowGlobalErrorNote( aErr ); |
|
1556 } |
|
1557 |
|
1558 void CVeiSimpleCutVideoContainer::StopProgressDialog() |
|
1559 { |
|
1560 if (iProgressDialog) |
|
1561 { |
|
1562 TRAP_IGNORE(iProgressDialog->GetProgressInfoL()->SetAndDraw( KProgressbarFinalValue ); |
|
1563 iProgressDialog->ProcessFinishedL()); |
|
1564 } |
|
1565 } |
|
1566 |
|
1567 void CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent( const TPlayerEvent aEvent, const TInt& aInfo ) |
|
1568 { |
|
1569 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, In"); |
|
1570 |
|
1571 if (EStateTerminating == iState) |
|
1572 { |
|
1573 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent(): 1, app is closing..."); |
|
1574 return; |
|
1575 } |
|
1576 |
|
1577 switch (aEvent) |
|
1578 { |
|
1579 case MVeiVideoDisplayObserver::ELoadingStarted: |
|
1580 { |
|
1581 SetStateL(EStateOpening); |
|
1582 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::ELoadingStarted"); |
|
1583 break; |
|
1584 } |
|
1585 case MVeiVideoDisplayObserver::EOpenComplete: |
|
1586 { |
|
1587 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EOpenComplete 1"); |
|
1588 iVideoDisplay->SetRotationL( EVideoRotationNone ); |
|
1589 TTimeIntervalMicroSeconds cutInTime = iView.GetVideoClipCutInTime(); |
|
1590 TTimeIntervalMicroSeconds cutOutTime = iView.GetVideoClipCutOutTime(); |
|
1591 |
|
1592 if ( iView.IsForeground() ) |
|
1593 { |
|
1594 if (iVideoClipInfo && !iFrameReady) |
|
1595 { |
|
1596 iVideoClipInfo->CancelFrame(); |
|
1597 } |
|
1598 if ( iPlayOrPlayMarked ) |
|
1599 { |
|
1600 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EOpenComplete 2"); |
|
1601 iVideoDisplay->PlayMarkedL( cutInTime, cutOutTime ); |
|
1602 } |
|
1603 else |
|
1604 { |
|
1605 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EOpenComplete 3"); |
|
1606 iVideoDisplay->Play(); |
|
1607 } |
|
1608 iPlayOrPlayMarked = EFalse; |
|
1609 } |
|
1610 else |
|
1611 { |
|
1612 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EOpenComplete 4"); |
|
1613 PauseL(); |
|
1614 } |
|
1615 break; |
|
1616 } |
|
1617 case MVeiVideoDisplayObserver::EBufferingStarted: |
|
1618 { |
|
1619 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EBufferingStarted"); |
|
1620 SetStateL( EStateBuffering ); |
|
1621 if ( iVideoBarTimer ) |
|
1622 { |
|
1623 iVideoBarTimer->Cancel(); |
|
1624 } |
|
1625 break; |
|
1626 } |
|
1627 case MVeiVideoDisplayObserver::ELoadingComplete: |
|
1628 { |
|
1629 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::ELoadingComplete 1"); |
|
1630 // if VED is put to background in the middle of the buffering |
|
1631 // iVideoDisplay->PauseL(); cannot be called during the buffering, so its called here |
|
1632 if (EStatePaused == iState) |
|
1633 { |
|
1634 iVideoDisplay->PauseL(); |
|
1635 } |
|
1636 else |
|
1637 { |
|
1638 SetStateL( EStatePlaying ); |
|
1639 if (iVideoClipInfo && !iFrameReady) |
|
1640 { |
|
1641 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::ELoadingComplete 2"); |
|
1642 iVideoClipInfo->CancelFrame(); |
|
1643 } |
|
1644 if ( !iVideoBarTimer->IsActive() ) |
|
1645 { |
|
1646 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::ELoadingComplete 3"); |
|
1647 const TUint delay = 100000; |
|
1648 iVideoBarTimer->Start( delay, delay, TCallBack( CVeiSimpleCutVideoContainer::DoAudioBarUpdate, this ) ); |
|
1649 } |
|
1650 iVideoDisplay->ShowBlackScreen(); |
|
1651 DrawDeferred(); |
|
1652 } |
|
1653 break; |
|
1654 } |
|
1655 case MVeiVideoDisplayObserver::EPlayComplete: |
|
1656 { |
|
1657 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EPlayComplete"); |
|
1658 iVideoDisplay->SetBlackScreen( EFalse ); |
|
1659 iSeekPos = TTimeIntervalMicroSeconds( 0 ); |
|
1660 |
|
1661 iLastPosition = TotalLength(); |
|
1662 iView.StopNaviPaneUpdateL(); |
|
1663 iCutVideoBar->SetFinishedStatus( ETrue ); |
|
1664 |
|
1665 if (iVideoBarTimer) |
|
1666 { |
|
1667 iVideoBarTimer->Cancel(); |
|
1668 } |
|
1669 |
|
1670 GetThumbAtL(0); |
|
1671 iVideoDisplay->Stop( ETrue ); |
|
1672 SetStateL( EStateStopped ); |
|
1673 |
|
1674 if (KErrNoMemory == aInfo || KErrSessionClosed == aInfo) |
|
1675 { |
|
1676 iErrorUI.ShowGlobalErrorNote( aInfo ); |
|
1677 StopL(); |
|
1678 CloseStreamL(); |
|
1679 } |
|
1680 |
|
1681 DrawDeferred(); |
|
1682 break; |
|
1683 } |
|
1684 case MVeiVideoDisplayObserver::EStop: |
|
1685 { |
|
1686 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EStop"); |
|
1687 |
|
1688 if (EStateGettingFrame == iState) |
|
1689 { |
|
1690 break; |
|
1691 } |
|
1692 |
|
1693 if ( iVideoBarTimer ) |
|
1694 { |
|
1695 iVideoBarTimer->Cancel(); |
|
1696 } |
|
1697 iSeekPos = TTimeIntervalMicroSeconds( 0 ); |
|
1698 |
|
1699 GetThumbAtL(0); |
|
1700 iLastPosition = TotalLength(); |
|
1701 iView.StopNaviPaneUpdateL(); |
|
1702 iCutVideoBar->SetFinishedStatus( ETrue ); |
|
1703 iVideoDisplay->Stop( ETrue ); |
|
1704 SetStateL( EStateStopped ); |
|
1705 DrawDeferred(); |
|
1706 break; |
|
1707 } |
|
1708 case MVeiVideoDisplayObserver::EVolumeLevelChanged: |
|
1709 { |
|
1710 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EVolumeLevelChanged"); |
|
1711 TInt playerVolume = iVideoDisplay->Volume(); |
|
1712 iView.ShowVolumeLabelL( playerVolume ); |
|
1713 break; |
|
1714 } |
|
1715 case MVeiVideoDisplayObserver::EError: |
|
1716 { |
|
1717 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EError"); |
|
1718 // iErrorUI.ShowGlobalErrorNoteL( KErrGeneral ); |
|
1719 SetStateL( EStateStoppedInitial ); |
|
1720 break; |
|
1721 } |
|
1722 default: |
|
1723 { |
|
1724 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::default"); |
|
1725 break; |
|
1726 }; |
|
1727 } |
|
1728 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, Out"); |
|
1729 } |
|
1730 |
|
1731 |
|
1732 void CVeiSimpleCutVideoContainer::SetStateL(CVeiSimpleCutVideoContainer::TCutVideoState aState, TBool aUpdateCBA) |
|
1733 { |
|
1734 LOGFMT2(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SetStateL: in, iState:%d, aState:%d", iState, aState); |
|
1735 if (EStateGettingFrame == aState) |
|
1736 { |
|
1737 iPreviousState = iState; |
|
1738 } |
|
1739 |
|
1740 iState = aState; |
|
1741 if (EStatePaused == iState) |
|
1742 { |
|
1743 DrawNow(); |
|
1744 } |
|
1745 |
|
1746 // If the foreground is lost while an arrow key is down, we do not get |
|
1747 // the key up -event, and iSeeking remains true. Reseting it here just in case. |
|
1748 iSeeking = EFalse; |
|
1749 |
|
1750 if ( aUpdateCBA ) |
|
1751 { |
|
1752 iView.UpdateCBAL( iState ); |
|
1753 } |
|
1754 |
|
1755 //#ifdef STOP_PLAYER_DURING_GETFRAME |
|
1756 if (EStateGettingFrame == aState) |
|
1757 { |
|
1758 /* : |
|
1759 check out on every phone before releasing whether videodisplay should be stopped before starting |
|
1760 asynchronous GetFrameL() |
|
1761 see how EStateGettingFrame is handled in SetPreviewState |
|
1762 Stopping frees memory and it is needed in memory sensible devices |
|
1763 */ |
|
1764 //iVideoDisplay->Stop(ETrue); |
|
1765 } |
|
1766 //#endif |
|
1767 |
|
1768 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SetStateL:: out"); |
|
1769 } |
|
1770 |
|
1771 |
|
1772 void CVeiSimpleCutVideoContainer::MarkedInL() |
|
1773 { |
|
1774 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::MarkedInL, In"); |
|
1775 if ( EStateInitializing == iState ) |
|
1776 { |
|
1777 return; |
|
1778 } |
|
1779 const TTimeIntervalMicroSeconds& position = PlaybackPositionL(); |
|
1780 iSeekPos = position; |
|
1781 |
|
1782 LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::MarkedInL, 2, setting cutINpoint:%Ld", position.Int64()); |
|
1783 iCutVideoBar->SetInPoint( position ); |
|
1784 TInt tempPos = static_cast<TInt32>((position.Int64()/1000)); |
|
1785 iCutVideoBar->SetCurrentPoint( tempPos ); |
|
1786 |
|
1787 if( !AknLayoutUtils::PenEnabled() ) |
|
1788 { |
|
1789 iCutTimeDisplay->SetCutIn( position ); |
|
1790 } |
|
1791 |
|
1792 PauseL(); |
|
1793 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::MarkedInL, Out"); |
|
1794 } |
|
1795 |
|
1796 void CVeiSimpleCutVideoContainer::MarkedOutL() |
|
1797 { |
|
1798 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::MarkedOutL, In"); |
|
1799 if ( EStateInitializing == iState ) |
|
1800 { |
|
1801 return; |
|
1802 } |
|
1803 const TTimeIntervalMicroSeconds& position = PlaybackPositionL(); |
|
1804 iSeekPos = position; |
|
1805 |
|
1806 LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::MarkedOutL, 2, setting cutOUTpoint:%Ld", position.Int64()); |
|
1807 iCutVideoBar->SetOutPoint( position ); |
|
1808 TInt tempPos = static_cast<TInt32>((position.Int64()/1000)); |
|
1809 iCutVideoBar->SetCurrentPoint( tempPos ); |
|
1810 |
|
1811 if( !AknLayoutUtils::PenEnabled() ) |
|
1812 { |
|
1813 iCutTimeDisplay->SetCutOut( position ); |
|
1814 } |
|
1815 |
|
1816 PauseL(); |
|
1817 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::MarkedOutL, Out"); |
|
1818 } |
|
1819 |
|
1820 void CVeiSimpleCutVideoContainer::ShowInformationNoteL( const TDesC& aMessage ) const |
|
1821 { |
|
1822 CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); |
|
1823 note->ExecuteLD( aMessage ); |
|
1824 } |
|
1825 |
|
1826 void CVeiSimpleCutVideoContainer::ShowProgressNoteL() |
|
1827 { |
|
1828 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::ShowProgressNoteL, in"); |
|
1829 iProgressDialog = new ( ELeave ) CAknProgressDialog( REINTERPRET_CAST( CEikDialog**, |
|
1830 &iProgressDialog ), ETrue); |
|
1831 iProgressDialog->SetCallback( this ); |
|
1832 iProgressDialog->PrepareLC( R_VEI_PROGRESS_NOTE_WITH_CANCEL ); |
|
1833 |
|
1834 HBufC* stringholder; |
|
1835 TApaAppCaption caption; |
|
1836 TRAPD( err, ResolveCaptionNameL( caption ) ); |
|
1837 |
|
1838 // If something goes wrong, show basic "Saving" note |
|
1839 if ( err ) |
|
1840 { |
|
1841 stringholder = iEikonEnv->AllocReadResourceLC( R_VEI_PROGRESS_NOTE_SAVING ); |
|
1842 } |
|
1843 else |
|
1844 { |
|
1845 stringholder = StringLoader::LoadLC( R_VEI_PROGRESS_NOTE_SAVING_IMAGE, caption, iEikonEnv ); |
|
1846 } |
|
1847 |
|
1848 iProgressDialog->SetTextL( *stringholder ); |
|
1849 CleanupStack::PopAndDestroy( stringholder ); |
|
1850 |
|
1851 iProgressDialog->GetProgressInfoL()->SetFinalValue( KProgressbarFinalValue ); |
|
1852 iProgressDialog->RunLD(); |
|
1853 |
|
1854 iProgressDialog->GetProgressInfoL()->SetAndDraw( 50 ); |
|
1855 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::ShowProgressNoteL, Out"); |
|
1856 } |
|
1857 |
|
1858 //============================================================================= |
|
1859 void CVeiSimpleCutVideoContainer::ResolveCaptionNameL( TApaAppCaption& aCaption ) const |
|
1860 { |
|
1861 RApaLsSession appArcSession; |
|
1862 CleanupClosePushL( appArcSession ); |
|
1863 User::LeaveIfError( appArcSession.Connect() ); |
|
1864 |
|
1865 // Get Media Gallery caption |
|
1866 TApaAppInfo appInfo; |
|
1867 User::LeaveIfError( appArcSession.GetAppInfo( appInfo, TUid::Uid( KMediaGalleryUID3 ) ) ); |
|
1868 |
|
1869 aCaption = appInfo.iCaption; |
|
1870 |
|
1871 CleanupStack::PopAndDestroy( &appArcSession ); |
|
1872 } |
|
1873 |
|
1874 TInt CVeiSimpleCutVideoContainer::DoAudioBarUpdate( TAny* aThis ) |
|
1875 { |
|
1876 STATIC_CAST( CVeiSimpleCutVideoContainer*, aThis )->DoUpdate(); |
|
1877 return 42; |
|
1878 } |
|
1879 |
|
1880 void CVeiSimpleCutVideoContainer::DoUpdate() |
|
1881 { |
|
1882 TTimeIntervalMicroSeconds time; |
|
1883 time = iVideoDisplay->PositionL(); |
|
1884 if ( iSeeking ) |
|
1885 { |
|
1886 time = iSeekPos; |
|
1887 LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::DoUpdate(): 1, time:%Ld", time.Int64()); |
|
1888 } |
|
1889 else |
|
1890 { |
|
1891 LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::DoUpdate(): 2, time:%Ld", time.Int64()); |
|
1892 } |
|
1893 iCutVideoBar->SetCurrentPoint( static_cast<TInt32>((time.Int64() / 1000))); |
|
1894 iCutVideoBar->DrawDeferred(); |
|
1895 } |
|
1896 void CVeiSimpleCutVideoContainer::MuteL() |
|
1897 { |
|
1898 iVideoDisplay->SetMuteL( ETrue ); |
|
1899 } |
|
1900 |
|
1901 //============================================================================= |
|
1902 void CVeiSimpleCutVideoContainer::HandleVolumeUpL() |
|
1903 { |
|
1904 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandleVolumeUpL: in"); |
|
1905 |
|
1906 iVideoDisplay->AdjustVolumeL( 1 ); |
|
1907 |
|
1908 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandleVolumeUpL: out"); |
|
1909 } |
|
1910 |
|
1911 |
|
1912 void CVeiSimpleCutVideoContainer::SetVolumeLevelL( TInt aVolume ) |
|
1913 { |
|
1914 iVideoDisplay->AdjustVolumeL( aVolume - iVideoDisplay->Volume() ); |
|
1915 } |
|
1916 |
|
1917 //============================================================================= |
|
1918 void CVeiSimpleCutVideoContainer::HandleVolumeDownL() |
|
1919 { |
|
1920 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandleVolumeDownL: in"); |
|
1921 |
|
1922 iVideoDisplay->AdjustVolumeL( -1 ); |
|
1923 |
|
1924 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandleVolumeDownL: out"); |
|
1925 } |
|
1926 |
|
1927 //============================================================================= |
|
1928 void CVeiSimpleCutVideoContainer::PrepareForTerminationL() |
|
1929 { |
|
1930 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::PrepareForTerminationL: in"); |
|
1931 |
|
1932 SetStateL( EStateTerminating ); |
|
1933 |
|
1934 if( !iFrameReady && iVideoClipInfo ) |
|
1935 { |
|
1936 iVideoClipInfo->CancelFrame(); |
|
1937 } |
|
1938 iState = EStateTerminating; |
|
1939 iVideoDisplay->Stop( ETrue ); |
|
1940 |
|
1941 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::PrepareForTerminationL: out"); |
|
1942 } |
|
1943 |
|
1944 TInt CVeiSimpleCutVideoContainer::AsyncTakeSnapshot(TAny* aThis) |
|
1945 { |
|
1946 LOG( KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::AsyncTakeSnapshot"); |
|
1947 |
|
1948 // In the asynchronous version, trap the rest of the functions |
|
1949 // to make sure that the caller's TRequestStatus is always |
|
1950 // completed, also in case of failures. |
|
1951 CVeiSimpleCutVideoContainer* container = static_cast<CVeiSimpleCutVideoContainer*>(aThis); |
|
1952 TInt err = KErrNone; |
|
1953 TRAP(err, container->TakeSnapshotL()); |
|
1954 LOGFMT( KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::AsyncTakeSnapshot 1, err:%d", err); |
|
1955 User::LeaveIfError(err); |
|
1956 return KErrNone; |
|
1957 } |
|
1958 |
|
1959 void CVeiSimpleCutVideoContainer::HandleVideoClickedL() |
|
1960 { |
|
1961 LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandleVideoClickedL"); |
|
1962 |
|
1963 if ( EStatePlaying != iState && EStatePlayingMenuOpen != iState ) |
|
1964 { |
|
1965 iView.HandleCommandL( EVeiCmdCutVideoViewPlay ); |
|
1966 } |
|
1967 else if ( EStatePlaying == iState || EStatePlayingMenuOpen == iState ) |
|
1968 { |
|
1969 PauseL(); |
|
1970 // iView.HandleCommandL( EVeiCmdCutVideoViewStop ); |
|
1971 } |
|
1972 } |
|
1973 |
|
1974 void CVeiSimpleCutVideoContainer::FocusChanged( TDrawNow /*aDrawNow*/ ) |
|
1975 { |
|
1976 if (IsFocused()) |
|
1977 { |
|
1978 DrawDeferred(); |
|
1979 } |
|
1980 } |
|
1981 // End of File |