|
1 /* |
|
2 * Copyright (c) 2009 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 "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // USER |
|
20 #include "musengremotevideoplayer.h" |
|
21 #include "musengmceutils.h" |
|
22 #include "musengdisplayhandler.h" |
|
23 |
|
24 // SYSTEM |
|
25 #include <mcesession.h> |
|
26 #include <mcevideostream.h> |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 CMusEngRemoteVideoPlayer* CMusEngRemoteVideoPlayer::NewL( |
|
33 MMusEngDisplayHandler& aDisplayHandler, |
|
34 MLcAudioControl& aLcAudioControl ) |
|
35 { |
|
36 return new( ELeave )CMusEngRemoteVideoPlayer( |
|
37 aDisplayHandler, aLcAudioControl ); |
|
38 } |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 CMusEngRemoteVideoPlayer::CMusEngRemoteVideoPlayer( |
|
45 MMusEngDisplayHandler& aDisplayHandler, |
|
46 MLcAudioControl& aLcAudioControl ) : |
|
47 CMusEngVideoPlayerBase( aDisplayHandler, aLcAudioControl ) |
|
48 { |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 CMusEngRemoteVideoPlayer::~CMusEngRemoteVideoPlayer() |
|
56 { |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // From MLcVideoPlayer |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 MLcVideoPlayer::TLcVideoPlayerState |
|
64 CMusEngRemoteVideoPlayer::LcVideoPlayerState() const |
|
65 { |
|
66 if ( !iMceSession ) |
|
67 { |
|
68 return MLcVideoPlayer::EUnavailable; |
|
69 } |
|
70 CMceVideoStream* stream = NULL; |
|
71 TRAPD( err, stream = MusEngMceUtils::GetVideoInStreamL( *iMceSession ) ) |
|
72 TLcVideoPlayerState playerState = MLcVideoPlayer::EUnavailable; |
|
73 if ( err == KErrNone && stream ) |
|
74 { |
|
75 switch ( stream->State() ) |
|
76 { |
|
77 case CMceMediaStream::EInitialized: |
|
78 { |
|
79 playerState = MLcVideoPlayer::EInit; |
|
80 break; |
|
81 } |
|
82 case CMceMediaStream::EBuffering: |
|
83 { |
|
84 playerState = MLcVideoPlayer::EBuffering; |
|
85 break; |
|
86 } |
|
87 case CMceMediaStream::EIdle: |
|
88 case CMceMediaStream::EDisabled: |
|
89 { |
|
90 playerState = MLcVideoPlayer::EPaused; |
|
91 break; |
|
92 } |
|
93 case CMceMediaStream::EStreaming: |
|
94 { |
|
95 // MCE stream state does not contain RTP activity information |
|
96 playerState = iDisplayHandler.IsDisplayActive() ? |
|
97 MLcVideoPlayer::EPlaying : MLcVideoPlayer::EPaused; |
|
98 break; |
|
99 } |
|
100 default: // Other MCE stream states: MLcVideoPlayer::EUnavailable |
|
101 { |
|
102 break; |
|
103 } |
|
104 } |
|
105 } |
|
106 return playerState; |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // From MLcVideoPlayer |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 TBool CMusEngRemoteVideoPlayer::LcIsPlayingL() |
|
114 { |
|
115 if ( !iMceSession ) |
|
116 { |
|
117 return EFalse; |
|
118 } |
|
119 CMceMediaStream* stream = MusEngMceUtils::GetVideoInStreamL( *iMceSession ); |
|
120 TBool isPlaying( EFalse ); |
|
121 |
|
122 if ( iMceSession->State() == CMceSession::EEstablished && |
|
123 stream && |
|
124 stream->State() == CMceMediaStream::EStreaming ) |
|
125 { |
|
126 isPlaying = ETrue; |
|
127 } |
|
128 |
|
129 return isPlaying; |
|
130 } |