|
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 read format for Common Recording Engine.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __CRTPFROMFILE_H |
|
22 #define __CRTPFROMFILE_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <ipvideo/CRtpFileBase.h> |
|
26 #include <ipvideo/MRtpFileReadObserver.h> |
|
27 #include "MRtpTimerObserver.h" |
|
28 |
|
29 // CONSTANTS |
|
30 // None |
|
31 |
|
32 // MACROS |
|
33 // None |
|
34 |
|
35 // DATA TYPES |
|
36 // None |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 class CRtpToFile; |
|
40 class CRtpTimer; |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * RTP format read functionalities for RTP Clip Handler. |
|
46 * |
|
47 * @lib RtpClipHandler.lib |
|
48 * @since Series 60 3.0 |
|
49 */ |
|
50 class CRtpFromFile : public CRtpFileBase, |
|
51 public MRtpTimerObserver |
|
52 { |
|
53 |
|
54 public: // Constructors and destructor |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. |
|
58 * @param aReadObs a reference to file read observer. |
|
59 * @param aToFile a pointer to RTP save object. |
|
60 * @return pointer to CRtpFromFile class. |
|
61 */ |
|
62 static CRtpFromFile* NewL( MRtpFileReadObserver& aReadObs, |
|
63 CRtpToFile* aToFile ); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 virtual ~CRtpFromFile(); |
|
69 |
|
70 public: // New functions |
|
71 |
|
72 /** |
|
73 * Initiates RTP packet reading. |
|
74 * @since Series 60 3.0 |
|
75 * @param aClipPath a full path of the clip. |
|
76 * @param aVersion a version of the clip. |
|
77 * @param aTimeShift a mode selection. |
|
78 * @return none. |
|
79 */ |
|
80 void InitRtpReadL( const TDesC& aClipPath, |
|
81 TInt8& aVersion, |
|
82 const TBool aTimeShift ); |
|
83 |
|
84 /** |
|
85 * Initiates RTP packet reading. |
|
86 * @since Series 60 3.0 |
|
87 * @param aRtpHandle a open file handle for RTP file. |
|
88 * @param aVersion a version of the clip. |
|
89 * @param aTimeShift a mode selection. |
|
90 * @return none. |
|
91 */ |
|
92 void InitRtpReadL( const RFile& aFileHandle, |
|
93 TInt8& aVersion ); |
|
94 |
|
95 /** |
|
96 * Swaps new clip for RTP packet reading. |
|
97 * @since Series 60 3.0 |
|
98 * @param aClipPath a full path of clip. |
|
99 * @return a version of the clip. |
|
100 */ |
|
101 TInt8 SwapClipL( const TDesC& aClipPath ); |
|
102 |
|
103 /** |
|
104 * Getter for SDP data from the clip. |
|
105 * @since Series 60 3.0 |
|
106 * @param none. |
|
107 * @return a buffer keeping SDD data. |
|
108 */ |
|
109 HBufC8* GetClipSdpL(); |
|
110 |
|
111 /** |
|
112 * Reads next RTP packets group from a clip. |
|
113 * @since Series 60 3.0 |
|
114 * @param aGroupPoint a group to read. |
|
115 * @return KErrInUse if reading already active, |
|
116 KErrEof if too close to live point, |
|
117 KErrNone otherwise. |
|
118 */ |
|
119 TInt ReadNextGroupL( const TInt aGroupPoint ); |
|
120 |
|
121 /** |
|
122 * Reads skipped RTP packet from a clip. |
|
123 * @since Series 60 3.0 |
|
124 * @param none. |
|
125 * @return none. |
|
126 */ |
|
127 void ReadSkippedGroup(); |
|
128 |
|
129 /** |
|
130 * Setter for last seek addres. |
|
131 * @since Series 60 3.0 |
|
132 * @param none. |
|
133 * @return none. |
|
134 */ |
|
135 void UpdateLastSeekAddr(); |
|
136 |
|
137 /** |
|
138 * Sets Seek point of the clip. |
|
139 * @since Series 60 3.0 |
|
140 * @param aTime a time where to seek. |
|
141 * @return none. |
|
142 */ |
|
143 void SetSeekPointL( const TUint aTime ); |
|
144 |
|
145 /** |
|
146 * Stops RTP packet reading. |
|
147 * @since Series 60 3.0 |
|
148 * @param aStatus a stopping status. |
|
149 * @param aPlayerBuf a buffer length in player. |
|
150 * @return none. |
|
151 */ |
|
152 void StopRtpRead( const TInt aStatus, |
|
153 const TUint aPlayerBuf ); |
|
154 |
|
155 /** |
|
156 * Getter for duration of the clip. |
|
157 * @since Series 60 3.0 |
|
158 * @param none. |
|
159 * @return a duration of the clip. |
|
160 */ |
|
161 inline TUint Duration(); |
|
162 |
|
163 /** |
|
164 * Getter for time shift mode. |
|
165 * @since Series 60 3.0 |
|
166 * @param none. |
|
167 * @return true if time shift ongoing, otherwise false. |
|
168 */ |
|
169 inline TBool IsTimeShift(); |
|
170 |
|
171 /** |
|
172 * Getter for currently active group point. |
|
173 * @since Series 60 3.0 |
|
174 * @param none. |
|
175 * @return a group point of current read. |
|
176 */ |
|
177 inline TInt ThisGroup(); |
|
178 |
|
179 private: // Constructors and destructor |
|
180 |
|
181 /** |
|
182 * C++ default constructor. |
|
183 * @param aObs a RTP save observer. |
|
184 * @param aToFile a pointer to RTP save object. |
|
185 */ |
|
186 CRtpFromFile( MRtpFileReadObserver& aReadObs, |
|
187 CRtpToFile* aToFile ); |
|
188 |
|
189 /** |
|
190 * Symbian 2nd phase constructor can leave and is private by default. |
|
191 */ |
|
192 void ConstructL(); |
|
193 |
|
194 private: // Functions from base classes |
|
195 |
|
196 /** |
|
197 * From CRtpFileBase. |
|
198 * Called when request completion event occurs. |
|
199 * @since Series 60 3.0 |
|
200 * @return none. |
|
201 */ |
|
202 void RunL(); |
|
203 |
|
204 /** |
|
205 * From CRtpFileBase. |
|
206 * Handles a leave occurring in the request completion event handler RunL(). |
|
207 * @since Series 60 3.0 |
|
208 * @param aError the leave code. |
|
209 * @return status of run error handling. |
|
210 */ |
|
211 TInt RunError( TInt aError ); |
|
212 |
|
213 /** |
|
214 * From CRtpFileBase. |
|
215 * Called when request completion event cancelled. |
|
216 * @since Series 60 3.0 |
|
217 * @return none. |
|
218 */ |
|
219 void DoCancel(); |
|
220 |
|
221 /** |
|
222 * From MRmTimerObserver : Called when timer completion event occurs. |
|
223 * @since Series 60 3.0 |
|
224 * @return none |
|
225 */ |
|
226 void TimerEventL(); |
|
227 |
|
228 /** |
|
229 * From MRtpTimerObserver. |
|
230 * Handles a leave occurring in the request completion event handler RunL(). |
|
231 * @since Series 60 3.0 |
|
232 * @param aError the leave code. |
|
233 * @return none. |
|
234 */ |
|
235 void TimerError( const TInt aError ); |
|
236 |
|
237 private: // New functions |
|
238 |
|
239 /** |
|
240 * Reads clip header from a clip. |
|
241 * @since Series 60 3.0 |
|
242 * @param aVersion a version of clip. |
|
243 * @return none. |
|
244 */ |
|
245 void ReadClipHeaderL( TInt8& aVersion ); |
|
246 |
|
247 /** |
|
248 * Reads meta header from a clip. |
|
249 * @since Series 60 3.0 |
|
250 * @param aSeekHeaderPoint a seek header point in clip. |
|
251 * @param aSeekArrayPoint a seek array point in clip. |
|
252 * @return Version of clip. |
|
253 */ |
|
254 TInt8 ReadMetaHeaderL( TInt& aSeekHeaderPoint, |
|
255 TInt& aSeekArrayPoint ); |
|
256 |
|
257 /** |
|
258 * Reads RTP payload from a clip. |
|
259 * @since Series 60 3.0 |
|
260 * @param none. |
|
261 * @return none. |
|
262 */ |
|
263 void ReadNextGroupFromFileL(); |
|
264 |
|
265 /** |
|
266 * Finds group base on seek time. |
|
267 * @since Series 60 3.0 |
|
268 * @param aTime a time to use for search. |
|
269 * @param aArray a array to use for search. |
|
270 * @return point to group where time with TS exist. |
|
271 */ |
|
272 TInt FindSeekGroup( const TUint aTime, |
|
273 CArrayFix<SSeek>* aArray ); |
|
274 |
|
275 /** |
|
276 * Updates playback count and spot attributes. |
|
277 * @since Series 60 3.0 |
|
278 * @param none. |
|
279 * @return none. |
|
280 */ |
|
281 void UpdatePlayAttL(); |
|
282 |
|
283 /** |
|
284 * Getter for last seek addres. |
|
285 * @since Series 60 3.0 |
|
286 * @param none. |
|
287 * @return a last seek address. |
|
288 */ |
|
289 TInt LastSeekAddr(); |
|
290 |
|
291 private: // Data |
|
292 |
|
293 /** |
|
294 * RTP read observer. |
|
295 */ |
|
296 MRtpFileReadObserver& iReadObs; |
|
297 |
|
298 /** |
|
299 * Pointer to RTP save object. |
|
300 */ |
|
301 CRtpToFile* iToFile; |
|
302 |
|
303 /** |
|
304 * File data buffer. |
|
305 */ |
|
306 HBufC8* iFileData; |
|
307 |
|
308 /** |
|
309 * Request skipped. |
|
310 */ |
|
311 TBool iSkippedRead; |
|
312 |
|
313 /** |
|
314 * Duration of the clip. |
|
315 */ |
|
316 TInt iDuration; |
|
317 |
|
318 /** |
|
319 * Group read timer. |
|
320 */ |
|
321 CRtpTimer* iTimer; |
|
322 |
|
323 }; |
|
324 |
|
325 #include "CRtpFromFile.inl" |
|
326 |
|
327 #endif //__CRTPFROMFILE_H |
|
328 |
|
329 // End of File |