|
1 /* |
|
2 * Copyright (c) 2006 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 manages progress download via Enhanced Media Client |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CMPXProgressDownloadSBSB_H |
|
21 #define CMPXProgressDownloadSBSB_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <caf/content.h> |
|
25 #include <mpxplaybackplugin.h> |
|
26 #include <mpxcenrepobserver.h> |
|
27 #include <mpxplaybackcommanddefs.h> |
|
28 |
|
29 #include <MMControlFactory.h> |
|
30 #include <StreamControl.h> |
|
31 #include <SinkControl.h> |
|
32 #include <ControlObserver.h> |
|
33 #include <Events.h> |
|
34 #include <ProgDLSource.h> |
|
35 #include <SourceControlObserver.h> |
|
36 #include <StreamControlObserver.h> |
|
37 #include <VolumeControl.h> |
|
38 #include <apgcli.h> |
|
39 |
|
40 using multimedia::MStreamControl; |
|
41 using multimedia::MControlObserver; |
|
42 using multimedia::MProgDLSource; |
|
43 using multimedia::MControl; |
|
44 using multimedia::MSinkControl; |
|
45 using multimedia::CMultimediaFactory; |
|
46 using multimedia::MVolumeControl; |
|
47 |
|
48 |
|
49 |
|
50 // FORWARD DECLARATIONS |
|
51 class CMPXCenRepWatcher; |
|
52 class CMPXDrmMediaUtility; |
|
53 class RMMFDRMCustomCommands; |
|
54 // CONSTANTS |
|
55 |
|
56 // CLASS DECLARATION |
|
57 |
|
58 /** |
|
59 * CMPXProgressDownloadSB class |
|
60 * |
|
61 * Plug-in basically handles download via S60's enhanced media client. |
|
62 * @lib mpxprogressdownloadsb.lib |
|
63 */ |
|
64 NONSHARABLE_CLASS(CMPXProgressDownloadSB) : public CMPXPlaybackPlugin, |
|
65 public MMPXCenRepObserver, |
|
66 public MControlObserver |
|
67 { |
|
68 private: |
|
69 enum TMPXLocalAudioPlaybackState |
|
70 { |
|
71 EStateNotInitialised, |
|
72 EStateInitialising, |
|
73 EStateInitialised |
|
74 }; |
|
75 public: // Constructors and destructor |
|
76 /** |
|
77 * Two-phased constructor. |
|
78 * @param aInitParams, initialization parameter |
|
79 * @return a pointer to the created instance |
|
80 */ |
|
81 static CMPXProgressDownloadSB* NewL(TAny* aInitParams); |
|
82 |
|
83 /** |
|
84 * Destructor |
|
85 * Destroy the object and release all memory objects |
|
86 */ |
|
87 ~CMPXProgressDownloadSB(); |
|
88 |
|
89 private: // Functions from base classes |
|
90 /** |
|
91 * from CMPXPlaybackPlugin |
|
92 */ |
|
93 |
|
94 /** |
|
95 * Initializes a song for playback |
|
96 * @param aSong the song path |
|
97 */ |
|
98 void InitialiseL(const TDesC& aSong); |
|
99 |
|
100 /** |
|
101 * Initializes a song for playback |
|
102 * @param aFile file handle of a song |
|
103 */ |
|
104 void InitialiseL(RFile& aFile); |
|
105 |
|
106 /** |
|
107 * Executes a command on the selected song |
|
108 * @param aCmd a command |
|
109 * @param aData data (optional) |
|
110 */ |
|
111 void CommandL(TMPXPlaybackCommand aCmd, TInt aData=0); |
|
112 |
|
113 /** |
|
114 * Executes a command |
|
115 * @param aCmd Command |
|
116 */ |
|
117 void CommandL(CMPXCommand& aCmd); |
|
118 |
|
119 /** |
|
120 * Sets a property of the plugin |
|
121 * @param aProperty a property |
|
122 * @param aValue the value of the setting |
|
123 */ |
|
124 void SetL(TMPXPlaybackProperty aProperty,TInt aValue); |
|
125 |
|
126 /** |
|
127 * Gets a property of the plugin (async) |
|
128 * @param aProperty a property |
|
129 */ |
|
130 void PropertyL(TMPXPlaybackProperty aProperty) const; |
|
131 |
|
132 /** |
|
133 * Gets a list of sub players |
|
134 * @return a list of names of sub players |
|
135 */ |
|
136 void SubPlayerNamesL(); |
|
137 |
|
138 /** |
|
139 * Select a sub player |
|
140 * @param aIndex index to the sub player |
|
141 */ |
|
142 void SelectSubPlayerL(TInt aIndex); |
|
143 |
|
144 /** |
|
145 * Returns current sub player name |
|
146 * @return friendly name of the current the sub player |
|
147 */ |
|
148 const TDesC& SubPlayerName(); |
|
149 |
|
150 /** |
|
151 * Current sub player index |
|
152 * @return index to the sub player |
|
153 */ |
|
154 TInt SubPlayerIndex() const; |
|
155 |
|
156 /** |
|
157 * Media properties of the current file (async) |
|
158 * @param aAttrs attributes requested |
|
159 */ |
|
160 void MediaL(const TArray<TMPXAttribute>& aAttrs); |
|
161 |
|
162 /** |
|
163 * Cancel async request |
|
164 */ |
|
165 void CancelRequest(); |
|
166 |
|
167 |
|
168 /** |
|
169 * From MControlObserver |
|
170 */ |
|
171 void Event( MControl* aControl, TUint aEventType, TAny* aEventObject ); |
|
172 |
|
173 |
|
174 /** |
|
175 * From MMPXCenRepObserver |
|
176 * Handle a change in a setting value. |
|
177 * |
|
178 * @param aRepositoryUid Central repository UID containing the setting |
|
179 * @param aSettingId Id of the setting |
|
180 * @since 3.0 |
|
181 */ |
|
182 void HandleSettingChange( const TUid& aRepositoryUid, |
|
183 TUint32 aSettingId); |
|
184 |
|
185 private: |
|
186 /** |
|
187 * C++ default constructor |
|
188 */ |
|
189 CMPXProgressDownloadSB(); |
|
190 |
|
191 /** |
|
192 * the second phase constructor ConstructL to safely construct things |
|
193 * that can leave |
|
194 */ |
|
195 void ConstructL(); |
|
196 |
|
197 /** |
|
198 * Sets the volume level in audio controller |
|
199 * @param aVolume Volume level, ranges from 0 - KPbPlaybackVolumeLevelMax |
|
200 */ |
|
201 void SetVolume( TInt aVolume ); |
|
202 |
|
203 /** |
|
204 * Sets the volume level in audio controller to mute. |
|
205 * @param aMute ETrue to indicated mute |
|
206 */ |
|
207 void SetMute( TBool aMute ); |
|
208 |
|
209 void ResetEnhancedMediaClient(); |
|
210 |
|
211 void MoveDownloadedFileToMusicFolderL(); |
|
212 |
|
213 /** |
|
214 * Consumes the rights for the current media according |
|
215 * to the specified consume type |
|
216 * |
|
217 * @param aType Type of consumption to execute |
|
218 */ |
|
219 void ConsumeRights(ContentAccess::TIntent aIntent); |
|
220 private: // Data |
|
221 |
|
222 RFs iFs; |
|
223 |
|
224 CMPXCenRepWatcher* iVolumeWatcher; |
|
225 CMPXCenRepWatcher* iMuteWatcher; |
|
226 |
|
227 TInt32 iDownloadID; |
|
228 MStreamControl* iMStreamControl; // owned |
|
229 MSinkControl* iMAudioSink; // owned |
|
230 MProgDLSource* iMAudioProgDLSource; // owned |
|
231 MVolumeControl* iMVolumeControl; // owned |
|
232 CMultimediaFactory* iFactory; // owned |
|
233 TBool iStreamBuffering; |
|
234 TBool iFirstBuffer; |
|
235 TBool iFileSaved; |
|
236 RMMFDRMCustomCommands* iDrmCustomCommand; |
|
237 |
|
238 RFile* iFileHandle; // not owned |
|
239 HBufC16* iPdPath; |
|
240 TUint iTransactionId; |
|
241 TInt iVolume; |
|
242 TInt iFeatureFlag; |
|
243 CMPXDrmMediaUtility* iDrmMediaUtility; |
|
244 TMPXPlaybackPdDownloadState iDownloadState; |
|
245 TInt iDownloadBytes; |
|
246 TInt iDownloadSize; |
|
247 TMPXLocalAudioPlaybackState iState; |
|
248 TFileName iMovedFileName; |
|
249 TDataType iMimeType; |
|
250 TBool iPlaying; |
|
251 TBool iConsumeStarted; |
|
252 TBool iOngoingCmdCancelDownload; |
|
253 TInt iErrorOfStreamClosedEvent; |
|
254 |
|
255 }; |
|
256 |
|
257 #endif // CMPXProgressDownloadSBSB_H |
|
258 |
|
259 |