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: Class that reads packets from a .rtp clip for testing purposes.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CCRNULLSOURCE_H |
|
21 #define CCRNULLSOURCE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "CCRPacketSourceBase.h" |
|
25 #include <ipvideo/MRtpFileReadObserver.h> |
|
26 #include <ipvideo/MRtpFileWriteObserver.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 CRtpClipHandler; |
|
40 class CRtpTimer; |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * Class that negotiaties RTP stream using RTSP. |
|
46 * |
|
47 * @lib CommonRecordingEngine.lib |
|
48 * @since Series 60 3.0 |
|
49 */ |
|
50 class CCRNullSource : public CCRPacketSourceBase, |
|
51 public MRtpFileReadObserver, |
|
52 public MRtpTimerObserver |
|
53 { |
|
54 |
|
55 public: // Constructors and destructor |
|
56 |
|
57 /** |
|
58 * Two-phased constructor. |
|
59 * @return CCRNullSource pointer to CCRNullSource class |
|
60 */ |
|
61 static CCRNullSource* NewL( const TDesC& aClipName, |
|
62 MCRStreamObserver& aSessionObs, |
|
63 CCRStreamingSession& aOwningSession ); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 virtual ~CCRNullSource(); |
|
69 |
|
70 public: // New functions |
|
71 |
|
72 /** |
|
73 * |
|
74 * @since Series 60 3.0 |
|
75 * @param none. |
|
76 * @return none. |
|
77 */ |
|
78 //void PunchPacketsSent(); |
|
79 |
|
80 private: // Constructors and destructor |
|
81 |
|
82 /** |
|
83 * C++ default constructor. |
|
84 * @param aSessionObs a session observer. |
|
85 * @param aOwningSession a owning session. |
|
86 */ |
|
87 CCRNullSource( MCRStreamObserver& aSessionObs, |
|
88 CCRStreamingSession& aOwningSession ); |
|
89 |
|
90 /** |
|
91 * By default Symbian 2nd phase constructor is private. |
|
92 */ |
|
93 void ConstructL( const TDesC& aClipName ); |
|
94 |
|
95 private: // Methods from base classes |
|
96 |
|
97 /** |
|
98 * From CCRPacketSourceBase. |
|
99 * Method for acquiring sdp. |
|
100 * @since Series 60 3.0 |
|
101 * @param aSdp is string pointer that will be .Set() to contain the sdp. |
|
102 * If no sdp is available no .Set() will occur. |
|
103 * @return KErrNotReady if no sdp available. |
|
104 */ |
|
105 TInt GetSdp( TPtrC8& aSdp ); |
|
106 |
|
107 /** |
|
108 * From CCRPacketSourceBase. |
|
109 * Method for setting buffers to packet source |
|
110 * @since Series 60 3.0 |
|
111 * @param aBuffer is buffer to be set. |
|
112 * @return none. |
|
113 */ |
|
114 void SetBuffer( CCRPacketBuffer* aBuffer ); |
|
115 |
|
116 /** |
|
117 * From CCRPacketSourceBase. |
|
118 * Post action after source initialized. |
|
119 * @since Series 60 3.0 |
|
120 * @param none. |
|
121 * @return none. |
|
122 */ |
|
123 void PostActionL(); |
|
124 |
|
125 /** |
|
126 * From CCRPacketSourceBase. |
|
127 * Method for requesting more packets to buffer. |
|
128 * @since Series 60 3.0 |
|
129 * @param none. |
|
130 * @return none. |
|
131 */ |
|
132 void Restore(); |
|
133 |
|
134 /** |
|
135 * From CCRPacketSourceBase. |
|
136 * Method for ordering "play" for packet source. |
|
137 * @since Series 60 3.0 |
|
138 * @param aStartPos is start position in seconds. |
|
139 * @param aEndPos is end position in seconds. |
|
140 * @return a system wide error code. |
|
141 */ |
|
142 TInt Play( const TReal& aStartPos, |
|
143 const TReal& aEndPos ); |
|
144 |
|
145 /** |
|
146 * From CCRPacketSourceBase. |
|
147 * Method for stopping play from source. |
|
148 * @since Series 60 3.0 |
|
149 * @param none. |
|
150 * @return a system wide error code. |
|
151 */ |
|
152 TInt Stop(); |
|
153 |
|
154 /** |
|
155 * From CCRPacketSourceBase. |
|
156 * Getter for current position. |
|
157 * @since Series 60 3.0 |
|
158 * @param aPosition a postion of playback. |
|
159 * @param aDuration a duration of playback. |
|
160 * @return a system wide error code. |
|
161 */ |
|
162 TInt GetPosition( TInt64& aPosition, |
|
163 TInt64& aDuration ); |
|
164 |
|
165 /** |
|
166 * From MRtpFileReadObserver. |
|
167 * Called when RTP packets group readed from a file. |
|
168 * @since Series 60 3.0 |
|
169 * @param aGroup a RTP data readed from a file. |
|
170 * @param aGroupTime a group time in milli seconds. |
|
171 * @param aLastGroup a indication of last group in clip. |
|
172 * @return none. |
|
173 */ |
|
174 void GroupReadedL( const TDesC8& aGroup, |
|
175 const TUint aGroupTime, |
|
176 const TBool aLastGroup ); |
|
177 |
|
178 /** |
|
179 * From MRtpFileReadObserver. |
|
180 * File handler status of playback. |
|
181 * @since Series 60 3.0 |
|
182 * @param aStatus a status of file reading. |
|
183 * @return none. |
|
184 */ |
|
185 void ReadStatus( TInt aStatus ); |
|
186 |
|
187 /** |
|
188 * From MRtpTimerObserver. |
|
189 * Called when timer completion event occurs |
|
190 * @since Series 60 3.0 |
|
191 * @return none |
|
192 */ |
|
193 void TimerEventL(); |
|
194 |
|
195 /** |
|
196 * From MRtpTimerObserver. |
|
197 * Handles a leave occurring in the request |
|
198 * completion event handler RunL(). |
|
199 * @since Series 60 3.0 |
|
200 * @param aError the leave code. |
|
201 * @return None. |
|
202 */ |
|
203 void TimerError( const TInt aError ); |
|
204 |
|
205 private: // New methods |
|
206 |
|
207 /** |
|
208 * Method for requesting more packets to buffer. |
|
209 * @since Series 60 3.0 |
|
210 * @param none. |
|
211 * @return a system wide error code. |
|
212 */ |
|
213 TInt NextClipGroup(); |
|
214 |
|
215 /** |
|
216 * Converts old RTP propriatary format packet type to stream id. |
|
217 * @since Series 60 3.0 |
|
218 * @param aType a packet type from a clip. |
|
219 * @param aStream a stream id to update. |
|
220 * @return true if packet valid, otherwise false. |
|
221 */ |
|
222 TBool TypeToStream( const MRtpFileWriteObserver::TRtpType& aType, |
|
223 MCRPacketSource::TCRPacketStreamId& aStream ); |
|
224 |
|
225 private: // Data |
|
226 |
|
227 /** |
|
228 * Session observer. |
|
229 */ |
|
230 MCRStreamObserver& iSessionObs; |
|
231 |
|
232 /** |
|
233 * RTP clip handler. |
|
234 */ |
|
235 CRtpClipHandler* iClipHandler; |
|
236 |
|
237 /** |
|
238 * SDP data. |
|
239 */ |
|
240 HBufC8* iSdp; |
|
241 |
|
242 /** |
|
243 * Packets flow timer. |
|
244 */ |
|
245 CRtpTimer* iFlowTimer; |
|
246 |
|
247 /** |
|
248 * Time of last readed group. |
|
249 */ |
|
250 TUint iGroupTime; |
|
251 |
|
252 }; |
|
253 |
|
254 #endif // CCRNULLSOURCE_H |
|
255 |
|
256 // End of file |
|