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 RC client's Service* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "RCRService.h" |
|
22 #include <ipvideo/CRTypeDefs.h> |
|
23 #include <e32math.h> |
|
24 |
|
25 // CONSTANTS |
|
26 // None |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // RCRService::RCRService |
|
32 // |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 RCRService::RCRService() : RCRServiceBase() |
|
36 { |
|
37 // None |
|
38 } |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // RCRService::SetIap |
|
42 // LiveTV specific. |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 TInt RCRService::SetIap( const TSubConnectionUniqueId& aIapId ) |
|
46 { |
|
47 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
48 if ( SubSessionHandle() ) |
|
49 { |
|
50 SCRRtspIapParams msg; |
|
51 RProcess process; |
|
52 TInt handleId( process.Handle() ); |
|
53 msg.iQueueName.Format( KCRMsgQueueName, handleId ); |
|
54 msg.iQueueName.Trim(); |
|
55 msg.iConnectionId = aIapId; |
|
56 |
|
57 TPckgBuf<SCRRtspIapParams> pckg( msg ); |
|
58 TIpcArgs args( &pckg ); |
|
59 return SendReceive( ECRSetIap, args ); |
|
60 } |
|
61 |
|
62 return KErrServerTerminated; |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // RCRService::CancelSetIap |
|
67 // LiveTV specific. |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 TInt RCRService::CancelSetIap() |
|
71 { |
|
72 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
73 if ( SubSessionHandle() ) |
|
74 { |
|
75 TIpcArgs args; |
|
76 return SendReceive( ECRCancelSetIap, args ); |
|
77 } |
|
78 |
|
79 return KErrServerTerminated; |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // RCRService::PlayRtspUrl |
|
84 // LiveTV specific. |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 TInt RCRService::PlayRtspUrl( |
|
88 TUint& aSessionChk, |
|
89 const SCRRtspParams& aRtspParams ) |
|
90 { |
|
91 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
92 if ( SubSessionHandle() ) |
|
93 { |
|
94 TPckgBuf<TUint> pckg0( 0 ); |
|
95 TPckgBuf<SCRRtspParams> pckg1( aRtspParams ); |
|
96 TIpcArgs args( &pckg0, &pckg1 ); |
|
97 TInt err( SendReceive( ECRPlayRtspUrl, args ) ); |
|
98 aSessionChk = pckg0(); |
|
99 return err; |
|
100 } |
|
101 |
|
102 return KErrServerTerminated; |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // RCRService::PlayDvbhStream |
|
107 // DVB-H specific. |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 TInt RCRService::PlayDvbhStream( |
|
111 TUint& aSessionChk, |
|
112 const SCRLiveParams& aLiveParams ) |
|
113 { |
|
114 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
115 if ( SubSessionHandle() ) |
|
116 { |
|
117 TPckgBuf<TUint> pckg0( 0 ); |
|
118 TPckgBuf<SCRLiveParams> pckg1( aLiveParams ); |
|
119 TIpcArgs args( &pckg0, &pckg1 ); |
|
120 TInt err( SendReceive( ECRPlayDvbhLive, args ) ); |
|
121 aSessionChk = pckg0(); |
|
122 return err; |
|
123 } |
|
124 |
|
125 return KErrServerTerminated; |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // RCRService::ChangeDvbhService |
|
130 // DVB-H specific. |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 TInt RCRService::ChangeDvbhService( |
|
134 TUint& aSessionChk, |
|
135 const SCRLiveParams& aLiveParams ) |
|
136 { |
|
137 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
138 if ( SubSessionHandle() ) |
|
139 { |
|
140 TPckgBuf<TUint> pckg0( aSessionChk ); |
|
141 TPckgBuf<SCRLiveParams> pckg1( aLiveParams ); |
|
142 TIpcArgs args( &pckg0, &pckg1 ); |
|
143 TInt err( SendReceive( ECRChangeService, args ) ); |
|
144 aSessionChk = pckg0(); |
|
145 return err; |
|
146 } |
|
147 |
|
148 return KErrServerTerminated; |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // RCRService::PlayRtpFile |
|
153 // DVB-H specific. |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 TInt RCRService::PlayRtpFile( |
|
157 TUint& aSessionChk, |
|
158 const SCRRtpPlayParams& aRtpFile ) |
|
159 { |
|
160 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
161 if ( SubSessionHandle() ) |
|
162 { |
|
163 TPckgBuf<TUint> pckg0( 0 ); |
|
164 TPckgBuf<SCRRtpPlayParams> pckg1( aRtpFile ); |
|
165 TIpcArgs args( &pckg0, &pckg1 ); |
|
166 TInt err( SendReceive( ECRPlayRtpFile, args ) ); |
|
167 aSessionChk = pckg0(); |
|
168 return err; |
|
169 } |
|
170 |
|
171 return KErrServerTerminated; |
|
172 } |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // RCRService::PlayRtpFile |
|
176 // DVB-H specific. |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 TInt RCRService::PlayRtpFile( |
|
180 TUint& aSessionChk, |
|
181 const RFile& aRtpHandle ) |
|
182 { |
|
183 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
184 if ( SubSessionHandle() ) |
|
185 { |
|
186 TPckgBuf<TUint> pckg( 0 ); |
|
187 TIpcArgs args( &pckg ); |
|
188 aRtpHandle.TransferToServer( args, 1, 2 ); |
|
189 TInt err( SendReceive( ECRPlayRtpHandle, args ) ); |
|
190 aSessionChk = pckg(); |
|
191 return err; |
|
192 } |
|
193 |
|
194 return KErrServerTerminated; |
|
195 } |
|
196 |
|
197 // ----------------------------------------------------------------------------- |
|
198 // RCRService::RecordCurrentStream |
|
199 // UI command. |
|
200 // ----------------------------------------------------------------------------- |
|
201 // |
|
202 TInt RCRService::RecordCurrentStream( |
|
203 const TUint aSessionChk, |
|
204 const SCRRecordParams& aRecordParams ) |
|
205 { |
|
206 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
207 if ( SubSessionHandle() ) |
|
208 { |
|
209 TPckgBuf<TUint> pckg0( aSessionChk ); |
|
210 TPckgBuf<SCRRecordParams> pckg1( aRecordParams ); |
|
211 TIpcArgs args( &pckg0, &pckg1 ); |
|
212 return SendReceive( ECRRecordCurrentStream, args ); |
|
213 } |
|
214 |
|
215 return KErrServerTerminated; |
|
216 } |
|
217 |
|
218 // ----------------------------------------------------------------------------- |
|
219 // RCRService::RecordRtspStream |
|
220 // UI command. |
|
221 // ----------------------------------------------------------------------------- |
|
222 // |
|
223 TInt RCRService::RecordRtspStream( |
|
224 TUint& aSessionChk, |
|
225 const SCRRtspParams& aRtspUrl, |
|
226 const SCRRecordParams& aRecordParams ) |
|
227 { |
|
228 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
229 if ( SubSessionHandle() ) |
|
230 { |
|
231 TPckgBuf<TUint> pckg0( 0 ); |
|
232 TPckgBuf<SCRRtspParams> pckg1( aRtspUrl ); |
|
233 TPckgBuf<SCRRecordParams> pckg2( aRecordParams ); |
|
234 TIpcArgs args( &pckg0, &pckg1, &pckg2 ); |
|
235 TInt err( SendReceive( ECRRecordRtspStream, args ) ); |
|
236 aSessionChk = pckg0(); |
|
237 return err; |
|
238 } |
|
239 |
|
240 return KErrServerTerminated; |
|
241 } |
|
242 |
|
243 // ----------------------------------------------------------------------------- |
|
244 // RCRService::RecordDvbhStream |
|
245 // UI command. |
|
246 // ----------------------------------------------------------------------------- |
|
247 // |
|
248 TInt RCRService::RecordDvbhStream( |
|
249 TUint& aSessionChk, |
|
250 const SCRLiveParams& aLiveParams, |
|
251 const SCRRecordParams& aRecordParams ) |
|
252 { |
|
253 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
254 if ( SubSessionHandle() ) |
|
255 { |
|
256 TPckgBuf<TUint> pckg0( 0 ); |
|
257 TPckgBuf<SCRLiveParams> pckg1( aLiveParams ); |
|
258 TPckgBuf<SCRRecordParams> pckg2( aRecordParams ); |
|
259 TIpcArgs args( &pckg0, &pckg1, &pckg2 ); |
|
260 TInt err( SendReceive( ECRRecordDvbhStream, args ) ); |
|
261 aSessionChk = pckg0(); |
|
262 return err; |
|
263 } |
|
264 |
|
265 return KErrServerTerminated; |
|
266 } |
|
267 |
|
268 // ----------------------------------------------------------------------------- |
|
269 // RCRService::PauseRecordStream |
|
270 // UI command. |
|
271 // ----------------------------------------------------------------------------- |
|
272 // |
|
273 TInt RCRService::PauseRecordStream( const TUint aSessionChk, const TBool& aStart ) |
|
274 { |
|
275 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
276 if ( SubSessionHandle() ) |
|
277 { |
|
278 TPckgBuf<TUint> pckg0( aSessionChk ); |
|
279 TPckgBuf<TBool> pckg1( aStart ); |
|
280 TIpcArgs args( &pckg0, &pckg1 ); |
|
281 return SendReceive( ECRPauseRecordStream, args ); |
|
282 } |
|
283 |
|
284 return KErrServerTerminated; |
|
285 } |
|
286 |
|
287 // ----------------------------------------------------------------------------- |
|
288 // RCRService::StopRecordStream |
|
289 // UI command. |
|
290 // ----------------------------------------------------------------------------- |
|
291 // |
|
292 TInt RCRService::StopRecordStream( const TUint aSessionChk ) |
|
293 { |
|
294 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
295 if ( SubSessionHandle() ) |
|
296 { |
|
297 TPckgBuf<TUint> pckg0( aSessionChk ); |
|
298 TIpcArgs args( &pckg0 ); |
|
299 return SendReceive( ECRStopRecordStream, args ); |
|
300 } |
|
301 |
|
302 return KErrServerTerminated; |
|
303 } |
|
304 |
|
305 // ----------------------------------------------------------------------------- |
|
306 // RCRService::StartTimeShift |
|
307 // UI command. |
|
308 // ----------------------------------------------------------------------------- |
|
309 // |
|
310 TInt RCRService::StartTimeShift( |
|
311 TUint& aTimeShiftChk, |
|
312 const TUint aCurrentChk ) |
|
313 { |
|
314 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
315 if ( SubSessionHandle() ) |
|
316 { |
|
317 TPckgBuf<TUint> pckg0( 0 ); |
|
318 TPckgBuf<TUint> pckg1( aCurrentChk ); |
|
319 TIpcArgs args( &pckg0, &pckg1 ); |
|
320 TInt err( SendReceive( ECRStartTimeShift, args ) ); |
|
321 aTimeShiftChk = pckg0(); |
|
322 return err; |
|
323 } |
|
324 |
|
325 return KErrServerTerminated; |
|
326 } |
|
327 |
|
328 // ----------------------------------------------------------------------------- |
|
329 // RCRService::StopTimeShift |
|
330 // UI command. |
|
331 // ----------------------------------------------------------------------------- |
|
332 // |
|
333 TInt RCRService::StopTimeShift( |
|
334 const TUint aTimeShiftChk, |
|
335 const TUint aCurrentChk ) |
|
336 { |
|
337 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
338 if ( SubSessionHandle() ) |
|
339 { |
|
340 TPckgBuf<TUint> pckg0( aTimeShiftChk ); |
|
341 TPckgBuf<TUint> pckg1( aCurrentChk ); |
|
342 TIpcArgs args( &pckg0, &pckg1 ); |
|
343 return SendReceive( ECRStopTimeShift, args ); |
|
344 } |
|
345 |
|
346 return KErrServerTerminated; |
|
347 } |
|
348 |
|
349 // ----------------------------------------------------------------------------- |
|
350 // RCRService::PlayCommand |
|
351 // Player command. |
|
352 // ----------------------------------------------------------------------------- |
|
353 // |
|
354 TInt RCRService::PlayCommand( |
|
355 const TUint aSessionChk, |
|
356 const TReal& aStartPos, |
|
357 const TReal& aEndPos ) |
|
358 { |
|
359 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
360 if ( SubSessionHandle() ) |
|
361 { |
|
362 TPckgBuf<TUint> pckg0( aSessionChk ); |
|
363 TPckgBuf<TInt64> pckg1( aStartPos ); |
|
364 TPckgBuf<TInt64> pckg2( aEndPos ); |
|
365 TIpcArgs args( &pckg0, &pckg1, &pckg2 ); |
|
366 return SendReceive( ECRPlayCommand, args ); |
|
367 } |
|
368 |
|
369 return KErrServerTerminated; |
|
370 } |
|
371 |
|
372 // ----------------------------------------------------------------------------- |
|
373 // RCRService::PauseCommand |
|
374 // Player command. |
|
375 // ----------------------------------------------------------------------------- |
|
376 // |
|
377 TInt RCRService::PauseCommand( const TUint aSessionChk ) |
|
378 { |
|
379 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
380 if ( SubSessionHandle() ) |
|
381 { |
|
382 TPckgBuf<TUint> pckg0( aSessionChk ); |
|
383 TIpcArgs args( &pckg0 ); |
|
384 return SendReceive( ECRPauseCommand, args ); |
|
385 } |
|
386 |
|
387 return KErrServerTerminated; |
|
388 } |
|
389 |
|
390 // ----------------------------------------------------------------------------- |
|
391 // RCRService::StopCommand |
|
392 // Player command. |
|
393 // ----------------------------------------------------------------------------- |
|
394 // |
|
395 TInt RCRService::StopCommand( const TUint aSessionChk ) |
|
396 { |
|
397 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
398 if ( SubSessionHandle() ) |
|
399 { |
|
400 TPckgBuf<TUint> pckg0( aSessionChk ); |
|
401 TIpcArgs args( &pckg0 ); |
|
402 return SendReceive( ECRStopCommand, args ); |
|
403 } |
|
404 |
|
405 return KErrServerTerminated; |
|
406 } |
|
407 |
|
408 // ----------------------------------------------------------------------------- |
|
409 // RCRService::SetPosition |
|
410 // Sets position of packet source. |
|
411 // ----------------------------------------------------------------------------- |
|
412 // |
|
413 TInt RCRService::SetPosition( |
|
414 const TUint aSessionChk, |
|
415 const TInt64 aPosition ) |
|
416 { |
|
417 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
418 if ( SubSessionHandle() ) |
|
419 { |
|
420 TPckgBuf<TUint> pckg0( aSessionChk ); |
|
421 TPckgBuf<TInt64> pckg1( aPosition ); |
|
422 |
|
423 TIpcArgs args( &pckg0, &pckg1 ); |
|
424 return SendReceive( ECRSetPosition, args ); |
|
425 } |
|
426 |
|
427 return KErrServerTerminated; |
|
428 } |
|
429 |
|
430 // ----------------------------------------------------------------------------- |
|
431 // RCRService::GetPosition |
|
432 // Gets position of packet source. |
|
433 // ----------------------------------------------------------------------------- |
|
434 // |
|
435 TInt RCRService::GetPosition( |
|
436 const TUint aSessionChk, |
|
437 TInt64& aPosition, |
|
438 TInt64& aDuration ) |
|
439 { |
|
440 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
441 if ( SubSessionHandle() ) |
|
442 { |
|
443 TPckgBuf<TUint> pckg0( aSessionChk ); |
|
444 TPckgBuf<TInt64> pckg1( aPosition ); |
|
445 TPckgBuf<TInt64> pckg2( 0 ); |
|
446 |
|
447 TIpcArgs args( &pckg0, &pckg1, &pckg2 ); |
|
448 TInt err( SendReceive( ECRGetPosition, args ) ); |
|
449 aPosition = pckg1(); |
|
450 aDuration = pckg2(); |
|
451 return err; |
|
452 } |
|
453 |
|
454 return KErrServerTerminated; |
|
455 } |
|
456 |
|
457 // ----------------------------------------------------------------------------- |
|
458 // RCRService::CloseSession |
|
459 // Player command. |
|
460 // ----------------------------------------------------------------------------- |
|
461 // |
|
462 TInt RCRService::CloseSession( const TUint aSessionChk ) |
|
463 { |
|
464 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
465 if ( SubSessionHandle() ) |
|
466 { |
|
467 TPckgBuf<TUint> pckg0( aSessionChk ); |
|
468 TIpcArgs args( &pckg0 ); |
|
469 return SendReceive( ECRCloseSession, args ); |
|
470 } |
|
471 |
|
472 return KErrServerTerminated; |
|
473 } |
|
474 |
|
475 // ----------------------------------------------------------------------------- |
|
476 // RCRService::PlayNullSource |
|
477 // Debug purposes. |
|
478 // ----------------------------------------------------------------------------- |
|
479 // |
|
480 TInt RCRService::PlayNullSource( TUint& aSessionChk ) |
|
481 { |
|
482 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
483 if ( SubSessionHandle() ) |
|
484 { |
|
485 TPckgBuf<TUint> pckg0( 0 ); |
|
486 TIpcArgs args( &pckg0 ); |
|
487 TInt err( SendReceive( ECRPlayNullSource, args ) ); |
|
488 aSessionChk = pckg0(); |
|
489 return err; |
|
490 } |
|
491 |
|
492 return KErrServerTerminated; |
|
493 } |
|
494 |
|
495 // ----------------------------------------------------------------------------- |
|
496 // RCRService::PlayRtspUrlToNullSink |
|
497 // Debug purposes. |
|
498 // ----------------------------------------------------------------------------- |
|
499 // |
|
500 TInt RCRService::PlayRtspUrlToNullSink( |
|
501 TUint& aSessionChk, |
|
502 const SCRRtspParams& aRtspParams ) |
|
503 { |
|
504 __ASSERT_ALWAYS( &( SessionHandle() ), PanicClient( KErrBadHandle ) ); |
|
505 if ( SubSessionHandle() ) |
|
506 { |
|
507 TPckgBuf<TUint> pckg0( 0 ); |
|
508 TPckgBuf<SCRRtspParams> pckg1( aRtspParams ); |
|
509 TIpcArgs args( &pckg0, &pckg1 ); |
|
510 TInt err( SendReceive( ECRPlayRtspUrlToNullSink, args ) ); |
|
511 aSessionChk = pckg0(); |
|
512 return err; |
|
513 } |
|
514 |
|
515 return KErrServerTerminated; |
|
516 } |
|
517 |
|
518 // End of File |
|