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: Implementation of IptvRTP client's API* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <ipvideo/CCRDvrApi.h> |
|
22 #include "RCRService.h" |
|
23 #include "RCRClient.h" |
|
24 #include <ipvideo/MCREngineObserver.h> |
|
25 #include "CCRMsgQueueObserver.h" |
|
26 #include "CCRServerHandleSingleton.h" |
|
27 |
|
28 // CONSTANTS |
|
29 // None |
|
30 |
|
31 // ============================ MEMBER FUNCTIONS =============================== |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CCRDvrApi::NewL |
|
35 // Static two-phased constructor. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 EXPORT_C CCRDvrApi* CCRDvrApi::NewL( MCREngineObserver *aObserver ) |
|
39 { |
|
40 CCRDvrApi* self = new( ELeave ) CCRDvrApi(); |
|
41 CleanupStack::PushL( self ); |
|
42 self->ConstructL( aObserver ); |
|
43 CleanupStack::Pop( self ); |
|
44 return self; |
|
45 } |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CCRDvrApi::NewL |
|
49 // Static two-phased constructor. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 EXPORT_C CCRDvrApi* CCRDvrApi::NewL() |
|
53 { |
|
54 CCRDvrApi* self = new( ELeave ) CCRDvrApi(); |
|
55 CleanupStack::PushL( self ); |
|
56 self->ConstructL(); |
|
57 CleanupStack::Pop( self ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CCRDvrApi::CCRDvrApi |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CCRDvrApi::CCRDvrApi() |
|
66 { |
|
67 // None |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CCRDvrApi::ConstructL |
|
72 // Symbian 2nd phase constructor can leave. |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 void CCRDvrApi::ConstructL( MCREngineObserver *aObserver ) |
|
76 { |
|
77 CCRApiBase::BaseConstructL(); |
|
78 iQueueObserver = CCRMsgQueueObserver::NewL(); |
|
79 iQueueObserver->SetSessionId( 0 ); |
|
80 iQueueObserver->AddMsgQueueObserverL( aObserver ); |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CCRDvrApi::ConstructL |
|
85 // Symbian 2nd phase constructor can leave. |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 void CCRDvrApi::ConstructL() |
|
89 { |
|
90 CCRApiBase::BaseConstructL(); |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CCRDvrApi::~CCRDvrApi |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 EXPORT_C CCRDvrApi::~CCRDvrApi() |
|
98 { |
|
99 // note what happens in CCRAPIBase, the iClient et al. |
|
100 // might get deleted there. |
|
101 delete iQueueObserver; |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CCRDvrApi::SetIap |
|
106 // |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 EXPORT_C TInt CCRDvrApi::SetIap( const TSubConnectionUniqueId& aIapId ) |
|
110 { |
|
111 return iSingleton->Service().SetIap( aIapId ); |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CCRDvrApi::CancelSetIap |
|
116 // |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 EXPORT_C TInt CCRDvrApi::CancelSetIap() |
|
120 { |
|
121 return iSingleton->Service().CancelSetIap(); |
|
122 } |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // CCRDvrApi::PlayRtspUrl |
|
126 // |
|
127 // ----------------------------------------------------------------------------- |
|
128 // |
|
129 EXPORT_C TInt CCRDvrApi::PlayRtspUrl( |
|
130 TUint& aSessionChk, |
|
131 const SCRRtspParams& aRtspUrl ) |
|
132 { |
|
133 iQueueObserver->SetSessionId( 0 ); |
|
134 TInt err( iSingleton->Service().PlayRtspUrl( aSessionChk, aRtspUrl ) ); |
|
135 if ( !err ) |
|
136 { |
|
137 iQueueObserver->SetSessionId( aSessionChk ); |
|
138 } |
|
139 |
|
140 return err; |
|
141 } |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // CCRDvrApi::PlayDvbhStream |
|
145 // |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 EXPORT_C TInt CCRDvrApi::PlayDvbhStream( |
|
149 TUint& aSessionChk, |
|
150 const SCRLiveParams& aDvbhLive ) |
|
151 { |
|
152 iQueueObserver->SetSessionId( 0 ); |
|
153 TInt err( iSingleton->Service().PlayDvbhStream( aSessionChk, aDvbhLive ) ); |
|
154 if ( !err ) |
|
155 { |
|
156 iQueueObserver->SetSessionId( aSessionChk ); |
|
157 } |
|
158 return err; |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CCRDvrApi::ChangeDvbhService |
|
163 // |
|
164 // ----------------------------------------------------------------------------- |
|
165 // |
|
166 EXPORT_C TInt CCRDvrApi::ChangeDvbhService( |
|
167 TUint& aSessionChk, |
|
168 const SCRLiveParams& aDvbhLive ) |
|
169 { |
|
170 TInt err( iSingleton->Service().ChangeDvbhService( aSessionChk, aDvbhLive ) ); |
|
171 if ( !err ) |
|
172 { |
|
173 iQueueObserver->SetSessionId( aSessionChk ); |
|
174 } |
|
175 return err; |
|
176 } |
|
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // CCRDvrApi::PlayRtpFile |
|
180 // |
|
181 // ----------------------------------------------------------------------------- |
|
182 // |
|
183 EXPORT_C TInt CCRDvrApi::PlayRtpFile( |
|
184 TUint& aSessionChk, |
|
185 const SCRRtpPlayParams& aRtpFile ) |
|
186 { |
|
187 iQueueObserver->SetSessionId( 0 ); |
|
188 TInt err( iSingleton->Service().PlayRtpFile( aSessionChk, aRtpFile ) ); |
|
189 if ( !err ) |
|
190 { |
|
191 iQueueObserver->SetSessionId( aSessionChk ); |
|
192 } |
|
193 return err; |
|
194 } |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // CCRDvrApi::PlayRtpFile |
|
198 // |
|
199 // ----------------------------------------------------------------------------- |
|
200 // |
|
201 EXPORT_C TInt CCRDvrApi::PlayRtpFile( |
|
202 TUint& aSessionChk, |
|
203 const RFile& aRtpHandle ) |
|
204 { |
|
205 iQueueObserver->SetSessionId( 0 ); |
|
206 TInt err( iSingleton->Service().PlayRtpFile( aSessionChk, aRtpHandle ) ); |
|
207 if ( !err ) |
|
208 { |
|
209 iQueueObserver->SetSessionId( aSessionChk ); |
|
210 } |
|
211 return err; |
|
212 } |
|
213 |
|
214 // ----------------------------------------------------------------------------- |
|
215 // CCRDvrApi::RecordCurrentStream |
|
216 // |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 EXPORT_C TInt CCRDvrApi::RecordCurrentStream( |
|
220 const TUint aSessionChk, |
|
221 const SCRRecordParams& aRecordParams ) |
|
222 { |
|
223 return iSingleton->Service().RecordCurrentStream( aSessionChk, aRecordParams ); |
|
224 } |
|
225 |
|
226 // ----------------------------------------------------------------------------- |
|
227 // CCRDvrApi::RecordRtspStream |
|
228 // |
|
229 // ----------------------------------------------------------------------------- |
|
230 // |
|
231 EXPORT_C TInt CCRDvrApi::RecordRtspStream( |
|
232 TUint& aSessionChk, |
|
233 const SCRRtspParams& aRtspUrl, |
|
234 const SCRRecordParams& aRecordParams ) |
|
235 { |
|
236 return iSingleton->Service().RecordRtspStream( |
|
237 aSessionChk, aRtspUrl, aRecordParams ); |
|
238 } |
|
239 |
|
240 // ----------------------------------------------------------------------------- |
|
241 // CCRDvrApi::RecordDvbhStream |
|
242 // |
|
243 // ----------------------------------------------------------------------------- |
|
244 // |
|
245 EXPORT_C TInt CCRDvrApi::RecordDvbhStream( |
|
246 TUint& aSessionChk, |
|
247 const SCRLiveParams& aLiveParams, |
|
248 const SCRRecordParams& aRecordParams ) |
|
249 { |
|
250 return iSingleton->Service().RecordDvbhStream( |
|
251 aSessionChk, aLiveParams, aRecordParams ); |
|
252 } |
|
253 |
|
254 // ----------------------------------------------------------------------------- |
|
255 // CCRDvrApi::PauseRecordStream |
|
256 // |
|
257 // ----------------------------------------------------------------------------- |
|
258 // |
|
259 EXPORT_C TInt CCRDvrApi::PauseRecordStream( |
|
260 const TUint aSessionChk, |
|
261 const TBool& aStart ) |
|
262 { |
|
263 return iSingleton->Service().PauseRecordStream( aSessionChk, aStart ); |
|
264 } |
|
265 |
|
266 // ----------------------------------------------------------------------------- |
|
267 // CCRDvrApi::StopRecordStream |
|
268 // |
|
269 // ----------------------------------------------------------------------------- |
|
270 // |
|
271 EXPORT_C TInt CCRDvrApi::StopRecordStream( const TUint aSessionChk ) |
|
272 { |
|
273 return iSingleton->Service().StopRecordStream( aSessionChk ); |
|
274 } |
|
275 |
|
276 // ----------------------------------------------------------------------------- |
|
277 // CCRDvrApi::StartTimeShift |
|
278 // |
|
279 // ----------------------------------------------------------------------------- |
|
280 // |
|
281 EXPORT_C TInt CCRDvrApi::StartTimeShift( |
|
282 TUint& aTimeShiftChk, |
|
283 const TUint aSessionChk ) |
|
284 { |
|
285 return iSingleton->Service().StartTimeShift( aTimeShiftChk, aSessionChk ); |
|
286 } |
|
287 |
|
288 // ----------------------------------------------------------------------------- |
|
289 // CCRDvrApi::StopTimeShift |
|
290 // |
|
291 // ----------------------------------------------------------------------------- |
|
292 // |
|
293 EXPORT_C TInt CCRDvrApi::StopTimeShift( |
|
294 const TUint aTimeShiftChk, |
|
295 const TUint aCurrentChk ) |
|
296 { |
|
297 return iSingleton->Service().StopTimeShift( aTimeShiftChk, aCurrentChk ); |
|
298 } |
|
299 |
|
300 // ----------------------------------------------------------------------------- |
|
301 // CCRDvrApi::PlayCommand |
|
302 // |
|
303 // ----------------------------------------------------------------------------- |
|
304 // |
|
305 EXPORT_C TInt CCRDvrApi::PlayCommand( |
|
306 const TUint aSessionChk, |
|
307 const TReal aStartPos, |
|
308 const TReal aEndPos ) |
|
309 { |
|
310 return iSingleton->Service().PlayCommand( aSessionChk, aStartPos, aEndPos ); |
|
311 } |
|
312 |
|
313 // ----------------------------------------------------------------------------- |
|
314 // CCRDvrApi::PauseCommand |
|
315 // |
|
316 // ----------------------------------------------------------------------------- |
|
317 // |
|
318 EXPORT_C TInt CCRDvrApi::PauseCommand( const TUint aSessionChk ) |
|
319 { |
|
320 return iSingleton->Service().PauseCommand( aSessionChk ); |
|
321 } |
|
322 |
|
323 // ----------------------------------------------------------------------------- |
|
324 // CCRDvrApi::StopCommand |
|
325 // |
|
326 // ----------------------------------------------------------------------------- |
|
327 // |
|
328 EXPORT_C TInt CCRDvrApi::StopCommand( const TUint aSessionChk ) |
|
329 { |
|
330 return iSingleton->Service().StopCommand( aSessionChk ); |
|
331 } |
|
332 |
|
333 // ----------------------------------------------------------------------------- |
|
334 // CCRDvrApi::SetPosition |
|
335 // |
|
336 // ----------------------------------------------------------------------------- |
|
337 // |
|
338 EXPORT_C TInt CCRDvrApi::SetPosition( |
|
339 const TUint aSessionChk, |
|
340 const TInt64 aPosition ) |
|
341 { |
|
342 return iSingleton->Service().SetPosition( aSessionChk, aPosition ); |
|
343 } |
|
344 |
|
345 // ----------------------------------------------------------------------------- |
|
346 // CCRDvrApi::GetPosition |
|
347 // |
|
348 // ----------------------------------------------------------------------------- |
|
349 // |
|
350 EXPORT_C TInt CCRDvrApi::GetPosition( |
|
351 const TUint aSessionChk, |
|
352 TInt64& aPosition, |
|
353 TInt64& aDuration ) |
|
354 { |
|
355 return iSingleton->Service().GetPosition( aSessionChk, aPosition, aDuration ); |
|
356 } |
|
357 |
|
358 // ----------------------------------------------------------------------------- |
|
359 // CCRDvrApi::CloseSession |
|
360 // |
|
361 // ----------------------------------------------------------------------------- |
|
362 // |
|
363 EXPORT_C TInt CCRDvrApi::CloseSession( const TUint aSessionChk ) |
|
364 { |
|
365 return iSingleton->Service().CloseSession( aSessionChk ); |
|
366 } |
|
367 |
|
368 // ----------------------------------------------------------------------------- |
|
369 // CCRDvrApi::PlayNullSource |
|
370 // |
|
371 // ----------------------------------------------------------------------------- |
|
372 // |
|
373 EXPORT_C TInt CCRDvrApi::PlayNullSource( TUint& aSessionChk ) |
|
374 { |
|
375 return iSingleton->Service().PlayNullSource( aSessionChk ); |
|
376 } |
|
377 |
|
378 // ----------------------------------------------------------------------------- |
|
379 // CCRDvrApi::PlayRtspUrlToNullSink |
|
380 // |
|
381 // ----------------------------------------------------------------------------- |
|
382 // |
|
383 EXPORT_C TInt CCRDvrApi::PlayRtspUrlToNullSink( |
|
384 TUint& aSessionChk, |
|
385 const SCRRtspParams& aRtspUrl ) |
|
386 { |
|
387 iQueueObserver->SetSessionId( 0 ); |
|
388 TInt err( iSingleton->Service().PlayRtspUrlToNullSink( aSessionChk, aRtspUrl ) ); |
|
389 if ( !err ) |
|
390 { |
|
391 iQueueObserver->SetSessionId( aSessionChk ); |
|
392 } |
|
393 return err; |
|
394 } |
|
395 |
|
396 // End of File |
|
397 |
|
398 |
|