150 |
153 |
151 stream.WriteInt32L(enableUI); |
154 stream.WriteInt32L(enableUI); |
152 |
155 |
153 stream.CommitL(); |
156 stream.CommitL(); |
154 CleanupStack::PopAndDestroy(&stream); |
157 CleanupStack::PopAndDestroy(&stream); |
155 //iSourceSinkData = buf->Ptr(0).AllocL(); |
158 |
156 |
159 // Add new data source |
157 //CleanupStack::PopAndDestroy(buf); |
160 MPX_DEBUG1("CMPXFileInfoUtility::OpenFileL()- AddDataSource()"); |
158 //} |
161 |
159 |
|
160 // User::LeaveIfError(iController->Reset()); |
|
161 |
|
162 |
|
163 // Add new data source |
|
164 User::LeaveIfError(iController->AddDataSource(KUidMmfFileSource, |
162 User::LeaveIfError(iController->AddDataSource(KUidMmfFileSource, |
165 buf->Ptr(0), |
163 buf->Ptr(0), |
166 dataSource)); |
164 dataSource)); |
167 |
165 |
|
166 MPX_DEBUG1("CMPXFileInfoUtility::OpenFileL()- AddDataSink()"); |
168 User::LeaveIfError(iController->AddDataSink(KUidMmfAudioOutput, |
167 User::LeaveIfError(iController->AddDataSink(KUidMmfAudioOutput, |
169 KNullDesC8)); |
168 KNullDesC8)); |
170 CleanupStack::PopAndDestroy(buf); |
169 CleanupStack::PopAndDestroy(buf); |
|
170 |
|
171 MPX_DEBUG1("CMPXFileInfoUtility::OpenFileL()--->"); |
|
172 |
171 } |
173 } |
172 |
174 |
173 // ---------------------------------------------------------------------------- |
175 // ---------------------------------------------------------------------------- |
174 // Reset file info utility |
176 // Reset file info utility |
175 // ---------------------------------------------------------------------------- |
177 // ---------------------------------------------------------------------------- |
176 // |
178 // |
177 void CMPXFileInfoUtility::Reset() |
179 void CMPXFileInfoUtility::Reset() |
178 { |
180 { |
179 // Reset the controller |
181 MPX_DEBUG1("CMPXFileInfoUtility::Reset()<---"); |
|
182 |
180 if(iController) |
183 if(iController) |
181 { |
184 { |
182 if(iCurrentControllerUid == 0x101FAFB1 || iCurrentControllerUid == 0x10283351 |
185 // This is just for RA, WMA does not use controller |
183 || iCurrentControllerUid == 0x10207B65 ) |
186 if( iCurrentControllerUid == 0x10207B65 ) // Helix Controller UID |
184 { |
187 { |
|
188 MPX_DEBUG1("CMPXFileInfoUtility::Reset(), Close Controller - only for RA "); |
185 iController->Close(); |
189 iController->Close(); |
186 delete iController; |
190 delete iController; |
187 iController = NULL; |
191 iController = NULL; |
188 } |
192 } |
189 else |
193 else |
190 { |
194 { |
191 iController->Reset(); |
195 MPX_DEBUG1("CMPXFileInfoUtility::Reset(), Reset Controller "); |
|
196 iController->Reset(); |
192 } |
197 } |
193 } |
198 } |
|
199 MPX_DEBUG1("CMPXFileInfoUtility::Reset()--->"); |
194 |
200 |
195 } |
201 } |
196 |
202 |
197 // ---------------------------------------------------------------------------- |
203 // ---------------------------------------------------------------------------- |
198 // Get the duration of a song |
204 // Get the duration of a song |
199 // ---------------------------------------------------------------------------- |
205 // ---------------------------------------------------------------------------- |
200 // |
206 // |
201 TTimeIntervalMicroSeconds CMPXFileInfoUtility::Duration() |
207 TTimeIntervalMicroSeconds CMPXFileInfoUtility::Duration() |
202 { |
208 { |
203 MPX_DEBUG1("CMPXFileInfoUtility::Duration()"); |
209 MPX_DEBUG1("CMPXFileInfoUtility::Duration()<---"); |
204 TTimeIntervalMicroSeconds duration; |
210 TTimeIntervalMicroSeconds duration; |
205 TInt err = iController->GetDuration(duration); |
211 TInt err = iController->GetDuration(duration); |
206 if(err != KErrNone) |
212 if(err != KErrNone) |
207 { |
213 { |
208 duration = TInt64(0); |
214 duration = TInt64(0); |
209 } |
215 } |
|
216 MPX_DEBUG2("CMPXFileInfoUtility::Duration(), duration = %ld --->", duration ); |
|
217 |
210 return duration; |
218 return duration; |
211 } |
219 } |
212 |
220 |
213 // ---------------------------------------------------------------------------- |
221 // ---------------------------------------------------------------------------- |
214 // Get the bit rate of a song |
222 // Get the bit rate of a song |
215 // ---------------------------------------------------------------------------- |
223 // ---------------------------------------------------------------------------- |
216 // |
224 // |
217 TUint CMPXFileInfoUtility::BitRate() |
225 TUint CMPXFileInfoUtility::BitRate() |
218 { |
226 { |
|
227 MPX_DEBUG1("CMPXFileInfoUtility::BitRate()<---"); |
|
228 |
219 RMMFAudioControllerCustomCommands customCommands(*iController); |
229 RMMFAudioControllerCustomCommands customCommands(*iController); |
220 |
230 |
221 TUint bitRate(0); |
231 TUint bitRate(0); |
222 //Ignore return value, bitRate remain 0 if error |
232 //Ignore return value, bitRate remain 0 if error |
223 customCommands.GetSourceBitRate(bitRate); |
233 customCommands.GetSourceBitRate(bitRate); |
|
234 |
|
235 MPX_DEBUG2("CMPXFileInfoUtility::BitRate(), bit rate = %d --->", bitRate); |
|
236 |
224 return bitRate; |
237 return bitRate; |
225 } |
238 } |
226 |
239 |
227 // ---------------------------------------------------------------------------- |
240 // ---------------------------------------------------------------------------- |
228 // Get the sample rate of a song |
241 // Get the sample rate of a song |
229 // ---------------------------------------------------------------------------- |
242 // ---------------------------------------------------------------------------- |
230 // |
243 // |
231 TUint CMPXFileInfoUtility::SampleRate() |
244 TUint CMPXFileInfoUtility::SampleRate() |
232 { |
245 { |
|
246 MPX_DEBUG1("CMPXFileInfoUtility::SampleRate()<---"); |
|
247 |
233 RMMFAudioControllerCustomCommands customCommands(*iController); |
248 RMMFAudioControllerCustomCommands customCommands(*iController); |
234 |
249 |
235 TUint sampleRate(0) ; |
250 TUint sampleRate(0) ; |
236 //Ignore return value, sampleRate remain 0 if error |
251 //Ignore return value, sampleRate remain 0 if error |
237 customCommands.GetSourceSampleRate(sampleRate); |
252 customCommands.GetSourceSampleRate(sampleRate); |
|
253 |
|
254 MPX_DEBUG2("CMPXFileInfoUtility::SampleRate(), sample rate = %d --->", sampleRate); |
|
255 |
238 return sampleRate; |
256 return sampleRate; |
239 } |
257 } |
240 |
258 |
241 // ---------------------------------------------------------------------------- |
259 // ---------------------------------------------------------------------------- |
242 // Find a controller based on mime type, then file name |
260 // Find a controller based on mime type, then file name |
243 // ---------------------------------------------------------------------------- |
261 // ---------------------------------------------------------------------------- |
244 void CMPXFileInfoUtility::FindController(const TDesC& aFileName, |
262 void CMPXFileInfoUtility::FindController(const TDesC& aFileName, |
245 const TDesC& aMimeType, |
263 const TDesC& aMimeType, |
246 TUid& aUid) |
264 TUid& aUid) |
247 { |
265 { |
248 MPX_DEBUG1("CMPXFileInfoUtility::FindControllerL()"); |
266 MPX_DEBUG1("CMPXFileInfoUtility::FindControllerL()<---"); |
|
267 |
249 TBool found(EFalse); |
268 TBool found(EFalse); |
250 TInt i(0); |
269 TInt i(0); |
251 TInt j(0); |
270 TInt j(0); |
252 TInt count = iAudioControllers.Count(); |
271 TInt count = iAudioControllers.Count(); |
253 |
272 |
290 break; |
309 break; |
291 } |
310 } |
292 } |
311 } |
293 } |
312 } |
294 } |
313 } |
|
314 |
|
315 MPX_DEBUG1("CMPXFileInfoUtility::FindControllerL()--->"); |
|
316 |
295 } |
317 } |
296 |
318 |
297 // ---------------------------------------------------------------------------- |
319 // ---------------------------------------------------------------------------- |
298 // Open a controller based on file name |
320 // Open a controller based on file name |
299 // The Controller Framework APIs are made of three distinct areas: choosing a |
321 // The Controller Framework APIs are made of three distinct areas: choosing a |
300 // controller plugin, loading and controlling a controller plugin, and custom |
322 // controller plugin, loading and controlling a controller plugin, and custom |
301 // commands. |
323 // commands. |
302 // ---------------------------------------------------------------------------- |
324 // ---------------------------------------------------------------------------- |
303 void CMPXFileInfoUtility::OpenControllerL(const TUid& aUid) |
325 void CMPXFileInfoUtility::OpenControllerL(const TUid& aUid) |
304 { |
326 { |
305 MPX_DEBUG1("CMPXFileInfoUtility::OpenControllerL()"); |
327 MPX_DEBUG1("CMPXFileInfoUtility::OpenControllerL()<---"); |
306 |
328 |
307 // 3gp and helix (wma) do not allow controller caching |
329 // RA does not allow controller caching |
308 if(aUid.iUid == 0x101FAFB1 || aUid.iUid == 0x10283351 |
330 if( aUid.iUid == 0x10207B65 ) // RA Controller Uid |
309 || aUid.iUid == 0x10207B65 ) |
|
310 { |
331 { |
311 iCurrentControllerUid = aUid.iUid; |
332 iCurrentControllerUid = aUid.iUid; |
312 TMMFPrioritySettings prioritySettings; |
333 TMMFPrioritySettings prioritySettings; |
313 prioritySettings.iPriority = EMdaPriorityNormal; |
334 prioritySettings.iPriority = EMdaPriorityNormal; |
314 prioritySettings.iPref = EMdaPriorityPreferenceTimeAndQuality; |
335 prioritySettings.iPref = EMdaPriorityPreferenceTimeAndQuality; |
351 |
375 |
352 } |
376 } |
353 |
377 |
354 iController = controller; |
378 iController = controller; |
355 iCurrentControllerUid = aUid.iUid; |
379 iCurrentControllerUid = aUid.iUid; |
356 |
380 |
|
381 MPX_DEBUG1("CMPXFileInfoUtility::OpenControllerL()--->"); |
|
382 |
357 } |
383 } |
358 |
384 |
359 // ----------------------------------------------------------------------------- |
385 // ----------------------------------------------------------------------------- |
360 // CMPXFileInfoUtility::CreateAudioFormatsArrayL |
386 // CMPXFileInfoUtility::CreateAudioFormatsArrayL |
361 // ----------------------------------------------------------------------------- |
387 // ----------------------------------------------------------------------------- |
362 // |
388 // |
363 void CMPXFileInfoUtility::CreateAudioFormatsArrayL() |
389 void CMPXFileInfoUtility::CreateAudioFormatsArrayL() |
364 { |
390 { |
|
391 MPX_DEBUG1("CMPXFileInfoUtility::CreateAudioFormatsArrayL()<---"); |
|
392 |
365 CMMFControllerPluginSelectionParameters* cSelect = |
393 CMMFControllerPluginSelectionParameters* cSelect = |
366 CMMFControllerPluginSelectionParameters::NewLC(); |
394 CMMFControllerPluginSelectionParameters::NewLC(); |
367 CMMFFormatSelectionParameters* fSelect = |
395 CMMFFormatSelectionParameters* fSelect = |
368 CMMFFormatSelectionParameters::NewLC(); |
396 CMMFFormatSelectionParameters::NewLC(); |
369 // Set the play and record format selection parameters to be blank. |
397 // Set the play and record format selection parameters to be blank. |