1 /* |
|
2 * Copyright (c) 2007-2007 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: Engine which interfaces to MPX framework. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_AIPLAYERPLUGINENGINE_H |
|
20 #define C_AIPLAYERPLUGINENGINE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <mpxplaybackobserver.h> |
|
24 |
|
25 #include "aiplayerpluginengineobserver.h" |
|
26 |
|
27 class MMPXPlaybackUtility; |
|
28 |
|
29 |
|
30 /** |
|
31 * Music Player Player Plugin Engine. |
|
32 * This class provides interface to MPX framework. |
|
33 * |
|
34 * @lib aiplayerplugin2.lib |
|
35 * @since S60 5.0 |
|
36 */ |
|
37 NONSHARABLE_CLASS( CAiPlayerPluginEngine ) : public CBase, |
|
38 public MMPXPlaybackObserver, |
|
39 public MMPXPlaybackCallback |
|
40 { |
|
41 public: // Constructors and destructor |
|
42 |
|
43 /** |
|
44 * Two-phased constructor. |
|
45 */ |
|
46 static CAiPlayerPluginEngine* NewL( MAiPlayerPluginEngineObserver& aObserver ); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 virtual ~CAiPlayerPluginEngine(); |
|
52 |
|
53 /** |
|
54 * From MMPXPlaybackObserver |
|
55 * See mpxplaybackobserver.h for detailed description. |
|
56 * @since S60 5.0 |
|
57 */ |
|
58 void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError ); |
|
59 |
|
60 /** |
|
61 * From MMPXPlaybackCallback |
|
62 * See mpxplaybackobserver.h for detailed description. |
|
63 * @since S60 5.0 |
|
64 */ |
|
65 void HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError ); |
|
66 void HandleSubPlayerNamesL( TUid aPlayer, const MDesCArray* aSubPlayers, TBool aComplete, TInt aError ); |
|
67 void HandleMediaL( const CMPXMedia& aMedia, TInt aError ); |
|
68 void HandlePlaybackCommandComplete( CMPXCommand* aCommandResult, TInt aError ); |
|
69 |
|
70 public: |
|
71 |
|
72 /** |
|
73 * Get the current state of the active player. |
|
74 * |
|
75 * @return Active player state |
|
76 * @see TMPlayerState |
|
77 */ |
|
78 TMPlayerState PlayerState(); |
|
79 |
|
80 /** |
|
81 * Get the title of the currently playing song. |
|
82 * |
|
83 * @return Song title |
|
84 */ |
|
85 const TDesC& Title(); |
|
86 |
|
87 /** |
|
88 * Get the artist of the currently playing song. |
|
89 * |
|
90 * @return Artist |
|
91 */ |
|
92 const TDesC& Artist(); |
|
93 |
|
94 /** |
|
95 * Get the current position. |
|
96 * |
|
97 * @return Current position. |
|
98 */ |
|
99 TInt Position(); |
|
100 |
|
101 /** |
|
102 * Get the duration of the currently playing song. |
|
103 * |
|
104 * @return Song duration. |
|
105 */ |
|
106 TInt Duration(); |
|
107 |
|
108 /** |
|
109 * Get the current volume. |
|
110 * |
|
111 * @return Current volume. |
|
112 */ |
|
113 TInt Volume(); |
|
114 |
|
115 /** |
|
116 * Set volume. |
|
117 * |
|
118 * @param aVolume Volume level |
|
119 */ |
|
120 void SetVolumeL( TInt aVolume ); |
|
121 |
|
122 private: |
|
123 |
|
124 /** |
|
125 * C++ default constructor. |
|
126 */ |
|
127 CAiPlayerPluginEngine( MAiPlayerPluginEngineObserver& aObserver ); |
|
128 |
|
129 /** |
|
130 * By default Symbian 2nd phase constructor is private. |
|
131 */ |
|
132 void ConstructL(); |
|
133 |
|
134 /** |
|
135 * Handle playback message |
|
136 * |
|
137 * @param aMessage playback message |
|
138 */ |
|
139 void DoHandlePlaybackMessageL( const CMPXMessage& aMessage ); |
|
140 |
|
141 /** |
|
142 * Handle playback property |
|
143 * |
|
144 * @param aProperty the property |
|
145 * @param aValue the value of the property |
|
146 * @param aError error code |
|
147 */ |
|
148 void DoHandlePropertyL( TInt aProperty, TInt aValue, TInt aError ); |
|
149 |
|
150 /** |
|
151 * Handle playback state changed. |
|
152 * |
|
153 * @param aState New Playback state |
|
154 */ |
|
155 void DoHandleStateChangedL( TMPXPlaybackState aState ); |
|
156 |
|
157 /** |
|
158 * Displays error notes. |
|
159 * |
|
160 * @param aError Error ID to be handled. |
|
161 */ |
|
162 void HandleErrorL( TInt aError ); |
|
163 |
|
164 /** |
|
165 * Map states from TMPXPlaybackState to TMPlayerState |
|
166 * |
|
167 * @param aState State in TMPXPlaybackState format |
|
168 * @return State in TMPlayerState format, or KErrNotFound |
|
169 * if the state can't be mapped |
|
170 */ |
|
171 TMPlayerState MapState( TMPXPlaybackState aState ); |
|
172 |
|
173 /** |
|
174 * Map volume from MPX player to AI volume level. |
|
175 * |
|
176 * @param aVolume Volume level from MPX player |
|
177 * @return Volume level for AI. |
|
178 */ |
|
179 TInt MapToAiVolume( TInt aVolume ); |
|
180 |
|
181 /** |
|
182 * Map volume from AI to MPX player volume level. |
|
183 * |
|
184 * @param aVolume Volume level from AI |
|
185 * @return Volume level for MPX player. |
|
186 */ |
|
187 TInt MapToMpxVolume( TInt aVolume ); |
|
188 |
|
189 /** |
|
190 * Request media. |
|
191 */ |
|
192 void RequestMediaL(); |
|
193 |
|
194 private: // Data |
|
195 |
|
196 MAiPlayerPluginEngineObserver* iObserver; // Not owned |
|
197 MMPXPlaybackUtility* iPlaybackUtility; // Owned |
|
198 |
|
199 HBufC* iTitle; |
|
200 HBufC* iArtist; |
|
201 TInt iMaxVolume; |
|
202 TInt iVolume; |
|
203 TInt iPosition; |
|
204 TInt iDuration; |
|
205 }; |
|
206 |
|
207 #endif // C_CAiPlayerPluginEngine_H |
|
208 |
|
209 // End of File |
|