|
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 // USER |
|
19 #include "musenglivevideoplayer.h" |
|
20 #include "musengcamerahandler.h" |
|
21 #include "musengmceutils.h" |
|
22 #include "musengdisplayhandler.h" |
|
23 |
|
24 // SYSTEM |
|
25 #include <mcesession.h> |
|
26 #include <mcefilesink.h> |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 CMusEngLiveVideoPlayer* CMusEngLiveVideoPlayer::NewL( |
|
33 MMusEngDisplayHandler& aDisplayHandler, |
|
34 TMusEngCameraHandler& aCameraHandler, |
|
35 MLcAudioControl& aLcAudioControl ) |
|
36 { |
|
37 return new( ELeave )CMusEngLiveVideoPlayer( |
|
38 aDisplayHandler, aCameraHandler, aLcAudioControl ); |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 CMusEngLiveVideoPlayer::CMusEngLiveVideoPlayer( |
|
46 MMusEngDisplayHandler& aDisplayHandler, |
|
47 TMusEngCameraHandler& aCameraHandler, |
|
48 MLcAudioControl& aLcAudioControl ) : |
|
49 CMusEngLocalVideoPlayer( aDisplayHandler, aLcAudioControl ), |
|
50 iCameraHandler( aCameraHandler ) |
|
51 { |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CMusEngLiveVideoPlayer::~CMusEngLiveVideoPlayer() |
|
59 { |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // From MLcVideoPlayer |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 TBool CMusEngLiveVideoPlayer::LcIsPlayingL() |
|
67 { |
|
68 return iCameraHandler.IsPlayingL(); |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // From MLcVideoPlayer |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 void CMusEngLiveVideoPlayer::LcPlayL( TLcVideoPlayerSource /*aSource*/ ) |
|
76 { |
|
77 iCameraHandler.PlayL(); |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // From MLcVideoPlayer |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 void CMusEngLiveVideoPlayer::LcPauseL() |
|
85 { |
|
86 iCameraHandler.PauseL(); |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // From MLcVideoPlayer |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 MLcCameraControl* CMusEngLiveVideoPlayer::LcCameraControl() |
|
94 { |
|
95 return &iCameraHandler; |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // From MLcVideoPlayer |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 MLcDestinationFileControl* CMusEngLiveVideoPlayer::LcDestinationFileControl() |
|
103 { |
|
104 return this; |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // From MLcVideoPlayer |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 MLcZoomControl* CMusEngLiveVideoPlayer::LcZoomControl() |
|
112 { |
|
113 return &iCameraHandler; |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // From MLcVideoPlayer |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 MLcBrightnessControl* CMusEngLiveVideoPlayer::LcBrightnessControl() |
|
121 { |
|
122 return &iCameraHandler; |
|
123 } |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // From MLcFileControl |
|
127 // ----------------------------------------------------------------------------- |
|
128 // |
|
129 void CMusEngLiveVideoPlayer::SetLcFileNameL( const TFileName& aFileName ) |
|
130 { |
|
131 iFileName = aFileName; |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // From MLcFileControl |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 TFileName& CMusEngLiveVideoPlayer::LcFileName() |
|
139 { |
|
140 return iFileName; |
|
141 } |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // From MLcDestinationFileControl |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 void CMusEngLiveVideoPlayer::LcRecordL( TBool aRecord ) |
|
148 { |
|
149 MUS_LOG1( "mus: [ENGINE] -> CMusEngLiveVideoPlayer::LcRecordL(( %d )", |
|
150 aRecord ) |
|
151 |
|
152 __ASSERT_ALWAYS( iMceSession, User::Leave( KErrNotReady ) ); |
|
153 |
|
154 CMceMediaSink* fileSink = |
|
155 MusEngMceUtils::GetMediaSink( *iMceSession, KMceFileSink ); |
|
156 |
|
157 __ASSERT_ALWAYS( fileSink, User::Leave( KErrNotReady ) ); |
|
158 |
|
159 if ( aRecord ) |
|
160 { |
|
161 if ( !fileSink->IsEnabled() ) |
|
162 { |
|
163 fileSink->EnableL(); |
|
164 } |
|
165 } |
|
166 else |
|
167 { |
|
168 if ( fileSink->IsEnabled() ) |
|
169 { |
|
170 fileSink->DisableL(); |
|
171 } |
|
172 } |
|
173 |
|
174 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveVideoPlayer::LcRecordL" ) |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // From MLcDestinationFileControl |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 TBool CMusEngLiveVideoPlayer::LcIsRecording() |
|
182 { |
|
183 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveVideoPlayer::LcIsRecording()" ) |
|
184 |
|
185 TBool isEnabled( EFalse ); |
|
186 |
|
187 CMceMediaSink* fileSink = |
|
188 MusEngMceUtils::GetMediaSink( *iMceSession, KMceFileSink ); |
|
189 if ( fileSink ) |
|
190 { |
|
191 isEnabled = fileSink->IsEnabled(); |
|
192 } |
|
193 |
|
194 MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveVideoPlayer::LcIsRecording( %d )", |
|
195 isEnabled ) |
|
196 |
|
197 return isEnabled; |
|
198 } |