1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 #include <mtp/cmtptypeobjectpropdesc.h> |
|
18 #include <mtp/mtpprotocolconstants.h> |
|
19 #include <mtp/cmtptypestring.h> |
|
20 |
|
21 #include "cmediamtpdataprovidergetobjectpropdesc.h" |
|
22 #include "mediamtpdataproviderconst.h" |
|
23 #include "cmediamtpdataprovidergetformatcapabilities.h" |
|
24 #include "mmmtpdplogger.h" |
|
25 |
|
26 const TUint32 KMTPDescriptionLen = 0x00000200; |
|
27 |
|
28 // forward declaration |
|
29 class MMmMtpDpConfig; |
|
30 class CMTPTypeObjectPropDesc; |
|
31 class CMTPTypeInterdependentPropDesc; |
|
32 class CMTPTypeObjectPropDesc; |
|
33 class CMTPTypeString; |
|
34 class CGetFormatCapabilities; |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CMediaMtpDataProviderGetFormatCapabilities::NewL |
|
38 // Two-phase construction method |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 MMmRequestProcessor* CMediaMtpDataProviderGetFormatCapabilities::NewL( MMTPDataProviderFramework& aFramework, |
|
42 MMTPConnection& aConnection, |
|
43 MMmMtpDpConfig& aDpConfig ) |
|
44 { |
|
45 CMediaMtpDataProviderGetFormatCapabilities* self = |
|
46 new ( ELeave ) CMediaMtpDataProviderGetFormatCapabilities( aFramework, |
|
47 aConnection, |
|
48 aDpConfig ); |
|
49 CleanupStack::PushL( self ); |
|
50 self->ConstructL(); |
|
51 CleanupStack::Pop( self ); |
|
52 return self; |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CMediaMtpDataProviderGetFormatCapabilities::ConstructL |
|
57 // Two-phase construction method |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 void CMediaMtpDataProviderGetFormatCapabilities::ConstructL() |
|
61 { |
|
62 CGetFormatCapabilities::ConstructL(); |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CMediaMtpDataProviderGetFormatCapabilities::~CMediaMtpDataProviderGetFormatCapabilities() |
|
67 // Destructor |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 CMediaMtpDataProviderGetFormatCapabilities::~CMediaMtpDataProviderGetFormatCapabilities() |
|
71 { |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CMediaMtpDataProviderGetFormatCapabilities::CMediaMtpDataProviderGetFormatCapabilities |
|
76 // Standard c++ constructor |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 CMediaMtpDataProviderGetFormatCapabilities::CMediaMtpDataProviderGetFormatCapabilities( MMTPDataProviderFramework& aFramework, |
|
80 MMTPConnection& aConnection, |
|
81 MMmMtpDpConfig& aDpConfig ) : |
|
82 CGetFormatCapabilities( aFramework, aConnection, aDpConfig ) |
|
83 { |
|
84 |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CMediaMtpDataProviderGetFormatCapabilities::ServiceInterdepentPropDescL |
|
89 // |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 void CMediaMtpDataProviderGetFormatCapabilities::ServiceInterdepentPropDescL() |
|
93 { |
|
94 PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceInterdepentPropDescL" ) ); |
|
95 |
|
96 iInterdependentPropDesc = CMTPTypeInterdependentPropDesc::NewL(); |
|
97 |
|
98 TBool audioWaveCodecSupported = EFalse; |
|
99 TBool audioBitRateSupported = EFalse; |
|
100 TBool videoFourCcCodecSupported = EFalse; |
|
101 TBool videoBitRateSupported = EFalse; |
|
102 |
|
103 switch ( iFormatCode ) |
|
104 { |
|
105 case EMTPFormatCodeWMA: |
|
106 case EMTPFormatCodeMP3: |
|
107 case EMTPFormatCodeAAC: |
|
108 case EMTPFormatCodeWAV: |
|
109 { |
|
110 TInt count = sizeof( KMmMtpDpSupportedPropMandatoryAudio ) / sizeof( TUint16 ); |
|
111 |
|
112 for ( TInt i = 0; i < count; i++ ) |
|
113 { |
|
114 switch ( KMmMtpDpSupportedPropMandatoryAudio[i] ) |
|
115 { |
|
116 case EMTPObjectPropCodeAudioWAVECodec: |
|
117 audioWaveCodecSupported = ETrue; |
|
118 break; |
|
119 case EMTPObjectPropCodeAudioBitRate: |
|
120 audioBitRateSupported = ETrue; |
|
121 break; |
|
122 default: |
|
123 // do nothing |
|
124 break; |
|
125 } |
|
126 } |
|
127 } |
|
128 break; |
|
129 |
|
130 case EMTPFormatCodeMP4Container: |
|
131 { |
|
132 TInt count = sizeof( KMmMtpDpSupportedPropMandatoryAudio ) / sizeof( TUint16 ); |
|
133 |
|
134 for ( TInt i = 0; i < count; i++ ) |
|
135 { |
|
136 switch ( KMmMtpDpSupportedPropMandatoryAudio[i] ) |
|
137 { |
|
138 case EMTPObjectPropCodeAudioWAVECodec: |
|
139 audioWaveCodecSupported = ETrue; |
|
140 break; |
|
141 case EMTPObjectPropCodeAudioBitRate: |
|
142 audioBitRateSupported = ETrue; |
|
143 break; |
|
144 default: |
|
145 // do nothing |
|
146 break; |
|
147 } |
|
148 } |
|
149 } |
|
150 break; |
|
151 |
|
152 case EMTPFormatCode3GPContainer: |
|
153 { |
|
154 TInt count = sizeof( KMmMtpDpSupportedPropMandatoryAudio ) / sizeof( TUint16 ); |
|
155 |
|
156 for ( TInt i = 0; i < count; i++ ) |
|
157 { |
|
158 switch ( KMmMtpDpSupportedPropMandatoryAudio[i] ) |
|
159 { |
|
160 case EMTPObjectPropCodeAudioWAVECodec: |
|
161 audioWaveCodecSupported = ETrue; |
|
162 break; |
|
163 case EMTPObjectPropCodeAudioBitRate: |
|
164 audioBitRateSupported = ETrue; |
|
165 break; |
|
166 default: |
|
167 // do nothing |
|
168 break; |
|
169 } |
|
170 } |
|
171 } |
|
172 break; |
|
173 |
|
174 case EMTPFormatCodeWMV: |
|
175 case EMTPFormatCodeASF: |
|
176 { |
|
177 TInt count = sizeof( KMmMtpDpSupportedPropMandatoryWMV ) / sizeof( TUint16 ); |
|
178 |
|
179 for ( TInt i = 0; i < count; i++ ) |
|
180 { |
|
181 switch ( KMmMtpDpSupportedPropMandatoryWMV[i] ) |
|
182 { |
|
183 case EMTPObjectPropCodeAudioWAVECodec: |
|
184 audioWaveCodecSupported = ETrue; |
|
185 break; |
|
186 case EMTPObjectPropCodeAudioBitRate: |
|
187 audioBitRateSupported = ETrue; |
|
188 break; |
|
189 case EMTPObjectPropCodeVideoFourCCCodec: |
|
190 videoFourCcCodecSupported = ETrue; |
|
191 break; |
|
192 case EMTPObjectPropCodeVideoBitRate: |
|
193 videoBitRateSupported = ETrue; |
|
194 break; |
|
195 default: |
|
196 // do nothing |
|
197 break; |
|
198 } |
|
199 } |
|
200 } |
|
201 break; |
|
202 |
|
203 default: |
|
204 { |
|
205 User::Leave( KErrNotSupported ); |
|
206 } |
|
207 break; |
|
208 } |
|
209 |
|
210 |
|
211 if ( audioWaveCodecSupported && audioBitRateSupported ) |
|
212 { |
|
213 CMTPTypeInterdependentProperties* properties = CMTPTypeInterdependentProperties::NewL(); |
|
214 if ( videoFourCcCodecSupported && videoBitRateSupported ) |
|
215 { |
|
216 // TODO: need to confirm |
|
217 properties->AppendL( ServiceVideoFourCCCodecL() ); |
|
218 properties->AppendL( ServiceVideoBitrateL() ); |
|
219 iInterdependentPropDesc->AppendL( properties ); |
|
220 } |
|
221 properties = CMTPTypeInterdependentProperties::NewL(); |
|
222 properties->AppendL( ServiceAudioWaveCodecL() ); |
|
223 properties->AppendL( ServiceAudioBitrateL() ); |
|
224 iInterdependentPropDesc->AppendL( properties ); |
|
225 } |
|
226 |
|
227 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceInterdepentPropDescL" ) ); |
|
228 } |
|
229 |
|
230 // ----------------------------------------------------------------------------- |
|
231 // CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioWaveCodecL |
|
232 // |
|
233 // ----------------------------------------------------------------------------- |
|
234 // |
|
235 CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioWaveCodecL() |
|
236 { |
|
237 PRINT1( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioWaveCodecL, iFormatCode = 0x%X" ), iFormatCode ); |
|
238 CMTPTypeObjectPropDescEnumerationForm* form = |
|
239 CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT32 ); // + form |
|
240 |
|
241 switch( iFormatCode ) |
|
242 { |
|
243 case EMTPFormatCodeWMA: |
|
244 case EMTPFormatCodeWMV: |
|
245 case EMTPFormatCodeASF: |
|
246 form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecWMA ) ); |
|
247 break; |
|
248 |
|
249 case EMTPFormatCodeMP3: |
|
250 form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecMP3 ) ); |
|
251 break; |
|
252 |
|
253 case EMTPFormatCodeMP4Container: |
|
254 case EMTPFormatCode3GPContainer: |
|
255 case EMTPFormatCodeAAC: |
|
256 form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecAAC ) ); |
|
257 break; |
|
258 |
|
259 case EMTPFormatCodeWAV: |
|
260 form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecPCM ) ); |
|
261 break; |
|
262 |
|
263 default: |
|
264 User::Leave( KErrNotSupported ); |
|
265 break; |
|
266 } |
|
267 |
|
268 CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewLC( EMTPObjectPropCodeAudioWAVECodec, *form ); // + propertyDesc |
|
269 |
|
270 // Set group code |
|
271 propertyDesc->SetUint32L( CMTPTypeObjectPropDesc::EGroupCode, |
|
272 EGroupCodeMediaDB ); |
|
273 CleanupStack::Pop( propertyDesc ); // - propertyDesc |
|
274 CleanupStack::PopAndDestroy( form ); // - form |
|
275 |
|
276 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioWaveCodecL" ) ); |
|
277 |
|
278 return propertyDesc; |
|
279 } |
|
280 |
|
281 // ----------------------------------------------------------------------------- |
|
282 // CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioBitrateL |
|
283 // |
|
284 // ----------------------------------------------------------------------------- |
|
285 // |
|
286 CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioBitrateL() |
|
287 { |
|
288 PRINT1( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioBitrateL, iFormatCode = 0x%X" ), iFormatCode ); |
|
289 CMTPTypeObjectPropDesc* propertyDesc = NULL; |
|
290 switch( iFormatCode ) |
|
291 { |
|
292 case EMTPFormatCodeWMA: |
|
293 case EMTPFormatCodeWMV: |
|
294 case EMTPFormatCodeASF: |
|
295 propertyDesc = ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, |
|
296 EMTPWMAMinBitrate, |
|
297 EMTPWMAMaxBitrate, |
|
298 EMTPAudioBitrateStep ); |
|
299 break; |
|
300 |
|
301 case EMTPFormatCodeMP3: |
|
302 propertyDesc = ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, |
|
303 EMTPMP3MinBitrate, |
|
304 EMTPMP3MaxBitrate, |
|
305 EMTPAudioBitrateStep ); |
|
306 break; |
|
307 |
|
308 case EMTPFormatCodeAAC: |
|
309 propertyDesc = ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, |
|
310 EMTPAACMinBitrate, |
|
311 EMTPAACMaxBitrate, |
|
312 EMTPAudioBitrateStep ); |
|
313 break; |
|
314 |
|
315 case EMTPFormatCodeWAV: |
|
316 propertyDesc = ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, |
|
317 EMTPPCMMinBitrate, |
|
318 EMTPPCMMaxBitrate, |
|
319 EMTPAudioBitrateStep ); |
|
320 break; |
|
321 |
|
322 case EMTPFormatCodeMP4Container: |
|
323 case EMTPFormatCode3GPContainer: |
|
324 propertyDesc = ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, |
|
325 EMTPAACPlusMinBitrate, |
|
326 EMTPAACPlusMaxBitrate, |
|
327 EMTPAudioBitrateStep ); |
|
328 break; |
|
329 |
|
330 default: |
|
331 User::Leave( KErrNotSupported ); |
|
332 break; |
|
333 } |
|
334 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioBitrateL" ) ); |
|
335 |
|
336 return propertyDesc; |
|
337 } |
|
338 |
|
339 // ----------------------------------------------------------------------------- |
|
340 // CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoFourCCCodecL |
|
341 // Create Description and create new ObjectPropDesc |
|
342 // ----------------------------------------------------------------------------- |
|
343 // |
|
344 CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoFourCCCodecL() |
|
345 { |
|
346 PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoFourCCCodecL" ) ); |
|
347 CMTPTypeObjectPropDesc* propertyDesc = NULL; |
|
348 if ( ( EMTPFormatCodeWMV == iFormatCode ) |
|
349 || ( EMTPFormatCodeASF == iFormatCode ) ) |
|
350 { |
|
351 CMTPTypeObjectPropDescEnumerationForm* expectedForm = |
|
352 CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT32 ); // + expectedForm |
|
353 |
|
354 TUint32 values[] = |
|
355 { |
|
356 EMTPVideoFourCCCodecWMV3 |
|
357 }; |
|
358 |
|
359 TInt numValues = sizeof( values ) / sizeof( values[0] ); |
|
360 for ( TInt i = 0; i < numValues; i++ ) |
|
361 { |
|
362 TMTPTypeUint32 data( values[i] ); |
|
363 expectedForm->AppendSupportedValueL( data ); |
|
364 } |
|
365 propertyDesc = CMTPTypeObjectPropDesc::NewLC( EMTPObjectPropCodeVideoFourCCCodec, |
|
366 *expectedForm ); // + propertyDesc |
|
367 // Set group code |
|
368 propertyDesc->SetUint32L( CMTPTypeObjectPropDesc::EGroupCode, |
|
369 EGroupCodeMediaDB ); |
|
370 CleanupStack::Pop( propertyDesc ); // - propertyDesc |
|
371 CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm |
|
372 } |
|
373 |
|
374 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoFourCCCodecL" ) ); |
|
375 return propertyDesc; |
|
376 } |
|
377 |
|
378 // ----------------------------------------------------------------------------- |
|
379 // CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoBitrateL |
|
380 // Create Description and create new ObjectPropDesc |
|
381 // ----------------------------------------------------------------------------- |
|
382 // |
|
383 CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoBitrateL() |
|
384 { |
|
385 PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoBitrateL" ) ); |
|
386 CMTPTypeObjectPropDesc* propertyDesc = NULL; |
|
387 if ( ( EMTPFormatCodeWMV == iFormatCode ) |
|
388 || ( EMTPFormatCodeASF == iFormatCode ) ) |
|
389 { |
|
390 propertyDesc = ServiceRangeFormDescriptionL( EMTPObjectPropCodeVideoBitRate, |
|
391 EMTPWMVMinBitrate, |
|
392 EMTPWMVMaxBitrate, |
|
393 EMTPVideoBitrateStep, |
|
394 ETrue ); |
|
395 } |
|
396 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoBitrateL" ) ); |
|
397 return propertyDesc; |
|
398 } |
|
399 |
|
400 // ----------------------------------------------------------------------------- |
|
401 // CMediaMtpDataProviderGetFormatCapabilities::ServiceRangeFormDescriptionL |
|
402 // |
|
403 // ----------------------------------------------------------------------------- |
|
404 // |
|
405 CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceRangeFormDescriptionL( TUint16 aPropertyCode, |
|
406 TUint32 aMinValue, |
|
407 TUint32 aMaxValue, |
|
408 TUint32 aStepValue, |
|
409 TBool aIsReadOnly ) |
|
410 { |
|
411 PRINT1( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceRangeFormDescriptionL, aPropertyCode = 0x%X" ), |
|
412 aPropertyCode ); |
|
413 CMTPTypeObjectPropDescRangeForm* form = |
|
414 CMTPTypeObjectPropDescRangeForm::NewLC( EMTPTypeUINT32 ); // + form |
|
415 |
|
416 // Set expected values |
|
417 form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMinimumValue, aMinValue ); |
|
418 form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMaximumValue, aMaxValue ); |
|
419 form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EStepSize, aStepValue ); |
|
420 |
|
421 CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; |
|
422 propertyInfo.iDataType = EMTPTypeUINT32; |
|
423 propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::ERangeForm; |
|
424 propertyInfo.iGetSet = !aIsReadOnly; |
|
425 |
|
426 CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewLC( aPropertyCode, |
|
427 propertyInfo, |
|
428 form ); // + propertyDesc |
|
429 // Set group code |
|
430 propertyDesc->SetUint32L( CMTPTypeObjectPropDesc::EGroupCode, EGroupCodeMediaDB ); |
|
431 |
|
432 CleanupStack::Pop( propertyDesc ); // - propertyDesc |
|
433 CleanupStack::PopAndDestroy( form ); // - form |
|
434 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceRangeFormDescriptionL" ) ); |
|
435 |
|
436 return propertyDesc; |
|
437 } |
|
438 |
|
439 // ----------------------------------------------------------------------------- |
|
440 // CMediaMtpDataProviderGetFormatCapabilities::ServiceSpecificpropertyDescL |
|
441 // |
|
442 // ----------------------------------------------------------------------------- |
|
443 // |
|
444 CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceSpecificPropertyDescL( TUint16 aPropertyCode ) |
|
445 { |
|
446 PRINT1( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceSpecificPropertyDescL, aPropertyCode = 0x%X" ), aPropertyCode ); |
|
447 // Property object to return with the desc value |
|
448 CMTPTypeObjectPropDesc* propertyDesc = NULL; |
|
449 |
|
450 switch ( aPropertyCode ) |
|
451 { |
|
452 // format specific |
|
453 case EMTPObjectPropCodeArtist: // Artist |
|
454 case EMTPObjectPropCodeTrack: // Track |
|
455 case EMTPObjectPropCodeGenre: // Genre |
|
456 case EMTPObjectPropCodeUseCount: // Use Count |
|
457 case EMTPObjectPropCodeAlbumName: // Album Name |
|
458 case EMTPObjectPropCodeAlbumArtist: // Album Artist |
|
459 case EMTPObjectPropCodeOriginalReleaseDate: // Original Release Date |
|
460 case EMTPObjectPropCodeComposer: // Composer |
|
461 case EMTPObjectPropCodeParentalRating: |
|
462 propertyDesc = CMTPTypeObjectPropDesc::NewL( aPropertyCode ); |
|
463 break; |
|
464 |
|
465 // Number of Channels (m) |
|
466 case EMTPObjectPropCodeNumberOfChannels: |
|
467 propertyDesc = ServiceNumberOfChannelsL(); |
|
468 break; |
|
469 |
|
470 // Sample Rate (HAS MINIMUM AND MAX VALUE) |
|
471 case EMTPObjectPropCodeSampleRate: |
|
472 propertyDesc = ServiceCodeSampleRateL(); |
|
473 break; |
|
474 |
|
475 // Audio Wave Codec (MAY REQUIRED LIMITED NUMBER TO BE PRODUCED) |
|
476 case EMTPObjectPropCodeAudioWAVECodec: |
|
477 propertyDesc = ServiceAudioWaveCodecL(); |
|
478 break; |
|
479 |
|
480 // Audio Bit Rate (MAY REQUIRED LIMITED NUMBER TO BE PRODUCED) |
|
481 case EMTPObjectPropCodeAudioBitRate: |
|
482 propertyDesc = ServiceAudioBitrateL(); |
|
483 break; |
|
484 |
|
485 // Duration |
|
486 case EMTPObjectPropCodeDuration: |
|
487 propertyDesc = ServiceRangeFormDescriptionL( aPropertyCode, |
|
488 EMTPMinDuration, |
|
489 EMTPMaxDuration, |
|
490 EMTPDurationStep ); |
|
491 break; |
|
492 |
|
493 // Description |
|
494 case EMTPObjectPropCodeDescription: |
|
495 propertyDesc = ServiceDescriptionL(); |
|
496 break; |
|
497 |
|
498 case EMTPObjectPropCodeWidth: |
|
499 propertyDesc = ServiceRangeFormDescriptionL( aPropertyCode, |
|
500 EMTPMinWidth, |
|
501 EMTPMaxWidth, |
|
502 EMTPStepWidth ); |
|
503 break; |
|
504 |
|
505 case EMTPObjectPropCodeHeight: |
|
506 propertyDesc = ServiceRangeFormDescriptionL( aPropertyCode, |
|
507 EMTPMinHeight, |
|
508 EMTPMaxHeight, |
|
509 EMTPStepHeight ); |
|
510 break; |
|
511 |
|
512 case EMTPObjectPropCodeScanType: |
|
513 propertyDesc = ServiceScanTypeDescriptionL(); |
|
514 break; |
|
515 |
|
516 case EMTPObjectPropCodeVideoFourCCCodec: |
|
517 propertyDesc = ServiceVideoFourCCCodecL(); |
|
518 break; |
|
519 |
|
520 case EMTPObjectPropCodeVideoBitRate: |
|
521 propertyDesc = ServiceRangeFormDescriptionL( aPropertyCode, |
|
522 EMTPWMVMinBitrate, |
|
523 EMTPWMVMaxBitrate, |
|
524 EMTPVideoBitrateStep, |
|
525 ETrue ); |
|
526 break; |
|
527 |
|
528 case EMTPObjectPropCodeFramesPerThousandSeconds: |
|
529 propertyDesc = ServiceRangeFormDescriptionL( aPropertyCode, |
|
530 EMTPMinFramesPerThousandSeconds, |
|
531 EMTPMaxFramesPerThousandSeconds, |
|
532 EMTPStepFramesPerThousandSeconds ); |
|
533 break; |
|
534 |
|
535 case EMTPObjectPropCodeKeyFrameDistance: |
|
536 propertyDesc = ServiceRangeFormDescriptionL( aPropertyCode, |
|
537 EMTPMinKeyFrameDistance, |
|
538 EMTPMaxKeyFrameDistance, |
|
539 EMTPStepKeyFrameDistance ); |
|
540 break; |
|
541 |
|
542 case EMTPObjectPropCodeEncodingProfile: |
|
543 propertyDesc = ServiceEncodingProfileDescriptionL(); |
|
544 break; |
|
545 |
|
546 case EMTPObjectPropCodeDRMStatus: |
|
547 propertyDesc = ServiceDRMStatusL(); |
|
548 break; |
|
549 |
|
550 case EMTPExtObjectPropCodeOmaDrmStatus: |
|
551 propertyDesc = ServiceOMADRMStatusL(); |
|
552 break; |
|
553 |
|
554 default: |
|
555 User::Leave( KErrNotSupported ); |
|
556 break; |
|
557 } |
|
558 |
|
559 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceSpecificPropertyDescL" ) ); |
|
560 return propertyDesc; |
|
561 } |
|
562 |
|
563 // ----------------------------------------------------------------------------- |
|
564 // CMediaMtpDataProviderGetFormatCapabilities::ServiceNumberOfChannelsL() |
|
565 // Create list of possible Channel numbers and create new ObjectPropDesc |
|
566 // ----------------------------------------------------------------------------- |
|
567 // |
|
568 CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceNumberOfChannelsL() |
|
569 { |
|
570 PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceNumberOfChannelsL" ) ); |
|
571 CMTPTypeObjectPropDescEnumerationForm* expectedForm = |
|
572 CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT16 ); // + expectedForm |
|
573 |
|
574 TUint16 values[] = |
|
575 { |
|
576 EMTPChannelMono, |
|
577 EMTPChannelStereo |
|
578 }; |
|
579 |
|
580 TInt numValues = sizeof( values ) / sizeof( values[0] ); |
|
581 |
|
582 for ( TInt i = 0; i < numValues; i++ ) |
|
583 { |
|
584 TMTPTypeUint16 data( values[i] ); |
|
585 expectedForm->AppendSupportedValueL( data ); |
|
586 } |
|
587 |
|
588 CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeNumberOfChannels, |
|
589 *expectedForm ); |
|
590 CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm |
|
591 |
|
592 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceNumberOfChannelsL" ) ); |
|
593 |
|
594 return propertyDesc; |
|
595 } |
|
596 |
|
597 // ----------------------------------------------------------------------------- |
|
598 //CMediaMtpDataProviderGetFormatCapabilities::ServiceCodeSampleRateL |
|
599 // Create list of possible Sample rate list and create new ObjectPropDesc |
|
600 // ----------------------------------------------------------------------------- |
|
601 // |
|
602 CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceCodeSampleRateL() |
|
603 { |
|
604 PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceCodeSampleRateL" ) ); |
|
605 CMTPTypeObjectPropDescEnumerationForm* expectedForm = |
|
606 CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT32 ); // + expectedForm |
|
607 |
|
608 TUint32 values[] = |
|
609 { |
|
610 EMTPSampleRate8K, |
|
611 EMTPSampleRate16K, |
|
612 EMTPSampleRate22_05K, |
|
613 EMTPSampleRate24K, |
|
614 EMTPSampleRate32K, |
|
615 EMTPSampleRate44_1K, |
|
616 EMTPSampleRate48K |
|
617 }; |
|
618 |
|
619 TInt numValues = sizeof( values ) / sizeof( values[0] ); |
|
620 |
|
621 for ( TInt i = 0; i < numValues; i++ ) |
|
622 { |
|
623 TMTPTypeUint32 data( values[i] ); |
|
624 expectedForm->AppendSupportedValueL( data ); |
|
625 } |
|
626 |
|
627 CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeSampleRate, |
|
628 CMTPTypeObjectPropDesc::EEnumerationForm, |
|
629 expectedForm ); |
|
630 CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm |
|
631 |
|
632 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceCodeSampleRateL" ) ); |
|
633 |
|
634 return propertyDesc; |
|
635 } |
|
636 |
|
637 // ----------------------------------------------------------------------------- |
|
638 // CMediaMtpDataProviderGetFormatCapabilities::ServiceDescriptionL() |
|
639 // Create Description and create new ObjectPropDesc |
|
640 // ----------------------------------------------------------------------------- |
|
641 // |
|
642 CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceDescriptionL() |
|
643 { |
|
644 PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceDescriptionL" ) ); |
|
645 |
|
646 TMTPTypeUint32 uint32Data( KMTPDescriptionLen ); |
|
647 CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeDescription, |
|
648 CMTPTypeObjectPropDesc::ELongStringForm, |
|
649 &uint32Data ); |
|
650 |
|
651 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceDescriptionL" ) ); |
|
652 |
|
653 return propertyDesc; |
|
654 } |
|
655 |
|
656 // ----------------------------------------------------------------------------- |
|
657 //CMediaMtpDataProviderGetFormatCapabilities::ServiceScanTypeDescriptionL |
|
658 // Create Description and create new ObjectPropDesc |
|
659 // ----------------------------------------------------------------------------- |
|
660 // |
|
661 CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceScanTypeDescriptionL() |
|
662 { |
|
663 PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceScanTypeDescriptionL" ) ); |
|
664 CMTPTypeObjectPropDescEnumerationForm* expectedForm = |
|
665 CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT16 ); // + expectedForm |
|
666 |
|
667 TUint16 values[] = |
|
668 { |
|
669 EMTPScanTypeProgressive |
|
670 }; |
|
671 |
|
672 TInt numValues = sizeof( values ) / sizeof( values[0] ); |
|
673 for ( TInt i = 0; i < numValues; i++ ) |
|
674 { |
|
675 TMTPTypeUint16 data( values[i] ); |
|
676 expectedForm->AppendSupportedValueL( data ); |
|
677 } |
|
678 |
|
679 CMTPTypeObjectPropDesc* propertyDesc = NULL; |
|
680 propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeScanType, |
|
681 *expectedForm ); |
|
682 CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm |
|
683 |
|
684 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceScanTypeDescriptionL" ) ); |
|
685 |
|
686 return propertyDesc; |
|
687 } |
|
688 |
|
689 // ----------------------------------------------------------------------------- |
|
690 // CMediaMtpDataProviderGetFormatCapabilities::ServiceEncodingProfileDescriptionL |
|
691 // Create Description and create new ObjectPropDesc |
|
692 // ----------------------------------------------------------------------------- |
|
693 // |
|
694 CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceEncodingProfileDescriptionL() |
|
695 { |
|
696 PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceEncodingProfileDescriptionL" ) ); |
|
697 CMTPTypeObjectPropDescEnumerationForm* expectedForm = |
|
698 CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeString ); // + expectedForm |
|
699 |
|
700 CMTPTypeString* string = CMTPTypeString::NewLC( _L( "SP@LL" ) ); // + string |
|
701 expectedForm->AppendSupportedValueL( *string ); |
|
702 string->SetL( _L("SP@ML")); |
|
703 expectedForm->AppendSupportedValueL( *string ); |
|
704 string->SetL( _L("MP@LL")); |
|
705 expectedForm->AppendSupportedValueL( *string ); |
|
706 |
|
707 CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; |
|
708 propertyInfo.iDataType = EMTPTypeString; |
|
709 propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::EEnumerationForm; |
|
710 propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadWrite; |
|
711 |
|
712 CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeEncodingProfile, |
|
713 propertyInfo, |
|
714 expectedForm ); |
|
715 |
|
716 CleanupStack::PopAndDestroy( string ); // - string |
|
717 CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm |
|
718 |
|
719 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceEncodingProfileDescriptionL" ) ); |
|
720 |
|
721 return propertyDesc; |
|
722 } |
|
723 |
|
724 // ----------------------------------------------------------------------------- |
|
725 // CMediaMtpDataProviderGetFormatCapabilities::ServiceDRMStatusL |
|
726 // Create Description and create new ObjectPropDesc |
|
727 // ----------------------------------------------------------------------------- |
|
728 // |
|
729 CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceDRMStatusL() |
|
730 { |
|
731 PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceDRMStatusL" ) ); |
|
732 CMTPTypeObjectPropDescEnumerationForm* expectedForm = |
|
733 CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT16 ); // + expectedForm |
|
734 |
|
735 TUint16 values[] = |
|
736 { |
|
737 EMTPDrmNoProtection, |
|
738 EMTPDrmProtection, |
|
739 EMTPDrmReserveForMTP, |
|
740 EMTPDrmVenderExtension |
|
741 }; |
|
742 |
|
743 TInt numValues = sizeof( values ) / sizeof( values[0] ); |
|
744 for ( TInt i = 0; i < numValues; i++ ) |
|
745 { |
|
746 TMTPTypeUint16 data( values[i] ); |
|
747 expectedForm->AppendSupportedValueL( data ); |
|
748 } |
|
749 |
|
750 CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeDRMStatus, |
|
751 *expectedForm ); |
|
752 CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm |
|
753 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceDRMStatusL" ) ); |
|
754 |
|
755 return propertyDesc; |
|
756 } |
|
757 |
|
758 // ----------------------------------------------------------------------------- |
|
759 // CMediaMtpDataProviderGetFormatCapabilities::ServiceOMADRMStatusL |
|
760 // Create Description and create new ObjectPropDesc |
|
761 // ----------------------------------------------------------------------------- |
|
762 // |
|
763 CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceOMADRMStatusL() |
|
764 { |
|
765 PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceOMADRMStatusL" ) ); |
|
766 CMTPTypeObjectPropDescEnumerationForm* expectedForm = |
|
767 CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT8 ); // + expectedForm |
|
768 |
|
769 TUint8 values[] = |
|
770 { |
|
771 EMTPOMADrmNoProtection, |
|
772 EMTPOMADrmProtection, |
|
773 }; |
|
774 |
|
775 TInt numValues = sizeof( values ) / sizeof( values[0] ); |
|
776 for ( TInt i = 0; i < numValues; i++ ) |
|
777 { |
|
778 TMTPTypeUint8 data( values[i] ); |
|
779 expectedForm->AppendSupportedValueL( data ); |
|
780 } |
|
781 |
|
782 CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; |
|
783 propertyInfo.iDataType = EMTPTypeUINT8; |
|
784 propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::EEnumerationForm; |
|
785 |
|
786 CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPExtObjectPropCodeOmaDrmStatus, |
|
787 propertyInfo, |
|
788 expectedForm ); |
|
789 CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm |
|
790 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceOMADRMStatusL" ) ); |
|
791 |
|
792 return propertyDesc; |
|
793 } |
|
794 |
|
795 // end of file |
|