|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "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 * |
|
14 * Description: RTP file save format for Common Recording Engine.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CRTPTOFILE_H |
|
21 #define CRTPTOFILE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <ipvideo/CRtpFileBase.h> |
|
25 #include <ipvideo/MRtpFileObserver.h> |
|
26 #include <ipvideo/MRtpFileWriteObserver.h> |
|
27 |
|
28 // CONSTANTS |
|
29 // None |
|
30 |
|
31 // MACROS |
|
32 // none |
|
33 |
|
34 // DATA TYPES |
|
35 // none |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 class CRtpMetaHeader; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * RTP format write functionalities for RTP Clip Handler. |
|
44 * |
|
45 * @lib RtpClipHandler.lib |
|
46 * @since Series 60 3.0 |
|
47 */ |
|
48 class CRtpToFile : public CRtpFileBase |
|
49 { |
|
50 |
|
51 public: // Constructors and destructor |
|
52 |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 */ |
|
56 static CRtpToFile* NewL( MRtpFileObserver& aObs, |
|
57 MRtpFileWriteObserver& aHandler ); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CRtpToFile(); |
|
63 |
|
64 public: // New functions |
|
65 |
|
66 /** |
|
67 * Initiates RTP packets saving. |
|
68 * @since Series 60 3.0 |
|
69 * @param aObs a RTP save observer. |
|
70 * @param aParams a recording parameters. |
|
71 * @param aAction a save action for current group. |
|
72 * @return none. |
|
73 */ |
|
74 void InitRtpSaveL( const MRtpFileWriteObserver::SRtpRecParams& aParams, |
|
75 const MRtpFileWriteObserver::TRtpSaveAction& aAction ); |
|
76 |
|
77 /** |
|
78 * Setter for packets re-use flag. |
|
79 * @since Series 60 3.0 |
|
80 * @param none. |
|
81 * @return none. |
|
82 */ |
|
83 void ActivateGroupsReuseL(); |
|
84 |
|
85 /** |
|
86 * Swaps new clip for packets saving. |
|
87 * @since Series 60 3.0 |
|
88 * @param aParams a recording parameters. |
|
89 * @return none. |
|
90 */ |
|
91 void SwapClipL( const MRtpFileWriteObserver::SRtpRecParams& aParams ); |
|
92 |
|
93 /** |
|
94 * Saves next RTP packet group to a file. |
|
95 * @since Series 60 3.0 |
|
96 * @param aGroup a RTP group data. |
|
97 * @param aGroupLength a length of group. |
|
98 * @param aAction a save action for current group. |
|
99 * @return a file location of saved group. |
|
100 */ |
|
101 TInt SaveNextGroupL( TPtr8& aGroup, |
|
102 TUint& aGroupLength, |
|
103 const MRtpFileWriteObserver::TRtpSaveAction& aAction ); |
|
104 |
|
105 /** |
|
106 * Updates previous time after pause. |
|
107 * @since Series 60 3.0 |
|
108 * @param none. |
|
109 * @return none. |
|
110 */ |
|
111 void UpdatePreviousTimeL(); |
|
112 |
|
113 /** |
|
114 * Stops RTP packet saving. |
|
115 * @since Series 60 3.0 |
|
116 * @param aError a stop error code. |
|
117 * @return none. |
|
118 */ |
|
119 void StopRtpSave( const TInt aError ); |
|
120 |
|
121 /** |
|
122 * Getter for a clip path. |
|
123 * @since Series 60 3.0 |
|
124 * @param none. |
|
125 * @return reference to current path. |
|
126 */ |
|
127 HBufC* ClipPath(); |
|
128 |
|
129 /** |
|
130 * Getter current length of the clip. |
|
131 * @since Series 60 3.0 |
|
132 * @param none. |
|
133 * @return a total length of the clip. |
|
134 */ |
|
135 TUint GetCurrentLength(); |
|
136 |
|
137 /** |
|
138 * Setter recording end time of the clip. |
|
139 * @since Series 60 3.0 |
|
140 * @param aEndTime new end time for the clip. |
|
141 * @return none. |
|
142 */ |
|
143 void UpdateRecordEndTime( const TTime& aEndTime ); |
|
144 |
|
145 /** |
|
146 * Updates playback count and spot attributes. |
|
147 * @since Series 60 3.0 |
|
148 * @param aNewSpot a new play start spot. |
|
149 * @return none. |
|
150 */ |
|
151 void UpdatePlayAttL( const TInt aNewSpot ); |
|
152 |
|
153 public: // New inline functions |
|
154 |
|
155 /** |
|
156 * Getter for packet groups total count. |
|
157 * @since Series 60 3.0 |
|
158 * @param none. |
|
159 * @return a value of groups total count variable. |
|
160 */ |
|
161 inline TInt GroupsTotalCount(); |
|
162 |
|
163 /** |
|
164 * Getter for first group address. |
|
165 * @since Series 60 3.0 |
|
166 * @param none. |
|
167 * @return a value of first address variable. |
|
168 */ |
|
169 inline TInt FirstSeekAddr(); |
|
170 |
|
171 /** |
|
172 * Getter for last group address. |
|
173 * @since Series 60 3.0 |
|
174 * @param none. |
|
175 * @return a value of last address variable. |
|
176 */ |
|
177 inline TInt LastSeekAddr(); |
|
178 |
|
179 /** |
|
180 * Getter for seek header point. |
|
181 * @since Series 60 3.0 |
|
182 * @param none. |
|
183 * @return a value of seek header variable. |
|
184 */ |
|
185 inline TInt SeekHeaderPoint(); |
|
186 |
|
187 /** |
|
188 * Getter for seek array. |
|
189 * @param none. |
|
190 * @since Series 60 3.0 |
|
191 * @return a pointer to seek array. |
|
192 */ |
|
193 inline CArrayFix<SSeek>* SeekArray(); |
|
194 |
|
195 /** |
|
196 * Getter for current save action |
|
197 * @param none. |
|
198 * @since Series 60 3.0 |
|
199 * @return current saving action (status) |
|
200 */ |
|
201 inline MRtpFileWriteObserver::TRtpSaveAction Action() const; |
|
202 |
|
203 private: // Constructors and destructor |
|
204 |
|
205 /** |
|
206 * C++ default constructor. |
|
207 */ |
|
208 CRtpToFile( MRtpFileObserver& aObs, |
|
209 MRtpFileWriteObserver& aHandler ); |
|
210 |
|
211 /** |
|
212 * Symbian 2nd phase constructor can leave and is private by default. |
|
213 */ |
|
214 void ConstructL(); |
|
215 |
|
216 private: // Functions from base classes |
|
217 |
|
218 /** |
|
219 * From CRtpFileBase : Called when request completion event occurs. |
|
220 * @since Series 60 3.0 |
|
221 * @param none. |
|
222 * @return none. |
|
223 */ |
|
224 void RunL(); |
|
225 |
|
226 /** |
|
227 * From CRtpFileBase : Handles a leave occurring in the request. |
|
228 * completion event handler RunL(). |
|
229 * @since Series 60 3.0 |
|
230 * @param aError the leave code |
|
231 * @return a status of function |
|
232 */ |
|
233 TInt RunError( TInt aError ); |
|
234 |
|
235 /** |
|
236 * From CRtpFileBase : Called when request completion event cancelled. |
|
237 * @since Series 60 3.0 |
|
238 * @param none. |
|
239 * @return none. |
|
240 */ |
|
241 void DoCancel(); |
|
242 |
|
243 private: // New functions |
|
244 |
|
245 /** |
|
246 * Opens new clip and creates initial headers. |
|
247 * @since Series 60 3.0 |
|
248 * @param aParams a recording parameters. |
|
249 * @return none. |
|
250 */ |
|
251 void CreateNewClipL( |
|
252 const MRtpFileWriteObserver::SRtpRecParams& aParams ); |
|
253 |
|
254 /** |
|
255 * Sets variables for a new group. |
|
256 * @since Series 60 3.0 |
|
257 * @param none. |
|
258 * @return none. |
|
259 */ |
|
260 void AddGroupL(); |
|
261 |
|
262 /** |
|
263 * Calculates group time. |
|
264 * @since Series 60 3.0 |
|
265 * @param aGroupLength a length of incoming group. |
|
266 * @return none. |
|
267 */ |
|
268 void GroupTimeL( TUint& aGroupLength ); |
|
269 |
|
270 /** |
|
271 * Writes clip's initial meta data header of the clip. |
|
272 * @since Series 60 3.0 |
|
273 * @param aParams a recording parameters. |
|
274 * @return none. |
|
275 */ |
|
276 void WriteInitialMetaHeaderL( |
|
277 const MRtpFileWriteObserver::SRtpRecParams& aParams ); |
|
278 |
|
279 /** |
|
280 * Writes clip's final meta data header to a clip. |
|
281 * @since Series 60 3.0 |
|
282 * @param aStatus a status of recording. |
|
283 * @return none. |
|
284 */ |
|
285 void WriteFinalMetaHeaderL( const TInt aStatus ); |
|
286 |
|
287 /** |
|
288 * Adds RTP group header to a group. |
|
289 * @since Series 60 3.0 |
|
290 * @param none. |
|
291 * @return none. |
|
292 */ |
|
293 void AddGroupHeaderL(); |
|
294 |
|
295 /** |
|
296 * Updates recording duration. |
|
297 * @since Series 60 3.0 |
|
298 * @param aMetaHeader a pointer to meta header. |
|
299 * @return none. |
|
300 */ |
|
301 void UpdateDurationL( CRtpMetaHeader* aMetaHeader ); |
|
302 |
|
303 /** |
|
304 * Getter for current network time. |
|
305 * @since Series 60 3.0 |
|
306 * @param none. |
|
307 * @return none. |
|
308 */ |
|
309 void UpdateCurrentTimeL(); |
|
310 |
|
311 private: // Data |
|
312 |
|
313 /** |
|
314 * RTP file observer. |
|
315 */ |
|
316 MRtpFileObserver& iFileObs; |
|
317 |
|
318 /** |
|
319 * RTP write observer. |
|
320 */ |
|
321 MRtpFileWriteObserver& iWriteObs; |
|
322 |
|
323 /** |
|
324 * Current network time. |
|
325 */ |
|
326 TTime iCurrentTime; |
|
327 |
|
328 /** |
|
329 * Previous network time. |
|
330 */ |
|
331 TInt64 iPreviousTime; |
|
332 |
|
333 /** |
|
334 * Previous time delta. |
|
335 */ |
|
336 TInt iPreviousDelta; |
|
337 |
|
338 /** |
|
339 * Reference recording time. |
|
340 */ |
|
341 TInt64 iReferenceTime; |
|
342 |
|
343 /** |
|
344 * Record end time. |
|
345 */ |
|
346 TInt64 iRecordEndTime; |
|
347 |
|
348 /** |
|
349 * Reference to seek array delta. |
|
350 */ |
|
351 TUint iSeekArrayReference; |
|
352 |
|
353 /** |
|
354 * Group time of the group where recording started. |
|
355 */ |
|
356 TUint iStartGroupTime; |
|
357 |
|
358 /** |
|
359 * Total groups for re-use. |
|
360 */ |
|
361 TInt iGroupReUse; |
|
362 |
|
363 /** |
|
364 * Current save action. |
|
365 */ |
|
366 MRtpFileWriteObserver::TRtpSaveAction iAction; |
|
367 |
|
368 }; |
|
369 |
|
370 #include "CRtpToFile.inl" |
|
371 |
|
372 #endif // CRTPTOFILE_H |
|
373 |
|
374 // End of File |