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: Proxy for downloading upnp files and playing locally |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef __CUPNPMUSICDOWNLOADPROXY_H__ |
|
24 #define __CUPNPMUSICDOWNLOADPROXY_H__ |
|
25 |
|
26 // INCLUDES |
|
27 #include <badesca.h> |
|
28 #include <mpxplaybackplugin.h> |
|
29 #include <mpxplaybackpluginobserver.h> |
|
30 #include "upnptrackobserver.h" |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CUPnPSingleton; |
|
34 class CUPnPTrack; |
|
35 class MDesCArray; // for MPX compatibility - actually this is NOT a class |
|
36 |
|
37 |
|
38 /** |
|
39 * UPnP Proxy class for Local Player. |
|
40 * |
|
41 * Provides additional UPnP download functionality: first |
|
42 * downloads the file and then uses the underlying plugin to |
|
43 * execute commands (play,stop,pause) on the local copy of the |
|
44 * song |
|
45 * |
|
46 * @lib upnpmusicplugins.lib |
|
47 * @since S60 v3.1 |
|
48 */ |
|
49 class CUPnPMusicDownloadProxy : public CMPXPlaybackPlugin, |
|
50 public MMPXPlaybackPluginObserver, |
|
51 public MUPnPTrackObserver |
|
52 { |
|
53 |
|
54 private: |
|
55 |
|
56 /** |
|
57 * Defines internal player state |
|
58 * |
|
59 * EStateUninitialised - Initial and terminal state |
|
60 * EStatePreparing - Preparatory phases before download |
|
61 * EStateDownloading - Downloading the temporary file |
|
62 * EStateInitialisingLocally - Download is complete, starting to |
|
63 * initialize proxied local plugin |
|
64 * EStateActive - Init complete, now acting as a proxy for |
|
65 * the local plugin to play the temp file |
|
66 * @since Series 60 3.1 |
|
67 */ |
|
68 enum TProxyState |
|
69 { |
|
70 EStateUninitialised = 0, // initial state |
|
71 EStatePreparing, // preparatory phases |
|
72 EStateDownloading, // download phase |
|
73 EStateInitialisingLocally, // local init |
|
74 EStateActive, // normal |
|
75 EStateClosing // used if error during initialise |
|
76 }; |
|
77 public: |
|
78 |
|
79 /** |
|
80 * Static 1st phase constructor. |
|
81 * |
|
82 * @since Series 60 3.1 |
|
83 * @param aObs reference to call back interface |
|
84 * @return A new player instance |
|
85 */ |
|
86 static CUPnPMusicDownloadProxy* NewL( MMPXPlaybackPluginObserver& aObs ); |
|
87 |
|
88 /** |
|
89 * Destructor |
|
90 * |
|
91 * @since Series 60 3.1 |
|
92 */ |
|
93 ~CUPnPMusicDownloadProxy(); |
|
94 |
|
95 |
|
96 private: |
|
97 |
|
98 /** |
|
99 * Private default constructor |
|
100 * |
|
101 * @since Series 60 3.1 |
|
102 * @param aObs reference to call back interface |
|
103 */ |
|
104 CUPnPMusicDownloadProxy( MMPXPlaybackPluginObserver& aObs ); |
|
105 |
|
106 /** |
|
107 * 2nd phase constructor |
|
108 * |
|
109 * @since Series 60 3.1 |
|
110 */ |
|
111 void ConstructL(); |
|
112 |
|
113 public: // From CMPXPlaybackPlugin |
|
114 |
|
115 /** |
|
116 * See CMPXPlaybackPlugin |
|
117 */ |
|
118 void InitialiseL( const TDesC& aSong ); |
|
119 |
|
120 /** |
|
121 * See CMPXPlaybackPlugin |
|
122 */ |
|
123 void InitialiseL( RFile& aSong ); |
|
124 |
|
125 /** |
|
126 * See CMPXPlaybackPlugin |
|
127 */ |
|
128 void CommandL( TMPXPlaybackCommand aCmd, TInt aData ); |
|
129 |
|
130 /** |
|
131 * See CMPXPlaybackPlugin |
|
132 */ |
|
133 void SetL( TMPXPlaybackProperty aProperty, TInt aValue ); |
|
134 |
|
135 /** |
|
136 * See CMPXPlaybackPlugin |
|
137 */ |
|
138 void ValueL( TMPXPlaybackProperty aProperty ) const; |
|
139 |
|
140 /** |
|
141 * See CMPXPlaybackPlugin |
|
142 */ |
|
143 void SubPlayerNamesL(); |
|
144 |
|
145 /** |
|
146 * See CMPXPlaybackPlugin |
|
147 */ |
|
148 void SelectSubPlayerL(TInt aIndex); |
|
149 |
|
150 /** |
|
151 * See CMPXPlaybackPlugin |
|
152 */ |
|
153 const TDesC& SubPlayerName(); |
|
154 |
|
155 /** |
|
156 * See CMPXPlaybackPlugin |
|
157 */ |
|
158 TInt SubPlayerIndex() const; |
|
159 |
|
160 /** |
|
161 * See CMPXPlaybackPlugin |
|
162 */ |
|
163 void MediaL( const TArray<TMPXAttribute>& aAttrs ); |
|
164 |
|
165 /** |
|
166 * See CMPXPlaybackPlugin |
|
167 */ |
|
168 void CancelRequest(); |
|
169 |
|
170 /** |
|
171 * See CMPXPlaybackPlugin |
|
172 */ |
|
173 void SetObserver(MMPXPlaybackPluginObserver& aObs); |
|
174 |
|
175 protected: // From MMPXPlaybackPluginObserver |
|
176 |
|
177 /** |
|
178 * See MMPXPlaybackPluginObserver |
|
179 */ |
|
180 void HandlePluginEvent( TEvent aEvent, TInt aData, TInt aError ); |
|
181 |
|
182 /** |
|
183 * see MMPXPlaybackPluginObserver's base class MMPXPlaybackCallback |
|
184 */ |
|
185 void HandleProperty( TMPXPlaybackProperty aProperty, TInt aValue, |
|
186 TInt aError ); |
|
187 |
|
188 /** |
|
189 * see MMPXPlaybackPluginObserver's base class MMPXPlaybackCallback |
|
190 */ |
|
191 void HandleSubPlayerNames( TUid aPlayer, const MDesCArray* aSubPlayers, |
|
192 TBool aComplete, TInt aError ); |
|
193 |
|
194 /** |
|
195 * see MMPXPlaybackPluginObserver's base class MMPXPlaybackCallback |
|
196 */ |
|
197 void HandleMedia( const CMPXMedia& aProperties, TInt aError ); |
|
198 |
|
199 protected: // From MUPnPTrackObserver |
|
200 |
|
201 /** |
|
202 * See MUPnPTrackObserver |
|
203 */ |
|
204 void ResolveURIComplete( TInt aError ); |
|
205 |
|
206 private: |
|
207 |
|
208 /** |
|
209 * cleanup when going in uninitialised state |
|
210 */ |
|
211 void Cleanup(); |
|
212 |
|
213 private: // Data |
|
214 |
|
215 /** |
|
216 * Local plugin instance |
|
217 * Own. |
|
218 */ |
|
219 CMPXPlaybackPlugin* iLocalPlayer; |
|
220 |
|
221 /** |
|
222 * The UPnP services singleton |
|
223 * Own. |
|
224 */ |
|
225 CUPnPSingleton* iSingleton; |
|
226 |
|
227 /** |
|
228 * Player state |
|
229 */ |
|
230 mutable TProxyState iProxyState; |
|
231 |
|
232 /** |
|
233 * UPnP track |
|
234 * Own. |
|
235 */ |
|
236 CUPnPTrack* iTrack; |
|
237 }; |
|
238 |
|
239 #endif // __CUPNPMUSICDOWNLOADPROXY_H__ |
|
240 |
|
241 |
|
242 |
|
243 |
|