|
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: CMpxVideoPlayerAppUiEngine |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: 4 % |
|
19 |
|
20 |
|
21 |
|
22 #ifndef CMPXVIDEOPLAYERAPPUIENGINE_H |
|
23 #define CMPXVIDEOPLAYERAPPUIENGINE_H |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <mpxplaybackutility.h> |
|
27 #include <mpxviewutility.h> |
|
28 #include <mpxcollectionutility.h> |
|
29 #include <mpxmessage2.h> |
|
30 #include <mpxcollectionplaylist.h> |
|
31 #include <mediarecognizer.h> |
|
32 #include <mpxplaybackobserver.h> |
|
33 #include <mpxviewactivationobserver.h> |
|
34 #include <mpxcollectionobserver.h> |
|
35 #include <mpxcollectionuihelperobserver.h> |
|
36 |
|
37 class CMpxVideoEmbeddedPdlHandler; |
|
38 class CMPXCommonUiHelper; |
|
39 class MMPXCollectionUiHelper; |
|
40 class CAiwGenericParamList; |
|
41 class CVideoPlaylistUtility; |
|
42 class QMpxVideoPlaybackWrapper; |
|
43 |
|
44 /** |
|
45 * Application UI class. |
|
46 * |
|
47 * @lib mpxvideoplayer.exe |
|
48 * @since MpxVideoPlayer 0.1 |
|
49 */ |
|
50 class CMpxVideoPlayerAppUiEngine : public CBase, |
|
51 public MMPXPlaybackObserver, |
|
52 public MMPXViewActivationObserver, |
|
53 public MMPXCollectionObserver , |
|
54 public MMPXCHelperEmbeddedOpenObserver |
|
55 { |
|
56 public: // Constructors and destructor |
|
57 static CMpxVideoPlayerAppUiEngine* NewL( QMpxVideoPlaybackWrapper* aWrapper ); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CMpxVideoPlayerAppUiEngine(); |
|
63 |
|
64 public: |
|
65 /* |
|
66 * Retrieve the playback utility pointer |
|
67 */ |
|
68 inline MMPXPlaybackUtility* PlaybackUtility(); |
|
69 |
|
70 /** |
|
71 * Opens the specified file in response to a corresponding message. |
|
72 * |
|
73 * @param aFile File to be opened. |
|
74 * @param aParams aiw generic parameters for the file |
|
75 */ |
|
76 void OpenFileL( RFile& aFile, const CAiwGenericParamList* aParams ); |
|
77 |
|
78 /** |
|
79 * Opens the specified file in response to a corresponding message. |
|
80 * |
|
81 * @param aFile File to be opened. |
|
82 */ |
|
83 void OpenFileL( const TDesC& aFileName ); |
|
84 |
|
85 /** |
|
86 * Opens the specified mpx media object. |
|
87 * |
|
88 * @param aMedia Media to be opened. |
|
89 */ |
|
90 void OpenMediaL( const CMPXMedia& aMedia ); |
|
91 |
|
92 /** |
|
93 * Handle playback message |
|
94 * |
|
95 * @param aMessage playback message |
|
96 */ |
|
97 void DoHandlePlaybackMessageL( const CMPXMessage& aMessage ); |
|
98 |
|
99 /** |
|
100 * Handle Player Changed Playback Message |
|
101 */ |
|
102 void HandlePlaybackPlayerChangedL(); |
|
103 |
|
104 /** |
|
105 * Sets mpx components ready for application shutdown |
|
106 */ |
|
107 void PrepareCloseMpxL(); |
|
108 |
|
109 /** |
|
110 * Sets AppUiEngine in stand alone "mode" |
|
111 */ |
|
112 void StartStandAloneL(); |
|
113 |
|
114 /** |
|
115 * Handle media properties. |
|
116 */ |
|
117 void DoHandelCollectionMediaL( const CMPXMedia& aMedia ); |
|
118 |
|
119 /** |
|
120 * Steps one level up in collection path |
|
121 */ |
|
122 void StepBackCollectionPathL(); |
|
123 |
|
124 /** |
|
125 * Initialize the playback engine with a collection path |
|
126 * @param aPath The collection path to create the playlist from |
|
127 */ |
|
128 void InitPlaybackEngineL( CMPXCollectionPath& aPath ); |
|
129 |
|
130 /** |
|
131 * Process activation message. |
|
132 * @param aMsg reference to activation message |
|
133 */ |
|
134 void ProcessActivationMessageL( const TDesC8 &aMsg ); |
|
135 |
|
136 /* |
|
137 * Handle embedded playback message |
|
138 * @param aMessageUid message identification uid |
|
139 * @param aMessageParameters aiw generic parameters |
|
140 */ |
|
141 TBool HandleMessageL( TUid aMessageUid, |
|
142 const TDesC8& aMessageParameters ); |
|
143 |
|
144 /** |
|
145 * From MMPXPlaybackObserver |
|
146 * Handle playback message |
|
147 * |
|
148 * @since 3.1 |
|
149 * @param aMessage playback message |
|
150 * @param aErr system error code. |
|
151 */ |
|
152 void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError ); |
|
153 |
|
154 /** |
|
155 * From MMPXViewActivationObserver |
|
156 * Handle view activation. |
|
157 * |
|
158 * @since 3.1 |
|
159 * @param aCurrentViewType Current view type Uid. |
|
160 * @param aPreviousViewType Previous view type Uid. |
|
161 */ |
|
162 void HandleViewActivation( const TUid& aCurrentViewType, const TUid& aPreviousViewType ); |
|
163 |
|
164 |
|
165 /** |
|
166 * From MPXCollectionObserver |
|
167 * @since S60 3.2.3 |
|
168 * @param aMessage collection message, ownership not transferred. |
|
169 * Please check aMsg is not NULL before using it. If aErr is not |
|
170 * KErrNone, plugin might still call back with more info in the aMsg. |
|
171 * @param aErr system error code |
|
172 */ |
|
173 void HandleCollectionMessage( CMPXMessage* aMsg, TInt /*aErr*/ ); |
|
174 |
|
175 /** |
|
176 * From MMPXCollectionObserver |
|
177 * Handle media properties. |
|
178 * |
|
179 * @since 3.1 |
|
180 * @param aMedia media properties. |
|
181 * @param aError Error code. |
|
182 */ |
|
183 void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError ); |
|
184 |
|
185 /** |
|
186 * From MMPXCollectionObserver |
|
187 * Handles the collection entries being opened. |
|
188 * |
|
189 * @since 3.1 |
|
190 * @param aEntries Collection entries opened. |
|
191 * @param aIndex Focused entry. |
|
192 * @param aComplete ETrue no more entries. EFalse more entries |
|
193 * expected. |
|
194 * @param aError Error code. |
|
195 */ |
|
196 void HandleOpenL( const CMPXMedia& aEntries, |
|
197 TInt aIndex, |
|
198 TBool aComplete, |
|
199 TInt aError ); |
|
200 |
|
201 /** |
|
202 * From MMPXCollectionObserver |
|
203 * Handles the item being opened. |
|
204 * |
|
205 * @since 3.1 |
|
206 * @param aPlaylist Collection playlist, owner ship is transfered. |
|
207 * @param aError Error code. |
|
208 */ |
|
209 void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError); |
|
210 |
|
211 // from base class MMPXCHelperEmbeddedOpenObserver |
|
212 /** |
|
213 * From MMPXCHelperEmbeddedOpenObserver |
|
214 * Handles errors from opening in embedded mode |
|
215 * |
|
216 * @since 3.1 |
|
217 * @param aErr Error code |
|
218 * @param aCategory Type of item to be opened. |
|
219 */ |
|
220 void HandleEmbeddedOpenL( TInt aErr, TMPXGeneralCategory aCategory ); |
|
221 |
|
222 void CreateEmbeddedPdlPlaybackUtilityMemberVariablesL(); |
|
223 |
|
224 /* |
|
225 * Handles the "back" button. |
|
226 */ |
|
227 void HandleSoftKeyBackL(); |
|
228 |
|
229 /* |
|
230 * Processes shell commands. |
|
231 * @param aCommand |
|
232 * @param aDocumentName |
|
233 * @param aTail |
|
234 * @return ETrue if document name exists |
|
235 */ |
|
236 TBool ProcessCommandParametersL( TApaCommand aCommand, |
|
237 TFileName& aDocumentName, |
|
238 const TDesC8& aTail ); |
|
239 |
|
240 /* |
|
241 * Provides the static function for the callback to exit the application |
|
242 * Called by CIdle iIdle |
|
243 * @since 9.2 |
|
244 * @param aPtr Pointer to callback class |
|
245 * @return KErrNone |
|
246 */ |
|
247 static TInt ExitApplicationL( TAny* aPtr ); |
|
248 |
|
249 /* |
|
250 * Late initializatoin of members that can be delayed |
|
251 * to help improve startup time |
|
252 * @since 10.1 |
|
253 */ |
|
254 void LateInitL(); |
|
255 |
|
256 private: |
|
257 /** |
|
258 * Constructor |
|
259 */ |
|
260 CMpxVideoPlayerAppUiEngine( QMpxVideoPlaybackWrapper* aWrapper ); |
|
261 |
|
262 /** |
|
263 * By default Symbian 2nd phase constructor is private. |
|
264 */ |
|
265 void ConstructL(); |
|
266 |
|
267 |
|
268 void HandleMultiLinksFileL( const TDesC& aFileName, |
|
269 CMediaRecognizer::TMediaType aMediaType ); |
|
270 |
|
271 void HandleMultiLinksFileL( RFile& aFile, |
|
272 CMediaRecognizer::TMediaType aMediaType ); |
|
273 |
|
274 void DoHandleMultiLinksFileL( CVideoPlaylistUtility* aPlaylistUtil, |
|
275 TBool aSingleLink, |
|
276 TBool aLocalFile ); |
|
277 |
|
278 /** |
|
279 * Handles the Url descriptor |
|
280 * |
|
281 * @param aUrl - the ulr to be handled |
|
282 */ |
|
283 void HandleUrlDesL(const TDesC& aUrl); |
|
284 |
|
285 TPtrC GetLinkLC( const TDesC& aFileName, |
|
286 CMediaRecognizer::TMediaType aMediaType, |
|
287 TBool aUseFileHandle = EFalse ); |
|
288 |
|
289 TInt HandleAiwGenericParamListL( const CAiwGenericParamList* aParams ); |
|
290 |
|
291 /** |
|
292 * Handle collection message |
|
293 * |
|
294 * @param aMessage collection message |
|
295 */ |
|
296 void DoHandleCollectionMessageL( CMPXMessage* aMessage ); |
|
297 |
|
298 void CreatePlaybackUtilityMemberVariablesL(); |
|
299 |
|
300 void CreateCollectionUtilityMemberVariablesL(); |
|
301 |
|
302 void CreateRemoteControlListenerL(); |
|
303 |
|
304 /* |
|
305 * Activates an active object to exit the application |
|
306 * @since 5.0 |
|
307 */ |
|
308 void ActivateExitActiveObject(); |
|
309 |
|
310 /* |
|
311 * Called to stop and exit the application |
|
312 * @since 9.2 |
|
313 * @return void |
|
314 */ |
|
315 virtual void DoExitApplicationL(); |
|
316 |
|
317 /* |
|
318 * used to send media info to plugin |
|
319 */ |
|
320 void UpdatePbPluginMediaL(); |
|
321 |
|
322 void ActivateVideoPlaybackView(); |
|
323 |
|
324 private: // data |
|
325 |
|
326 // |
|
327 // Owned Utilities |
|
328 // |
|
329 MMPXPlaybackUtility* iPlaybackUtility; |
|
330 //Do we need this? MMPXViewUtility* iViewUtility; |
|
331 MMPXCollectionUtility* iCollectionUtility; |
|
332 MMPXCollectionUiHelper* iCollectionUiHelper; // own |
|
333 |
|
334 TUid iVideoCollectionId; |
|
335 |
|
336 CIdle* iExitAo; |
|
337 CMediaRecognizer* iRecognizer; // own |
|
338 CMpxVideoEmbeddedPdlHandler* iPdlHandler; // own |
|
339 |
|
340 TInt iAccessPointId; |
|
341 TBool iMultilinkPlaylist; |
|
342 TBool iSeekable; |
|
343 TBool iUpdateSeekInfo; |
|
344 |
|
345 QMpxVideoPlaybackWrapper* iPlaybackWrapper; |
|
346 }; |
|
347 |
|
348 // |
|
349 // Inline methods |
|
350 // |
|
351 inline |
|
352 MMPXPlaybackUtility* CMpxVideoPlayerAppUiEngine::PlaybackUtility() |
|
353 { |
|
354 return iPlaybackUtility; |
|
355 } |
|
356 |
|
357 #endif // CMPXVIDEOPLAYERAPPUIENGINE_H |