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 |
|
22 |
|
23 #ifndef __VEDVIDEOCLIP_H__ |
|
24 #define __VEDVIDEOCLIP_H__ |
|
25 |
|
26 |
|
27 #include <e32base.h> |
|
28 #include <f32file.h> |
|
29 |
|
30 #include "VedCommon.h" |
|
31 #include "VedVideoClipInfo.h" |
|
32 |
|
33 |
|
34 /* |
|
35 * Forward declarations. |
|
36 */ |
|
37 class CVedMovieImp; |
|
38 class CAudClip; |
|
39 |
|
40 |
|
41 /** |
|
42 * Individual video clip stored as a single bitstream. |
|
43 * |
|
44 * @see CVedMovie |
|
45 */ |
|
46 class CVedVideoClip : public CBase |
|
47 { |
|
48 public: |
|
49 |
|
50 /* Constructors. */ |
|
51 |
|
52 static CVedVideoClip* NewL(CVedMovieImp* aMovie, const TDesC& aFileName, |
|
53 TInt aIndex, CAudClip* aAudioClip, |
|
54 MVedVideoClipInfoObserver& aObserver); |
|
55 |
|
56 static CVedVideoClip* NewL(CVedMovieImp* aMovie, |
|
57 CVedVideoClipGenerator& aGenerator, TInt aIndex, |
|
58 MVedVideoClipInfoObserver& aObserver, TBool aIsOwnedByVideoClip); |
|
59 |
|
60 static CVedVideoClip* NewL(CVedMovieImp* aMovie, RFile* aFileHandle, |
|
61 TInt aIndex, CAudClip* aAudioClip, |
|
62 MVedVideoClipInfoObserver& aObserver); |
|
63 |
|
64 /* Destructor. */ |
|
65 |
|
66 /** |
|
67 * Destroys the object and releases all resources. |
|
68 */ |
|
69 virtual ~CVedVideoClip(); |
|
70 |
|
71 |
|
72 /* Property methods. */ |
|
73 |
|
74 /** |
|
75 * Returns a video clip info object to get detailed information about |
|
76 * the original video clip. Note that the specified editing operations |
|
77 * (for example, cutting or muting audio) do <em>not</em> |
|
78 * affect the values returned by the info object. |
|
79 * |
|
80 * @return pointer to a video clip info instance |
|
81 */ |
|
82 CVedVideoClipInfo* Info(); |
|
83 |
|
84 /** |
|
85 * Returns whether this video clip with the specified editing operations |
|
86 * applied (for example, changing speed or muting) has an audio track or not. |
|
87 * |
|
88 * @return <code>ETrue</code> if clip has an audio track; |
|
89 * <code>EFalse</code> otherwise |
|
90 */ |
|
91 TBool EditedHasAudio() const; |
|
92 |
|
93 |
|
94 /* Movie methods. */ |
|
95 |
|
96 /** |
|
97 * Returns the movie that this video clip is part of. |
|
98 * |
|
99 * @return movie |
|
100 */ |
|
101 CVedMovieImp* Movie(); |
|
102 |
|
103 /** |
|
104 * Returns the index of this video clip in the movie. |
|
105 * |
|
106 * @return index of the clip |
|
107 */ |
|
108 TInt Index() const; |
|
109 |
|
110 /** |
|
111 * Sets the index of this video clip in the movie. |
|
112 * Panics with code <code>EVideoClipIllegalIndex</code> |
|
113 * if the clip index is invalid. |
|
114 * |
|
115 * @param aIndex new index of this clip |
|
116 */ |
|
117 void SetIndex(TInt aIndex); |
|
118 |
|
119 |
|
120 /* Effect methods. */ |
|
121 |
|
122 /** |
|
123 * Returns the playback speed of this video clip. Playback speed is |
|
124 * specified as parts per thousand of the normal playback speed. For example. |
|
125 * 1000 means the normal speed, 750 means 75% of the normal speed, and so on. |
|
126 * |
|
127 * @return playback speed |
|
128 */ |
|
129 TInt Speed() const; |
|
130 |
|
131 /** |
|
132 * Sets the playback speed of this video clip. Playback speed is |
|
133 * specified as parts per thousand of the normal playback speed. For example. |
|
134 * 1000 means the normal speed, 750 means 75% of the normal speed, and so on. |
|
135 * Panics with <code>EVideoClipIllegalSpeed</code> if playback speed is |
|
136 * illegal. |
|
137 * |
|
138 * @param aSpeed playback speed; must be between 1 and 1000 |
|
139 */ |
|
140 void SetSpeed(TInt aSpeed); |
|
141 |
|
142 /** |
|
143 * Returns the color effect of this video clip. |
|
144 * |
|
145 * @return color effect |
|
146 */ |
|
147 TVedColorEffect ColorEffect() const; |
|
148 |
|
149 /** |
|
150 * Sets the color effect of this video clip. |
|
151 * |
|
152 * @param aColorEffect color effect |
|
153 */ |
|
154 void SetColorEffect(TVedColorEffect aColorEffect); |
|
155 |
|
156 |
|
157 /** |
|
158 * Returns the color tone. |
|
159 * |
|
160 * @return color tone |
|
161 */ |
|
162 TRgb ColorTone() const; |
|
163 |
|
164 /** |
|
165 * Sets the color tone. |
|
166 * |
|
167 * @param aColorTone color tone |
|
168 */ |
|
169 void SetColorTone(TRgb aColorTone); |
|
170 |
|
171 /* Audio methods. */ |
|
172 |
|
173 /** |
|
174 * Returns whether this video clip can be muted or not (that is, |
|
175 * whether the mute setting has any effect). For example, if |
|
176 * this video clip has no audio track, it can never have audio |
|
177 * even if the mute setting is false. |
|
178 * |
|
179 * @return <code>ETrue</code> if this video clip can be muted; |
|
180 * <code>EFalse</code> otherwise |
|
181 */ |
|
182 TBool IsMuteable() const; |
|
183 |
|
184 /** |
|
185 * Returns whether the audio track of this video clip is mute or not. |
|
186 * This covers all mute cases: user muted, automatically muted (slow motion), |
|
187 * and missing audio track. |
|
188 * |
|
189 * @return <code>ETrue</code> if the audio track is muted; |
|
190 * <code>EFalse</code> otherwise |
|
191 */ |
|
192 TBool Muting() const; |
|
193 |
|
194 /** |
|
195 * Returns whether the audio track of this video clip is explicitly |
|
196 * muted by user or not. Returns ETrue also if there is no audio track at all. |
|
197 * |
|
198 * @return <code>ETrue</code> if the audio track is muted; |
|
199 * <code>EFalse</code> otherwise |
|
200 */ |
|
201 TBool IsMuted() const; |
|
202 |
|
203 /** |
|
204 * Returns whether the audio track of this video clip is normalized or not. |
|
205 * |
|
206 * @return <code>ETrue</code> if the audio track is normalized; |
|
207 * <code>EFalse</code> otherwise |
|
208 */ |
|
209 TBool Normalizing() const; |
|
210 |
|
211 |
|
212 /** |
|
213 * Sets whether the audio track of this video clip is muted or not. |
|
214 * |
|
215 * @param aVolume <code>ETrue</code> to mute the audio track; |
|
216 * <code>EFalse</code> not to mute the audio track |
|
217 */ |
|
218 void SetMuted(TBool aMuted); |
|
219 |
|
220 /** |
|
221 * Sets whether the audio track of this video clip is normalized or not. |
|
222 * |
|
223 * @param aNormalizing <code>ETrue</code> to normalize the audio track, |
|
224 * <code>EFalse</code> not to normalize |
|
225 */ |
|
226 void SetNormalizing(TBool aNormalizing); |
|
227 |
|
228 /** |
|
229 * Inserts a dynamic level mark to a clip. |
|
230 * |
|
231 * Possible leave codes: |
|
232 * - <code>KErrNoMemory</code> if memory allocation fails |
|
233 * |
|
234 * @param aMark mark to be added |
|
235 * @return index of the mark inserted |
|
236 */ |
|
237 TInt InsertDynamicLevelMarkL(const TVedDynamicLevelMark& aMark); |
|
238 |
|
239 /** |
|
240 * Removes a dynamic level mark in a clip. |
|
241 * |
|
242 * @param aIndex index of the removed mark in this clip |
|
243 * @return ETrue if mark was removed, EFalse otherwise |
|
244 */ |
|
245 TBool RemoveDynamicLevelMark(TInt aIndex); |
|
246 |
|
247 /** |
|
248 * Returns a dynamic level mark at the specified index |
|
249 * If the index is illegal, the method panics with the code |
|
250 * <code>EIllegalDynamicLevelMarkIndex</code> |
|
251 * |
|
252 * @return A dynamic level mark |
|
253 */ |
|
254 TVedDynamicLevelMark DynamicLevelMark(TInt aIndex) const; |
|
255 |
|
256 /** |
|
257 * Returns the number of dynamic level marks |
|
258 * |
|
259 * @return The number of dynamic level mark |
|
260 */ |
|
261 TInt DynamicLevelMarkCount() const; |
|
262 |
|
263 /** |
|
264 * Sets common volume gain for the clip. It is used to store |
|
265 * the gain; the actual processing will be based on dynamic level |
|
266 * marks which are set based on the gain value just before processing. |
|
267 * Since global gain setting may affect the dynamic level mark, |
|
268 * we need different variable to store the clip-specific gain also after the processing. |
|
269 * I.e. dynamic level marks do not have effect to this value. |
|
270 * |
|
271 * @param aVolumeGain |
|
272 */ |
|
273 void SetVolumeGain(TInt aVolumeGain); |
|
274 |
|
275 /** |
|
276 * Gets common volume gain for the clip. |
|
277 * Since global gain setting may affect the dynamic level mark, |
|
278 * we need different variable to store the clip-specific gain also after the processing. |
|
279 * |
|
280 * @param aVolumeGain |
|
281 */ |
|
282 TInt GetVolumeGain(); |
|
283 |
|
284 /* Timing methods. */ |
|
285 |
|
286 /** |
|
287 * Returns the cut in time of this video clip in clip timebase. |
|
288 * |
|
289 * @return cut in time in microseconds in clip timebase |
|
290 */ |
|
291 TTimeIntervalMicroSeconds CutInTime() const; |
|
292 |
|
293 /** |
|
294 * Sets the cut in time of this video clip in clip timebase. |
|
295 * Panics with <code>EVideoClipIllegalCutInTime</code> if |
|
296 * cut in time is illegal. |
|
297 * |
|
298 * @param aCutInTime cut in time in microseconds in clip timebase |
|
299 */ |
|
300 void SetCutInTime(TTimeIntervalMicroSeconds aCutInTime); |
|
301 |
|
302 /** |
|
303 * Returns the cut out time of this video clip in clip timebase. |
|
304 * |
|
305 * @return cut out time in microseconds in clip timebase |
|
306 */ |
|
307 TTimeIntervalMicroSeconds CutOutTime() const; |
|
308 |
|
309 /** |
|
310 * Sets the cut out time of this video clip in clip timebase. |
|
311 * Panics with <code>EVideoClipIllegalCutOutTime</code> if |
|
312 * cut out time is illegal. |
|
313 * |
|
314 * @param aCutOutTime cut out time in microseconds in clip timebase |
|
315 */ |
|
316 void SetCutOutTime(TTimeIntervalMicroSeconds aCutOutTime); |
|
317 |
|
318 /** |
|
319 * Returns the start time of this video clip in movie timebase. |
|
320 * |
|
321 * @return start time in microseconds in movie timebase |
|
322 */ |
|
323 TTimeIntervalMicroSeconds StartTime() const; |
|
324 |
|
325 /** |
|
326 * Returns the end time of this video clip in movie timebase. |
|
327 * |
|
328 * @return end time in microseconds in movie timebase |
|
329 */ |
|
330 TTimeIntervalMicroSeconds EndTime() const; |
|
331 |
|
332 /** |
|
333 * Returns the duration of this video clip with the specified |
|
334 * editing operations applied (for example, cutting |
|
335 * and changing speed) |
|
336 * |
|
337 * @return duration in microseconds |
|
338 */ |
|
339 TTimeIntervalMicroSeconds EditedDuration() const; |
|
340 |
|
341 /** |
|
342 * Update the audio clip timings. |
|
343 */ |
|
344 void UpdateAudioClip(); |
|
345 |
|
346 protected: |
|
347 |
|
348 |
|
349 private: |
|
350 /* |
|
351 * Default contructor |
|
352 */ |
|
353 CVedVideoClip(CVedMovieImp* aMovie, CAudClip* aAudioClip); |
|
354 |
|
355 /* |
|
356 * Symbian OS two phased constructor. |
|
357 */ |
|
358 void ConstructL(const TDesC& aFileName, TInt aIndex, |
|
359 MVedVideoClipInfoObserver& aObserver); |
|
360 |
|
361 void ConstructL(CVedVideoClipGenerator& aGenerator, TInt aIndex, |
|
362 MVedVideoClipInfoObserver& aObserver, TBool aIsOwnedByVideoClip); |
|
363 |
|
364 void ConstructL(RFile* aFileHandle, TInt aIndex, |
|
365 MVedVideoClipInfoObserver& aObserver); |
|
366 |
|
367 |
|
368 private: |
|
369 // Member variables |
|
370 |
|
371 // Movie class this clip is part of. |
|
372 CVedMovieImp* iMovie; |
|
373 // Index of this clip in movie. |
|
374 TInt iIndex; |
|
375 // File of the video clip. |
|
376 RFile iLockFile; |
|
377 // Info class of this video clip. |
|
378 CVedVideoClipInfo* iInfo; |
|
379 |
|
380 // Speed effect of this video clip. |
|
381 TInt iSpeed; |
|
382 // Color effect of this video clip. |
|
383 TVedColorEffect iColorEffect; |
|
384 // Transition effect of this video clip. |
|
385 TVedMiddleTransitionEffect iMiddleTransitionEffect; |
|
386 |
|
387 // Cut in time of this video clip. |
|
388 TTimeIntervalMicroSeconds iCutInTime; |
|
389 // Cut out time of this video clip. |
|
390 TTimeIntervalMicroSeconds iCutOutTime; |
|
391 // Start time of this video clip. |
|
392 TTimeIntervalMicroSeconds iStartTime; |
|
393 |
|
394 // Audio track of this video clip |
|
395 CAudClip* iAudClip; |
|
396 // Audio track muting: slow motion mutes it automatically, but switching back to normal speed |
|
397 // should unmute it unless user has muted it on purpose. |
|
398 TBool iUserMuted; |
|
399 // color tone |
|
400 TRgb iColorTone; |
|
401 |
|
402 TBool iLockFileOpened; |
|
403 |
|
404 friend class CVedMovieImp; |
|
405 friend class CVedMovieAddClipOperation; |
|
406 }; |
|
407 |
|
408 |
|
409 #endif // __VEDVIDEOCLIP_H__ |
|
410 |
|