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: Interface for RTP file actions.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CRTPCLIPHANDLER_H |
|
21 #define CRTPCLIPHANDLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <ipvideo/CRtpFileBase.h> |
|
25 #include <ipvideo/MRtpFileObserver.h> |
|
26 #include <ipvideo/MRtpFileWriteObserver.h> |
|
27 #include <ipvideo/MRtpFileReadObserver.h> |
|
28 #include <ipvideo/CRTypeDefs.h> |
|
29 |
|
30 // CONSTANTS |
|
31 const TInt KDvrMaximumTimeShift( 12 * 60 * 60 ); // 12 hours |
|
32 |
|
33 // MACROS |
|
34 // None |
|
35 |
|
36 // DATA TYPES |
|
37 // None |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class CRtpToFile; |
|
41 class CRtpFromFile; |
|
42 |
|
43 // CLASS DECLARATION |
|
44 |
|
45 /** |
|
46 * Handles RTP storing/reading in a clip with a proprietary file format. |
|
47 * |
|
48 * @lib RtpClipHandler.lib |
|
49 * @since Series 60 3.0 |
|
50 */ |
|
51 class CRtpClipHandler : public CBase, |
|
52 public MRtpFileObserver |
|
53 { |
|
54 |
|
55 public: // Constructors and destructor |
|
56 |
|
57 /** |
|
58 * Two-phased constructor. |
|
59 * @return CRtpClipHandler pointer to CRtpClipHandler class. |
|
60 */ |
|
61 IMPORT_C static CRtpClipHandler* NewL(); |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 IMPORT_C virtual ~CRtpClipHandler(); |
|
67 |
|
68 public: // New functions |
|
69 |
|
70 /** |
|
71 * Registers RTP file write observer. |
|
72 * @since Series 60 3.0 |
|
73 * @param aObs a pointer to class which handles callback. |
|
74 * @return none. |
|
75 */ |
|
76 IMPORT_C void RegisterWriteObserver( MRtpFileWriteObserver* aObs ); |
|
77 |
|
78 /** |
|
79 * Registers RTP file read observer. |
|
80 * @since Series 60 3.0 |
|
81 * @param aObs a pointer to class which handles callback. |
|
82 * @return none. |
|
83 */ |
|
84 IMPORT_C void RegisterReadObserver( MRtpFileReadObserver* aObs ); |
|
85 |
|
86 /** |
|
87 * Starts RTP recording to a file. |
|
88 * @since Series 60 3.0 |
|
89 * @param aRecParams a recording info structure. |
|
90 * @param aAction a save action for clip mode. |
|
91 * @return none. |
|
92 */ |
|
93 IMPORT_C void StartRecordingL( |
|
94 const MRtpFileWriteObserver::SRtpRecParams& aRecParams, |
|
95 const MRtpFileWriteObserver::TRtpSaveAction& aAction ); |
|
96 |
|
97 /** |
|
98 * Saves next RTP group to a clip. |
|
99 * @since Series 60 3.0 |
|
100 * @param aGroup a RTP group data. |
|
101 * @param aGroupLength a length of group. |
|
102 * @param aAction a save action for current group. |
|
103 * @return none. |
|
104 */ |
|
105 IMPORT_C void SaveNextGroupL( |
|
106 TPtr8& aGroup, |
|
107 TUint aGroupLength, |
|
108 const MRtpFileWriteObserver::TRtpSaveAction& aAction ); |
|
109 |
|
110 /** |
|
111 * Getter for writing activity state. |
|
112 * @since Series 60 3.0 |
|
113 * @param none. |
|
114 * @return true if writing ongoing, otherwise false. |
|
115 */ |
|
116 IMPORT_C TBool WritingActive( void ) const; |
|
117 |
|
118 /** |
|
119 * Getter for current length of the clip. |
|
120 * @since Series 60 3.0 |
|
121 * @param none. |
|
122 * @return a total length of the clip. |
|
123 */ |
|
124 IMPORT_C TUint GetCurrentLength( void ) const; |
|
125 |
|
126 /** |
|
127 * Clip loop mode set for time shift. |
|
128 * @since Series 60 3.0 |
|
129 * @param none. |
|
130 * @return none. |
|
131 */ |
|
132 IMPORT_C void TimeShiftPauseL(); |
|
133 |
|
134 /** |
|
135 * Default values for rbf record params. |
|
136 * @since Series 60 3.0 |
|
137 * @param aParams a recording parameters. |
|
138 * @param aIndex a index for time shift clip name. |
|
139 * @return none. |
|
140 */ |
|
141 IMPORT_C void DefaultRecParams( MRtpFileWriteObserver::SRtpRecParams& aParams, |
|
142 const TInt aIndex ); |
|
143 |
|
144 /** |
|
145 * Setter recording end time of the clip. |
|
146 * @since Series 60 3.0 |
|
147 * @param aEndTime new end time for the clip. |
|
148 * @return none. |
|
149 */ |
|
150 IMPORT_C void UpdateRecordEndTime( const TTime& aEndTime ); |
|
151 |
|
152 /** |
|
153 * Resumes RTP recording. |
|
154 * @since Series 60 3.0 |
|
155 * @param none. |
|
156 * @return none. |
|
157 */ |
|
158 IMPORT_C void ResumeRecordingL( void ); |
|
159 |
|
160 /** |
|
161 * Stops RTP recording. |
|
162 * @since Series 60 3.0 |
|
163 * @param aError a stop error code. |
|
164 * @return none. |
|
165 */ |
|
166 IMPORT_C void StopRecording( const TInt aError ); |
|
167 |
|
168 /** |
|
169 * Starts RTP playback from a clip. |
|
170 * @since Series 60 3.0 |
|
171 * @param aParams a RTP clip play params. |
|
172 * @param aTimeShift a time shift mode or not. |
|
173 * @return none. |
|
174 */ |
|
175 IMPORT_C void StartPlayBackL( const SCRRtpPlayParams& aParams, |
|
176 const TBool aTimeShift = EFalse ); |
|
177 |
|
178 /** |
|
179 * Starts RTP playback from a clip. |
|
180 * @since Series 60 3.0 |
|
181 * @param aRtpHandle a open file handle for RTP file. |
|
182 * @return none. |
|
183 */ |
|
184 IMPORT_C void StartPlayBackL( const RFile& aFileHandle ); |
|
185 |
|
186 /** |
|
187 * Getter for SDP of the clip. |
|
188 * @since Series 60 3.0 |
|
189 * @param none. |
|
190 * @return none. |
|
191 */ |
|
192 IMPORT_C HBufC8* GetClipSdpL( void ) const; |
|
193 |
|
194 /** |
|
195 * Reads next RTP group from a clip. |
|
196 * @since Series 60 3.0 |
|
197 * @param none. |
|
198 * @return none. |
|
199 */ |
|
200 IMPORT_C void NextClipGroupL( void ); |
|
201 |
|
202 /** |
|
203 * Sets Seek point of the clip. |
|
204 * @since Series 60 3.0 |
|
205 * @param aTime a time where to seek in clip. |
|
206 * @return none. |
|
207 */ |
|
208 IMPORT_C void SetSeekPointL( const TUint aTime ); |
|
209 |
|
210 /** |
|
211 * Stops RTP playback. |
|
212 * @since Series 60 3.0 |
|
213 * @param aError a stop error code. |
|
214 * @param aPlayerBuf a buffer length in player. |
|
215 * @return none. |
|
216 */ |
|
217 IMPORT_C void StopPlayBack( const TInt aError, |
|
218 const TUint aPlayerBuf ); |
|
219 |
|
220 /** |
|
221 * Getter for clip version. |
|
222 * @since Series 60 3.0 |
|
223 * @param none. |
|
224 * @return a internal version of the clip. |
|
225 */ |
|
226 inline TInt8 ClipVersion( void ) const; |
|
227 |
|
228 private: // Constructors and destructor |
|
229 |
|
230 /** |
|
231 * C++ default constructor. |
|
232 */ |
|
233 CRtpClipHandler(); |
|
234 |
|
235 /** |
|
236 * By default Symbian 2nd phase constructor is private. |
|
237 */ |
|
238 void ConstructL(); |
|
239 |
|
240 private: // Functions from base classes |
|
241 |
|
242 /** |
|
243 * From MRtpFileObserver. |
|
244 * Called when RTP group save is ready. |
|
245 * @since Series 60 3.0 |
|
246 * @param aAction a save action for last saved group. |
|
247 * @return None. |
|
248 */ |
|
249 void RtpGroupSaved( const TInt aAction ); |
|
250 |
|
251 /** |
|
252 * From MRtpFileObserver. |
|
253 * Getter for current file reader point. |
|
254 * @since Series 60 3.0 |
|
255 * @param aIndex a index of shift seek array. |
|
256 * @return a read point in file reader. |
|
257 */ |
|
258 TInt CurrentFileReadPoint( const TInt aIndex ); |
|
259 |
|
260 private: // New methods |
|
261 |
|
262 /** |
|
263 * Swap to next available clip in time shift array if needed. |
|
264 * @since Series 60 3.0 |
|
265 * @param none. |
|
266 * @return none. |
|
267 */ |
|
268 void SwapClipIfNeededL( void ); |
|
269 |
|
270 private: // Data |
|
271 |
|
272 /** |
|
273 * RTP write observer. |
|
274 */ |
|
275 MRtpFileWriteObserver* iWriteObs; |
|
276 |
|
277 /** |
|
278 * RTP read observer. |
|
279 */ |
|
280 MRtpFileReadObserver* iReadObs; |
|
281 |
|
282 /** |
|
283 * RTP file save. |
|
284 */ |
|
285 CRtpToFile* iRtpSave; |
|
286 |
|
287 /** |
|
288 * RTP file read. |
|
289 */ |
|
290 CRtpFromFile* iRtpRead; |
|
291 |
|
292 /** |
|
293 * Clip version. |
|
294 */ |
|
295 TInt8 iClipVersion; |
|
296 |
|
297 /** |
|
298 * Time shift save clip name index. |
|
299 */ |
|
300 TInt iSaveNameIndex; |
|
301 |
|
302 /** |
|
303 * Time shift read clip name index. |
|
304 */ |
|
305 TInt iReadNameIndex; |
|
306 |
|
307 /** |
|
308 * Time shift paused state. |
|
309 */ |
|
310 TBool iTsPauseState; |
|
311 |
|
312 /** |
|
313 * Time shift seek handling array. |
|
314 */ |
|
315 RArray<CRtpFileBase::STimeShiftSeek> iShiftSeek; |
|
316 |
|
317 }; |
|
318 |
|
319 #include <ipvideo/CRtpClipHandler.inl> |
|
320 |
|
321 #endif // CRTPCLIPHANDLER_H |
|
322 |
|
323 // End of file |
|