|
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 * Header file for size estimate. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef __SIZEESTIMATE_H__ |
|
22 #define __SIZEESTIMATE_H__ |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CMovieProcessorImpl; |
|
29 class CVedMovie; |
|
30 class CVedMovieImp; |
|
31 class CVedVideoClip; |
|
32 |
|
33 |
|
34 |
|
35 // CONSTANTS |
|
36 |
|
37 const TInt KSEFixedSize = 148; |
|
38 const TReal KSEBWReductionFactor = 0.04; |
|
39 const TInt KSELowBitrateLimit = 128000; |
|
40 const TInt KSELowBitrateIncrement = 4000; |
|
41 const TInt KSEHighBitrateLimit = 1024000; |
|
42 const TInt KSEBlackFrameDuration = 1000000; |
|
43 const TInt KSEMaxFrameDuration = 1001000; |
|
44 const TInt KSEFadeTransitionFrames = 10; |
|
45 const TInt KSEWipeTransitionFrames = 5; |
|
46 const TInt KSEGeneratedIFrameFactorMPEG4 = 180; |
|
47 const TInt KSEGeneratedPFrameFactorMPEG4 = 6; |
|
48 const TInt KSEGeneratedIFrameFactorH264 = 400; |
|
49 const TInt KSEGeneratedPFrameFactorH264 = 11; |
|
50 const TInt KSEGeneratedIFrameFactorH263 = 212; |
|
51 const TInt KSEGeneratedPFrameFactorH263 = 35; |
|
52 const TInt KSEBlackIFrameFactor = 25; |
|
53 const TInt KSEBlackPFrameFactor = 3; |
|
54 const TInt KSEVideo3gpSizePerFrame1 = 40; |
|
55 const TInt KSEVideo3gpSizePerFrame2 = 25; |
|
56 const TInt KSEVideo3gpSizePerFrame3 = 15; |
|
57 const TInt KSEVideo3gpSizePerFrame4 = 13; |
|
58 const TInt KSEVideo3gpSizePerFrame5 = 12; |
|
59 const TInt KSEVideo3gpSizePerFrame6 = 11; |
|
60 const TInt KSEVideo3gpFramesLimit1 = 50; |
|
61 const TInt KSEVideo3gpFramesLimit2 = 75; |
|
62 const TInt KSEVideo3gpFramesLimit3 = 100; |
|
63 const TInt KSEVideo3gpFramesLimit4 = 200; |
|
64 const TInt KSEVideo3gpFramesLimit5 = 300; |
|
65 const TReal KSEAudio3gpSizePerSample1 = 15.0; |
|
66 const TReal KSEAudio3gpSizePerSample2 = 11.2; |
|
67 const TReal KSEAudio3gpSizePerSample3 = 9.8; |
|
68 const TReal KSEAudio3gpSizePerSample4 = 9.2; |
|
69 const TReal KSEAudio3gpSizePerSample5 = 9.0; |
|
70 const TReal KSEAudio3gpSizePerSample6 = 8.8; |
|
71 const TReal KSEAudio3gpSizePerSample7 = 8.6; |
|
72 const TReal KSEAudio3gpSizePerSample8 = 8.4; |
|
73 const TReal KSEAudio3gpSamplesLimit1 = 200.0; |
|
74 const TReal KSEAudio3gpSamplesLimit2 = 300.0; |
|
75 const TReal KSEAudio3gpSamplesLimit3 = 400.0; |
|
76 const TReal KSEAudio3gpSamplesLimit4 = 500.0; |
|
77 const TReal KSEAudio3gpSamplesLimit5 = 800.0; |
|
78 const TReal KSEAudio3gpSamplesLimit6 = 1600.0; |
|
79 const TReal KSEAudio3gpSamplesLimit7 = 2000.0; |
|
80 |
|
81 |
|
82 |
|
83 // CLASS DEFINITIONS |
|
84 class CSizeEstimate : public CBase |
|
85 { |
|
86 public: // New functions |
|
87 |
|
88 /* Constructors. */ |
|
89 static CSizeEstimate* NewL(CMovieProcessorImpl* aProcessor); |
|
90 static CSizeEstimate* NewLC(CMovieProcessorImpl* aProcessor); |
|
91 |
|
92 /* Destructor. */ |
|
93 virtual ~CSizeEstimate(); |
|
94 |
|
95 /** |
|
96 * Calculate movie size estimate |
|
97 * |
|
98 * @param aMovie Movie object |
|
99 * @param aFileSize Size estimate in bytes |
|
100 * @return Error code |
|
101 */ |
|
102 TInt GetMovieSizeEstimateL(const CVedMovie* aMovie, TInt& aFileSize); |
|
103 |
|
104 /** |
|
105 * Calculate movie size estimate for MMS |
|
106 * |
|
107 * @param aMovie Movie object |
|
108 * @param aTargetSize Maximum size allowed |
|
109 * @param aStartTime Time of the first frame included in the MMS output |
|
110 * @param aEndTime Time of the last frame included in the MMS output |
|
111 * @return Error code |
|
112 */ |
|
113 TInt GetMovieSizeEstimateForMMSL(const CVedMovie* aMovie, TInt aTargetSize, |
|
114 TTimeIntervalMicroSeconds aStartTime, TTimeIntervalMicroSeconds& aEndTime); |
|
115 |
|
116 |
|
117 private: // Private methods |
|
118 |
|
119 /** |
|
120 * By default Symbian OS constructor is private. |
|
121 */ |
|
122 void ConstructL(); |
|
123 |
|
124 /** |
|
125 * c++ default constructor |
|
126 */ |
|
127 CSizeEstimate(CMovieProcessorImpl* aProcessor); |
|
128 |
|
129 /** |
|
130 * Returns the number of start and end transition frames in given clip |
|
131 * |
|
132 * @param aMovie Movie object |
|
133 * @param aIndex Index of the clip in the movie |
|
134 * @param aStartTransitionFrames (out) Number of start transition frames |
|
135 * @param aEndTransitionFrames (out Number of end transition frames |
|
136 */ |
|
137 void GetTransitionFrames(const CVedMovieImp *aMovie, TInt aIndex, |
|
138 TInt& aStartTransitionFrames, TInt& aEndTransitionFrames); |
|
139 |
|
140 /** |
|
141 * Estimates the average generated frame size |
|
142 * |
|
143 * @param aMovie Movie object |
|
144 * @param aIntra ETrue if the frame is intra |
|
145 * @return Generated frame size in bytes |
|
146 */ |
|
147 TInt GetGeneratedFrameSize(const CVedMovieImp *aMovie, TBool aIntra); |
|
148 |
|
149 /** |
|
150 * Estimates the average black frame size |
|
151 * |
|
152 * @param aMovie Movie object |
|
153 * @param aIntra ETrue if the frame is intra |
|
154 * @return Black frame size in bytes |
|
155 */ |
|
156 TInt GetBlackFrameSize(const CVedMovieImp *aMovie, TBool aIntra); |
|
157 |
|
158 /** |
|
159 * Returns the 3gp size for video based on number of video frames |
|
160 * |
|
161 * @param aNumberOfVideoFrames The amount of frames in the video |
|
162 * @return 3gp size per frame for video |
|
163 */ |
|
164 TInt GetVideo3gpSizePerFrame(TInt aNumberOfVideoFrames); |
|
165 |
|
166 /** |
|
167 * Returns the 3gp size for audio based on number of audio samples |
|
168 * |
|
169 * @param aNumberOfAudioSamples The amount of samples in the audio |
|
170 * @return 3gp size per sample for audio |
|
171 */ |
|
172 TReal GetAudio3gpSizePerSample(TReal aNumberOfAudioSamples); |
|
173 |
|
174 private: // Data |
|
175 |
|
176 // handle to the processor instance |
|
177 CMovieProcessorImpl* iProcessor; |
|
178 |
|
179 }; |
|
180 |
|
181 |
|
182 #endif // __SIZEESTIMATE_H__ |
|
183 |
|
184 // End of File |