|
1 /* |
|
2 * Copyright (c) 2010 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: Factory method to create playback utility object |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <bamdesca.h> |
|
19 #include <s32mem.h> |
|
20 #include <e32math.h> |
|
21 #include <mpxcmn.h> |
|
22 #include <mpxplaybackobserver.h> |
|
23 #include <mpxcollectionplaylist.h> |
|
24 #include <mpxmedia.h> |
|
25 #include <mpxmessagemonitor.h> |
|
26 #include <mpxtaskqueue.h> |
|
27 #include <mpxuser.h> |
|
28 #include <mpxmessagegeneraldefs.h> |
|
29 #include <mpxcommandgeneraldefs.h> |
|
30 #include <mpxcollectionpath.h> |
|
31 #include <mpxvideoplaybackdefs.h> |
|
32 |
|
33 #include"mpxplaybackutility.h" |
|
34 |
|
35 |
|
36 // ============================== MEMBER FUNCTIONS ================================================= |
|
37 |
|
38 // ------------------------------------------------------------------------------------------------- |
|
39 // Creates the playback utility object if not already created |
|
40 // ------------------------------------------------------------------------------------------------- |
|
41 // |
|
42 MMPXPlaybackUtility* MMPXPlaybackUtility::UtilityL( const TMPXCategory /*aCategory*/, |
|
43 const TUid& /*aModeId*/ ) |
|
44 { |
|
45 return CMPXPlaybackUtility::NewL(); |
|
46 } |
|
47 |
|
48 // ------------------------------------------------------------------------------------------------- |
|
49 // Two phases constructor |
|
50 // ------------------------------------------------------------------------------------------------- |
|
51 // |
|
52 CMPXPlaybackUtility* CMPXPlaybackUtility::NewL() |
|
53 { |
|
54 CMPXPlaybackUtility* p = new(ELeave)CMPXPlaybackUtility(); |
|
55 CleanupStack::PushL(p); |
|
56 p->ConstructL(); |
|
57 CleanupStack::Pop(p); |
|
58 return p; |
|
59 } |
|
60 |
|
61 // ------------------------------------------------------------------------------------------------- |
|
62 // Destructor |
|
63 // ------------------------------------------------------------------------------------------------- |
|
64 // |
|
65 CMPXPlaybackUtility::~CMPXPlaybackUtility() |
|
66 { |
|
67 } |
|
68 |
|
69 // ------------------------------------------------------------------------------------------------- |
|
70 // C++ constructor |
|
71 // Create a unique name out of thread ID and this pointer: no other instance of |
|
72 // this object will have the same name; used to identify this object for |
|
73 // recieving messages |
|
74 // ------------------------------------------------------------------------------------------------- |
|
75 // |
|
76 CMPXPlaybackUtility::CMPXPlaybackUtility() |
|
77 { |
|
78 } |
|
79 |
|
80 // ------------------------------------------------------------------------------------------------- |
|
81 // 2nd construtor |
|
82 // ------------------------------------------------------------------------------------------------- |
|
83 // |
|
84 void CMPXPlaybackUtility::ConstructL() |
|
85 { |
|
86 iState = EPbStateInitialised; |
|
87 } |
|
88 |
|
89 // ------------------------------------------------------------------------------------------------- |
|
90 // Add a observer |
|
91 // ------------------------------------------------------------------------------------------------- |
|
92 // |
|
93 void CMPXPlaybackUtility::AddObserverL( MMPXPlaybackObserver& /*aObs*/ ) |
|
94 { |
|
95 } |
|
96 |
|
97 // ------------------------------------------------------------------------------------------------- |
|
98 // Remove a observer |
|
99 // ------------------------------------------------------------------------------------------------- |
|
100 // |
|
101 void CMPXPlaybackUtility::RemoveObserverL( MMPXPlaybackObserver& /* aObs */ ) |
|
102 { |
|
103 } |
|
104 |
|
105 // ------------------------------------------------------------------------------------------------- |
|
106 // Delete this |
|
107 // ------------------------------------------------------------------------------------------------- |
|
108 // |
|
109 void CMPXPlaybackUtility::Close() |
|
110 { |
|
111 delete this; |
|
112 } |
|
113 |
|
114 // ------------------------------------------------------------------------------------------------- |
|
115 // Issue player commands |
|
116 // ------------------------------------------------------------------------------------------------- |
|
117 // |
|
118 void CMPXPlaybackUtility::CommandL( TMPXPlaybackCommand aCmd ) |
|
119 { |
|
120 iCommand = aCmd; |
|
121 } |
|
122 |
|
123 // ------------------------------------------------------------------------------------------------- |
|
124 // Issue player commands |
|
125 // ------------------------------------------------------------------------------------------------- |
|
126 // |
|
127 void CMPXPlaybackUtility::CommandL( CMPXCommand& aCmd, MMPXPlaybackCallback* /* aCallback */ ) |
|
128 { |
|
129 TInt cmdType = aCmd.ValueTObjectL<TInt>( KMPXCommandGeneralId ); |
|
130 |
|
131 if ( cmdType == KMPXCommandIdPlaybackGeneral ) |
|
132 { |
|
133 iCommand = aCmd.ValueTObjectL<TInt>( KMPXCommandPlaybackGeneralType ); |
|
134 } |
|
135 else |
|
136 { |
|
137 iCommand = aCmd.ValueTObjectL<TInt>( KMPXMediaVideoPlaybackCommand ); |
|
138 } |
|
139 } |
|
140 |
|
141 // ------------------------------------------------------------------------------------------------- |
|
142 // Current state of player |
|
143 // ------------------------------------------------------------------------------------------------- |
|
144 // |
|
145 TMPXPlaybackState CMPXPlaybackUtility::StateL() const |
|
146 { |
|
147 return iState; |
|
148 } |
|
149 |
|
150 // ------------------------------------------------------------------------------------------------- |
|
151 // Determine whether there is a song by the state of the engine: if there is, |
|
152 // its OK to return MMPXMedia, else NULL is returned |
|
153 // ------------------------------------------------------------------------------------------------- |
|
154 // |
|
155 MMPXSource* CMPXPlaybackUtility::Source() |
|
156 { |
|
157 return this; |
|
158 } |
|
159 |
|
160 // ------------------------------------------------------------------------------------------------- |
|
161 // Set playback property, EPropertyChanged event when complete |
|
162 // ------------------------------------------------------------------------------------------------- |
|
163 // |
|
164 void CMPXPlaybackUtility::SetL( TMPXPlaybackProperty aProperty, TInt aValue ) |
|
165 { |
|
166 iProperty = aProperty; |
|
167 iPropertyValue = aValue; |
|
168 } |
|
169 |
|
170 // ------------------------------------------------------------------------------------------------- |
|
171 // Send property request |
|
172 // Result will be called back in HandleProperty |
|
173 // ------------------------------------------------------------------------------------------------- |
|
174 // |
|
175 void CMPXPlaybackUtility::PropertyL( |
|
176 MMPXPlaybackCallback& /* aCallback */, |
|
177 TMPXPlaybackProperty /* aProperty */) |
|
178 { |
|
179 } |
|
180 |
|
181 // ------------------------------------------------------------------------------------------------- |
|
182 // Path to the collection |
|
183 // ------------------------------------------------------------------------------------------------- |
|
184 // |
|
185 CMPXCollectionPlaylist* CMPXPlaybackUtility::PlaylistL() |
|
186 { |
|
187 CMPXCollectionPlaylist *playList = CMPXCollectionPlaylist::NewL(); |
|
188 |
|
189 return playList; |
|
190 } |
|
191 |
|
192 // ------------------------------------------------------------------------------------------------- |
|
193 // Request for media properties. |
|
194 // ------------------------------------------------------------------------------------------------- |
|
195 // |
|
196 void CMPXPlaybackUtility::MediaL( |
|
197 const TArray<TMPXAttribute>& /* aAttrs */, |
|
198 MMPXPlaybackCallback& /* aCallback */, |
|
199 CMPXAttributeSpecs* /* aSpecs */) |
|
200 { |
|
201 } |
|
202 |
|
203 // ------------------------------------------------------------------------------------------------- |
|
204 // Request for media properties. |
|
205 // ------------------------------------------------------------------------------------------------- |
|
206 // |
|
207 void CMPXPlaybackUtility::MediaL( |
|
208 const TArray<TMPXAttribute>& /* aAttrs */, MMPXPlaybackCallback& /* aCallback */ ) |
|
209 { |
|
210 } |
|
211 |
|
212 // ------------------------------------------------------------------------------------------------- |
|
213 // set primary client |
|
214 // ------------------------------------------------------------------------------------------------- |
|
215 // |
|
216 void CMPXPlaybackUtility::SetPrimaryClientL() |
|
217 { |
|
218 } |
|
219 |
|
220 // End of file |
|
221 |