|
1 /* |
|
2 * Copyright (c) 2008 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: This class plays files with the Helix Engine |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: 18 % |
|
19 |
|
20 |
|
21 #ifndef _CMPXVIDEOPLAYBACKCONTROLLER_H_ |
|
22 #define _CMPXVIDEOPLAYBACKCONTROLLER_H_ |
|
23 |
|
24 // |
|
25 // INCLUDES |
|
26 // |
|
27 #include <mpxplaybackplugin.h> |
|
28 #include <mpxcenrepobserver.h> |
|
29 #include <mediarecognizer.h> |
|
30 #include <mpxplaybackpluginobserver.h> |
|
31 #include <mpxcenrepwatcher.h> |
|
32 #include <MMFScalingCustomCommandConstants.h> |
|
33 |
|
34 #include "mpxvideoprivatecrkeys.h" |
|
35 #include "mpxvideoplaybackstate.h" |
|
36 #include "mpxvideoplaybackmode.h" |
|
37 #include "mpxvideofiledetails.h" |
|
38 #include "mpxhelixplaybackplugindefs.h" |
|
39 #include "mpxvideoaccessoryobserver.h" |
|
40 #include "mpxvideoplayerutility.h" |
|
41 #include "mpxvideo_debug.h" |
|
42 |
|
43 // DATA TYPES |
|
44 |
|
45 // FORWARD DECLARATIONS |
|
46 |
|
47 class MMPXPlaybackPluginObserver; |
|
48 class CMPXCenRepWatcher; |
|
49 class CMPXPlaybackPlugin; |
|
50 class CMPXVideoPlaybackState; |
|
51 class CMediaRecognizer; |
|
52 class CMPXVideoSeeker; |
|
53 class CMpxVideoDrmHelper; |
|
54 |
|
55 // |
|
56 // CLASS DECLARATION |
|
57 // |
|
58 |
|
59 /* |
|
60 * CMPXVideoPlaybackController class |
|
61 * |
|
62 * Plug-in basically handles Video Playback with the Helix Engine |
|
63 * @lib mpxvideohelixplayback.lib |
|
64 * |
|
65 */ |
|
66 NONSHARABLE_CLASS( CMPXVideoPlaybackController ) |
|
67 : public CBase |
|
68 , public MMPXCenRepObserver |
|
69 { |
|
70 public: |
|
71 // |
|
72 // Constructors and destructor |
|
73 // |
|
74 static CMPXVideoPlaybackController* NewL( MMPXPlaybackPluginObserver& aObs ); |
|
75 /* |
|
76 * Destructor |
|
77 * Destroy the object and release all memory objects |
|
78 */ |
|
79 ~CMPXVideoPlaybackController(); |
|
80 |
|
81 // Maybe we can replace this with a SendMedia CustomCommand |
|
82 // at a later stage |
|
83 void SendMediaL( const TArray<TMPXAttribute>& aAttrs ); |
|
84 void HandleCommandL( CMPXCommand& aCmd ); |
|
85 void HandleCommandL( TMPXPlaybackCommand aCmd, TInt aData ); |
|
86 void DoHandleCommandL( TInt aCmd ); |
|
87 void HandleMMFEvent( const TMMFEvent& aEvent ); |
|
88 void SetPropertyL( TMPXPlaybackProperty aProperty , TInt aValue ); |
|
89 void GetPropertyL( TMPXPlaybackProperty aProperty ) const; |
|
90 |
|
91 // |
|
92 // MMPXCenRepObserver Implementation |
|
93 // |
|
94 void HandleSettingChange( const TUid& aRepositoryUid, |
|
95 TUint32 aSettingId ); |
|
96 |
|
97 void OpenFileL( const TDesC& aMediaFile, RFile& aFile, TInt aAccessPointId = -1 ); |
|
98 |
|
99 void HandleGeneralPlaybackCommandL( CMPXCommand& aCmd ); |
|
100 |
|
101 void HandleCustomPlaybackCommandL( CMPXCommand& aCmd ); |
|
102 |
|
103 void HandlePdlCommandL( CMPXCommand& aCmd ); |
|
104 |
|
105 /* closes the playback controller */ |
|
106 void CloseController(); |
|
107 |
|
108 /* Creates state instances needed before initialization & sets default state */ |
|
109 void CreatePreInitStatesL(); |
|
110 |
|
111 /* Creates state instances needed after initialization */ |
|
112 void CreatePostInitStatesL(); |
|
113 |
|
114 inline void SetMPXObserver(MMPXPlaybackPluginObserver& aObs); |
|
115 |
|
116 void ReadFileDetailsL(); |
|
117 |
|
118 void SetPlaybackModeL(); |
|
119 |
|
120 TBool IsDisplayOff(); |
|
121 TBool IsAlarm(); |
|
122 TBool IsPhoneCall(); |
|
123 TBool IsActivePhoneCall(); |
|
124 TBool IsVideoCall(); |
|
125 TBool IsVoiceCall(); |
|
126 |
|
127 void HandleTvOutEventL( TBool aConnected ); |
|
128 static TInt HandleBackLightTimout( TAny* aPtr ); |
|
129 void DoHandleBackLightTimout(); |
|
130 void StartBackLightTimer(); |
|
131 void CancelBackLightTimer(); |
|
132 void HandleError(TInt error); |
|
133 void SetVolumeSteps( TInt aVolumeSteps ); |
|
134 void HandleVolumeL( TBool aIncrease ); |
|
135 |
|
136 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
137 void OpenFile64L( const TDesC& aMediaFile, RFile64& aFile, TInt aAccessPointId = -1 ); |
|
138 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
139 |
|
140 |
|
141 private: |
|
142 |
|
143 void SetDisplayWindowL( CMPXCommand& aCmd ); |
|
144 void RestartDSA( CMPXCommand& aCmd ); |
|
145 inline void AbortDSA(); |
|
146 |
|
147 void InitVolumeWatchers(); |
|
148 |
|
149 void ChangeState(TMPXVideoPlaybackState aChangeToState); |
|
150 |
|
151 void SetVolumeMMFL(); |
|
152 void SetVolumeCenRepL( TInt aVolume ); |
|
153 void SetMuteCenRepL( TBool aMute ); |
|
154 |
|
155 TMPXVideoMode GetModeToSet(); |
|
156 void DetermineMediaTypeL(); |
|
157 |
|
158 void ResetMemberVariables(); |
|
159 |
|
160 protected: |
|
161 |
|
162 /* |
|
163 * C++ default constructor |
|
164 */ |
|
165 CMPXVideoPlaybackController(); |
|
166 |
|
167 /* |
|
168 * the second phase constructor ConstructL to safely construct things |
|
169 * that can leave |
|
170 */ |
|
171 void ConstructL( MMPXPlaybackPluginObserver& aObs ); |
|
172 |
|
173 protected: |
|
174 // |
|
175 // Data |
|
176 // |
|
177 CMpxVideoPlayerUtility* iPlayer; |
|
178 |
|
179 CMPXVideoAccessoryObserver* iAccessoryMonitor; |
|
180 |
|
181 MMPXPlaybackPluginObserver* iMPXPluginObs; // Not owned |
|
182 CMPXCenRepWatcher* iVolumeWatcher; |
|
183 CMPXCenRepWatcher* iMuteWatcher; |
|
184 |
|
185 HBufC* iClipName; |
|
186 HBufC* iRecognizedMimeType; // mime type returned by the recognizer |
|
187 RFile iFileHandle; |
|
188 CMPXVideoFileDetails* iFileDetails; |
|
189 TBool iAppInForeground; |
|
190 CMediaRecognizer::TMediaType iMediaType; |
|
191 TInt iAccessPointId; |
|
192 TBool iForegroundPause; |
|
193 TBool iAllowAutoPlay; |
|
194 TBool iHelixLoadingStarted; |
|
195 TInt iPBPluginError; |
|
196 TInt iVolumeNormalizer; |
|
197 |
|
198 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
199 RFile64 iFileHandle64; |
|
200 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
201 |
|
202 |
|
203 // State |
|
204 CMPXVideoPlaybackState* iState; |
|
205 CMPXVideoPlaybackState* iNotIntialisedState; |
|
206 CMPXVideoPlaybackState* iInitialisingState; |
|
207 CMPXVideoPlaybackState* iInitialisedState; |
|
208 CMPXVideoPlaybackState* iPlayingState; |
|
209 CMPXVideoPlaybackState* iBufferingState; |
|
210 CMPXVideoPlaybackState* iPausedState; |
|
211 CMPXVideoPlaybackState* iSeekingState; |
|
212 CMPXVideoPlaybackState* iStoppedState; |
|
213 |
|
214 // Mode |
|
215 CMPXVideoPlaybackMode* iPlaybackMode; |
|
216 |
|
217 // Video seeker |
|
218 CMPXVideoSeeker* iVideoSeeker; |
|
219 |
|
220 CPeriodic* iBackLightTimer; |
|
221 TBool iSeekable; |
|
222 |
|
223 CMpxVideoDrmHelper* iDrmHelper; |
|
224 |
|
225 public: // Friend classes |
|
226 |
|
227 // states are friends of the controller |
|
228 friend class CMPXVideoPlaybackState; |
|
229 friend class CMPXNotInitialisedState; |
|
230 friend class CMPXInitialisingState; |
|
231 friend class CMPXInitialisedState; |
|
232 friend class CMPXPlayingState; |
|
233 friend class CMPXBufferingState; |
|
234 friend class CMPXPausedState; |
|
235 friend class CMPXSeekingState; |
|
236 friend class CMPXStoppedState; |
|
237 |
|
238 // modes are friends of the controller |
|
239 friend class CMPXVideoPlaybackMode; |
|
240 friend class CMPXLocalPlaybackMode; |
|
241 friend class CMPXStreamingPlaybackMode; |
|
242 friend class CMPXLiveStreamingPlaybackMode; |
|
243 friend class CMPXProgressiveDLPlaybackMode; |
|
244 |
|
245 friend class CMPXVideoSeeker; |
|
246 friend class CMPXVideoDlMgrIf; |
|
247 friend class CMPXVideoAccessoryObserver; |
|
248 friend class CMpxVideoPlayerUtility; |
|
249 }; |
|
250 |
|
251 // INLINE METHODS |
|
252 |
|
253 inline |
|
254 void CMPXVideoPlaybackController::SetMPXObserver(MMPXPlaybackPluginObserver& aObs) |
|
255 { |
|
256 iMPXPluginObs = &aObs; |
|
257 } |
|
258 |
|
259 inline |
|
260 void CMPXVideoPlaybackController::AbortDSA() |
|
261 { |
|
262 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::AbortDSA()")); |
|
263 |
|
264 iPlayer->AbortDsa(); |
|
265 } |
|
266 |
|
267 #endif //_CMPXVIDEOPLAYBACKCONTROLLER_H_ |