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 <e32base.h> |
|
24 #include <vedmovie.h> |
|
25 #include <fbs.h> |
|
26 // User includes |
|
27 |
|
28 #include "VideoEditorDebugUtils.h" |
|
29 #include "veiframetaker.h" |
|
30 |
|
31 CVeiFrameTaker::CVeiFrameTaker( MVeiFrameTakerObserver& aObserver ) : CActive(CActive::EPriorityLow), iObserver( aObserver ) |
|
32 { |
|
33 } |
|
34 |
|
35 |
|
36 CVeiFrameTaker::~CVeiFrameTaker() |
|
37 { |
|
38 delete iWaitScheduler; |
|
39 delete iFirstFrame; |
|
40 delete iLastFrame; |
|
41 delete iTimelineFrame; |
|
42 } |
|
43 |
|
44 |
|
45 |
|
46 EXPORT_C CVeiFrameTaker* CVeiFrameTaker::NewL( MVeiFrameTakerObserver& aObserver ) |
|
47 { |
|
48 CVeiFrameTaker* self = new (ELeave) CVeiFrameTaker( aObserver ); |
|
49 CleanupStack::PushL(self); |
|
50 self->ConstructL(); |
|
51 CleanupStack::Pop(self); |
|
52 return self; |
|
53 } |
|
54 |
|
55 EXPORT_C void CVeiFrameTaker::GetFramesL( CVedVideoClipInfo& aInfo, |
|
56 TInt const aFirstFrame, TSize* const aFirstResolution, |
|
57 TInt const aLastFrame, TSize* const aLastResolution, |
|
58 TInt const aTimelineFrame, TSize* const aTimelineResolution, |
|
59 TInt aPriority) |
|
60 { |
|
61 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: In"); |
|
62 iError = KErrNone; |
|
63 iFrameCount = 0; |
|
64 |
|
65 delete iFirstFrame; |
|
66 iFirstFrame = NULL; |
|
67 delete iLastFrame; |
|
68 iLastFrame = NULL; |
|
69 delete iTimelineFrame; |
|
70 iTimelineFrame = NULL; |
|
71 |
|
72 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 1"); |
|
73 aInfo.GetFrameL( *this, aFirstFrame, aFirstResolution, EColor64K, EFalse, aPriority ); |
|
74 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 2"); |
|
75 |
|
76 if ( iFrameCount == 0 ) // GetFrameL is still active, so start waiting |
|
77 { |
|
78 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 3"); |
|
79 iWaitScheduler->Start(); |
|
80 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 4"); |
|
81 } |
|
82 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 5"); |
|
83 if ( iError == KErrNone ) |
|
84 { |
|
85 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 6"); |
|
86 aInfo.GetFrameL( *this, aLastFrame, aLastResolution, EColor64K, EFalse, aPriority ); |
|
87 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 7"); |
|
88 if ( iFrameCount == 1 ) |
|
89 { |
|
90 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 8"); |
|
91 iWaitScheduler->Start(); |
|
92 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 9"); |
|
93 } |
|
94 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 10"); |
|
95 } |
|
96 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 11"); |
|
97 if ( iError == KErrNone ) |
|
98 { |
|
99 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 12"); |
|
100 aInfo.GetFrameL( *this, aTimelineFrame, aTimelineResolution, EColor64K, EFalse, aPriority ); |
|
101 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 13"); |
|
102 if ( iFrameCount == 2 ) |
|
103 { |
|
104 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 14"); |
|
105 iWaitScheduler->Start(); |
|
106 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 15"); |
|
107 } |
|
108 } |
|
109 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 16"); |
|
110 iObserver.NotifyFramesCompleted( iFirstFrame, iLastFrame, iTimelineFrame, iError ); |
|
111 LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: Out"); |
|
112 } |
|
113 |
|
114 void CVeiFrameTaker::ConstructL() |
|
115 { |
|
116 iWaitScheduler = new (ELeave) CActiveSchedulerWait; |
|
117 CActiveScheduler::Add(this); |
|
118 } |
|
119 |
|
120 void CVeiFrameTaker::DoCancel() |
|
121 { |
|
122 } |
|
123 |
|
124 void CVeiFrameTaker::RunL() |
|
125 { |
|
126 iWaitScheduler->AsyncStop(); |
|
127 } |
|
128 |
|
129 void CVeiFrameTaker::NotifyVideoClipFrameCompleted(CVedVideoClipInfo& /*aInfo*/, TInt aError, CFbsBitmap* aFrame) |
|
130 { |
|
131 iError = aError; |
|
132 |
|
133 if ( iFrameCount == 0 ) |
|
134 { |
|
135 iFirstFrame = aFrame; |
|
136 } |
|
137 else if ( iFrameCount == 1 ) |
|
138 { |
|
139 iLastFrame = aFrame; |
|
140 } |
|
141 else if ( iFrameCount == 2 ) |
|
142 { |
|
143 iTimelineFrame = aFrame; |
|
144 } |
|
145 |
|
146 iFrameCount++; |
|
147 // Text frame generator is quite fast, so waitscheduler is not |
|
148 // started everytime. |
|
149 if (iWaitScheduler->IsStarted() ) |
|
150 iWaitScheduler->AsyncStop(); |
|
151 } |
|
152 // End of File |
|