29
|
1 |
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
/**
|
|
17 |
@file
|
|
18 |
@internalComponent
|
|
19 |
*/
|
|
20 |
|
|
21 |
#ifndef CMTPPLAYBACKCONTROLIMPL_H
|
|
22 |
#define CMTPPLAYBACKCONTROLIMPL_H
|
|
23 |
|
|
24 |
#include <mpxplaybackobserver.h>
|
|
25 |
|
|
26 |
#include "mmtpplaybackinterface.h"
|
|
27 |
#include "mtpplaybackcontrolconst.h"
|
|
28 |
|
|
29 |
class MMPXPlaybackUtility;
|
|
30 |
class CMPXCollectionPath;
|
|
31 |
class CMPXCollectionPlaylist;
|
|
32 |
|
|
33 |
class CMTPPlaybackCommandChecker;
|
|
34 |
class CMTPPlaybackPlaylistHelper;
|
|
35 |
class CMTPPlaybackResumeHelper;
|
|
36 |
class CMTPPlaybackCommand;
|
|
37 |
class CMTPPbCmdParam;
|
|
38 |
|
|
39 |
|
|
40 |
NONSHARABLE_CLASS( CMTPPlaybackControlImpl ) : public CActive,
|
|
41 |
public MMPXPlaybackObserver,
|
|
42 |
public MMPXPlaybackCallback,
|
|
43 |
public MMTPPlaybackControl
|
|
44 |
{
|
|
45 |
private:
|
|
46 |
|
|
47 |
friend class CMTPPlaybackCommandChecker;
|
|
48 |
friend class CMTPPlaybackPlaylistHelper;
|
|
49 |
friend class CMTPPlaybackResumeHelper;
|
|
50 |
|
|
51 |
public: // Constructors and destructor
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Two-phased constructor.
|
|
55 |
*/
|
|
56 |
static CMTPPlaybackControlImpl* NewL( MMTPPlaybackObserver& aObserver );
|
|
57 |
/**
|
|
58 |
* Frees resource, and destroy the object itself.
|
|
59 |
*/
|
|
60 |
void Close();
|
|
61 |
/**
|
|
62 |
* Destructor.
|
|
63 |
*/
|
|
64 |
virtual ~CMTPPlaybackControlImpl();
|
|
65 |
|
|
66 |
public:
|
|
67 |
/**
|
|
68 |
* From MMTPPlaybackControl
|
|
69 |
* @param aCmd, refer to CMTPPlaybackCommand
|
|
70 |
* @param aCallback, refer to MMTPPlaybackCallback
|
|
71 |
*/
|
|
72 |
void CommandL( CMTPPlaybackCommand& aCmd,
|
|
73 |
MMTPPlaybackCallback* aCallback = NULL);
|
|
74 |
|
|
75 |
private:
|
|
76 |
|
|
77 |
/**
|
|
78 |
* From MMPXPlaybackObserver
|
|
79 |
* See mpxplaybackobserver.h for detailed description.
|
|
80 |
*/
|
|
81 |
void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
|
|
82 |
|
|
83 |
/**
|
|
84 |
* From MMPXPlaybackCallback
|
|
85 |
* See mpxplaybackobserver.h for detailed description.
|
|
86 |
*/
|
|
87 |
void HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError );
|
|
88 |
|
|
89 |
/**
|
|
90 |
* From MMPXPlaybackCallback
|
|
91 |
* See mpxplaybackobserver.h for detailed description.
|
|
92 |
*/
|
|
93 |
void HandleSubPlayerNamesL( TUid aPlayer, const MDesCArray* aSubPlayers, TBool aComplete, TInt aError );
|
|
94 |
|
|
95 |
/**
|
|
96 |
* From MMPXPlaybackCallback
|
|
97 |
* See mpxplaybackobserver.h for detailed description.
|
|
98 |
*/
|
|
99 |
void HandleMediaL( const CMPXMedia& aMedia, TInt aError );
|
|
100 |
|
|
101 |
private:// From CActive
|
|
102 |
|
|
103 |
/**
|
|
104 |
* DoCancel.
|
|
105 |
*/
|
|
106 |
void DoCancel();
|
|
107 |
|
|
108 |
/**
|
|
109 |
* RunL.
|
|
110 |
*/
|
|
111 |
void RunL();
|
|
112 |
|
|
113 |
private:
|
|
114 |
|
|
115 |
/**
|
|
116 |
* C++ default constructor.
|
|
117 |
*/
|
|
118 |
CMTPPlaybackControlImpl( MMTPPlaybackObserver& aObserver );
|
|
119 |
|
|
120 |
/**
|
|
121 |
* By default Symbian 2nd phase constructor is private.
|
|
122 |
*/
|
|
123 |
void ConstructL();
|
|
124 |
|
|
125 |
private:
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Get Playlist from collection complete..
|
|
129 |
*/
|
|
130 |
void GetPlaylistFromCollectionCompleteL( const CMPXCollectionPlaylist& aPlaylist );
|
|
131 |
|
|
132 |
/**
|
|
133 |
* Deactive other player so that we can play
|
|
134 |
*/
|
|
135 |
void DeActiveOtherPlayerL();
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Check playback command and cache
|
|
139 |
*/
|
|
140 |
void CheckPlaybackCmdAndCacheL( CMTPPlaybackCommand& aCmd );
|
|
141 |
|
|
142 |
/**
|
|
143 |
* UpdateCommandArrary
|
|
144 |
*/
|
|
145 |
void UpdateCommandArray();
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Require current media
|
|
149 |
*/
|
|
150 |
void RequestMediaL();
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Handle commandL
|
|
154 |
*/
|
|
155 |
void DoCommandL();
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Handle playback message
|
|
159 |
*
|
|
160 |
* @param aMessage playback message
|
|
161 |
*/
|
|
162 |
void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Handle playback property
|
|
166 |
*
|
|
167 |
* @param aProperty the property
|
|
168 |
* @param aValue the value of the property
|
|
169 |
*/
|
|
170 |
void DoHandlePropertyL( TInt aProperty, TInt aValue );
|
|
171 |
|
|
172 |
/**
|
|
173 |
* Handle playback state changed.
|
|
174 |
*
|
|
175 |
* @param aState New Playback state
|
|
176 |
*/
|
|
177 |
void DoHandleStateChangedL( TMPXPlaybackState aState );
|
|
178 |
|
|
179 |
/**
|
|
180 |
* Handle request media.
|
|
181 |
*/
|
|
182 |
void DoHandleMediaL( const CMPXMedia& aMedia );
|
|
183 |
|
|
184 |
/**
|
|
185 |
* Handle Media changed.
|
|
186 |
*
|
|
187 |
*/
|
|
188 |
void DoHandleMediaChangedL();
|
|
189 |
|
|
190 |
/**
|
|
191 |
* Handle Initialize Complete.
|
|
192 |
*
|
|
193 |
*/
|
|
194 |
void DoHandleInitializeCompleteL();
|
|
195 |
|
|
196 |
/**
|
|
197 |
* Handle error.
|
|
198 |
*
|
|
199 |
*/
|
|
200 |
void DoHandleError( TInt aErr );
|
|
201 |
|
|
202 |
/**
|
|
203 |
* Compare two path
|
|
204 |
* @param aPathBase the base path
|
|
205 |
* @param aPathNew the new path
|
|
206 |
* @param aLevel compare level
|
|
207 |
*/
|
|
208 |
TBool IfEqual( const CMPXCollectionPath& aPathBase, const CMPXCollectionPath& aPathNew, TUint aLevel );
|
|
209 |
|
|
210 |
/**
|
|
211 |
* Map states from TMPXPlaybackState to TMPlayerState
|
|
212 |
*
|
|
213 |
* @param aState State in TMPXPlaybackState format
|
|
214 |
* @return State in TMPlayerState format
|
|
215 |
*/
|
|
216 |
TMTPPlaybackState MapState( TMPXPlaybackState aState );
|
|
217 |
|
|
218 |
/**
|
|
219 |
* Map error from TInt to the error defined in interface
|
|
220 |
*/
|
|
221 |
TInt MapError( TInt error );
|
|
222 |
|
|
223 |
/**
|
|
224 |
*Complete a sync request
|
|
225 |
*/
|
|
226 |
void CompleteSelf( TInt aCompletionCode );
|
|
227 |
|
|
228 |
/*
|
|
229 |
* Initiate MPX Playback Command
|
|
230 |
*/
|
|
231 |
void InitiateMPXPlaybackCommandL( TMPXPlaybackCommand aCommand, TBool aIsMTPPlaybackUtility );
|
|
232 |
|
|
233 |
/*
|
|
234 |
* SendMPXPlaybackCommandL
|
|
235 |
*/
|
|
236 |
void SendMPXPlaybackCommandL( TMPXPlaybackCommand aCommand, TBool aIsMTPPlaybackUtility );
|
|
237 |
|
|
238 |
|
|
239 |
/*
|
|
240 |
* SendPlaybackCommandCompleteL
|
|
241 |
*/
|
|
242 |
void SendPlaybackCommandCompleteL();
|
|
243 |
|
|
244 |
/*
|
|
245 |
* SendPlaybackEventL
|
|
246 |
*/
|
|
247 |
void SendPlaybackEventL( TMTPPlaybackEvent aEvt );
|
|
248 |
|
|
249 |
/**
|
|
250 |
* Reset playback command
|
|
251 |
*/
|
|
252 |
void ResetPlaybackCommand();
|
|
253 |
|
|
254 |
private:
|
|
255 |
|
|
256 |
/**
|
|
257 |
* return current state.
|
|
258 |
*/
|
|
259 |
TMPXPlaybackState CurrentState() const;
|
|
260 |
|
|
261 |
/**
|
|
262 |
* return previous state.
|
|
263 |
*/
|
|
264 |
TMPXPlaybackState PreviousState() const;
|
|
265 |
|
|
266 |
/**
|
|
267 |
* return song count.
|
|
268 |
*/
|
|
269 |
TInt32 SongCount() const;
|
|
270 |
|
|
271 |
/**
|
|
272 |
* return song index.
|
|
273 |
*/
|
|
274 |
TInt32 SongIndex() const;
|
|
275 |
|
|
276 |
/**
|
|
277 |
* Cache mtp playback command.
|
|
278 |
*/
|
|
279 |
void SetMTPPBCmd( TMTPPlaybackCommand aMTPPBCmd );
|
|
280 |
|
|
281 |
/**
|
|
282 |
* return mtp playback command.
|
|
283 |
*/
|
|
284 |
TMTPPlaybackCommand MTPPBCmdHandling() const;
|
|
285 |
|
|
286 |
private:
|
|
287 |
|
|
288 |
MMTPPlaybackObserver* iObserver;// Not owned
|
|
289 |
MMTPPlaybackCallback* iCallback;// Not owned
|
|
290 |
|
|
291 |
MMPXPlaybackUtility* iPlaybackUtility;// Owned
|
|
292 |
MMPXPlaybackUtility* iNowActivePlaybackUtility;// Owned
|
|
293 |
|
|
294 |
CMTPPlaybackCommandChecker* iPlaybackCommandChecker;//Owned
|
|
295 |
CMTPPlaybackPlaylistHelper* iPlaybackPlaylistHelper;//Owned
|
|
296 |
CMTPPlaybackResumeHelper* iPlaybackResumeHelper;
|
|
297 |
|
|
298 |
CMPXCollectionPlaylist* iPlayList; //Owned
|
|
299 |
RResumeCmdArray iPrepareCmdArray;//Owned
|
|
300 |
RResumeCmdArray iResumeCmdArray;//Owned
|
|
301 |
CMTPPbCmdParam* iCmdParam;
|
|
302 |
|
|
303 |
TMTPPlaybackCommand iMTPPBCmd;
|
|
304 |
TMPXPlaybackState iPreState;
|
|
305 |
TMPXPlaybackState iState;
|
|
306 |
};
|
|
307 |
|
|
308 |
#endif // CMTPPLAYBACKCONTROLIMPL_H
|
|
309 |
// End of File
|