diff -r d240f0a77280 -r 780c925249c1 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderdescriptionutility.cpp --- a/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderdescriptionutility.cpp Mon Mar 15 12:42:31 2010 +0200 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderdescriptionutility.cpp Wed Mar 31 22:26:09 2010 +0300 @@ -16,10 +16,12 @@ * */ +#include #include #include #include "cabstractmediamtpdataproviderdescriptionutility.h" +#include "abstractmediamtpdataproviderconst.h" #include "mmmtpdpconfig.h" #include "mmmtpdplogger.h" @@ -67,20 +69,156 @@ // Construct media dp specific property description. // ----------------------------------------------------------------------------- // -CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewSpecificPropDescL( TUint /*aFormatCode*/, +CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewSpecificPropDescL( TUint aFormatCode, TUint16 aPropCode ) { CMTPTypeObjectPropDesc* propertyDesc = NULL; - - switch ( aPropCode ) + if( aFormatCode == EMTPFormatCodeAbstractAudioAlbum ) { - // format specific - // May need add implementation here for further extension. - default: - // Do nothing now. - break; + switch ( aPropCode ) + { + case EMTPObjectPropCodeRepresentativeSampleFormat: + propertyDesc = NewRepresentativeSampleFormatL(); + break; + + case EMTPObjectPropCodeRepresentativeSampleSize: + propertyDesc = NewRepresentativeSampleSizeL(); + break; + + case EMTPObjectPropCodeRepresentativeSampleHeight: + propertyDesc = NewRepresentativeSampleHeightL(); + break; + + case EMTPObjectPropCodeRepresentativeSampleWidth: + propertyDesc = NewRepresentativeSampleWidthL(); + break; + + case EMTPObjectPropCodeRepresentativeSampleData: + propertyDesc = NewRepresentativeSampleDataL(); + break; + default: + // do nothing + break; + } } return propertyDesc; } +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleFormatL +// +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleFormatL() + { + CMTPTypeObjectPropDescEnumerationForm* form = + CMTPTypeObjectPropDescEnumerationForm::NewL( EMTPTypeUINT16 ); + CleanupStack::PushL( form ); // + form + + TInt numValues = sizeof ( TMmMtpSupportedSampleFormat ) / sizeof ( TMmMtpSupportedSampleFormat[0] ); + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint16 data( TMmMtpSupportedSampleFormat[i] ); + form->AppendSupportedValueL( data ); + } + + CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; + propertyInfo.iDataType = EMTPTypeUINT16; + propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::EEnumerationForm; + propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadOnly; + CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeRepresentativeSampleFormat, + propertyInfo, + form ); + CleanupStack::PopAndDestroy( form ); // - form + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleSizeL +// +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleSizeL() + { + CMTPTypeObjectPropDescRangeForm* form = + CMTPTypeObjectPropDescRangeForm::NewLC( EMTPTypeUINT32 ); // + form + + // Set expected values + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMinimumValue, EMTPMinSampleSize ); + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMaximumValue, EMTPMaxSampleSize ); + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EStepSize, EMTPStepSampleSize ); + + CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; + propertyInfo.iDataType = EMTPTypeUINT32; + propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::ERangeForm; + propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadOnly; + CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeRepresentativeSampleSize, + propertyInfo, + form ); + CleanupStack::PopAndDestroy( form ); // - form + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleHeightL +// +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleHeightL() + { + CMTPTypeObjectPropDescRangeForm* form = + CMTPTypeObjectPropDescRangeForm::NewLC( EMTPTypeUINT32 ); // + form + + // Set expected values + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMinimumValue, EMTPSampleMinHeight ); + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMaximumValue, EMTPSampleMaxHeight ); + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EStepSize, EMTPSampleStepHeight ); + + CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; + propertyInfo.iDataType = EMTPTypeUINT32; + propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::ERangeForm; + propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadOnly; + CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeRepresentativeSampleHeight, + propertyInfo, + form ); + CleanupStack::PopAndDestroy( form ); // - form + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleWidthL +// +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleWidthL() + { + CMTPTypeObjectPropDescRangeForm* form = + CMTPTypeObjectPropDescRangeForm::NewLC( EMTPTypeUINT32 ); // + form + + // Set expected values + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMinimumValue, EMTPSampleMinWidth ); + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMaximumValue, EMTPSampleMaxWidth ); + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EStepSize, EMTPSampleStepWidth ); + + CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; + propertyInfo.iDataType = EMTPTypeUINT32; + propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::ERangeForm; + propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadOnly; + CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeRepresentativeSampleWidth, + propertyInfo, + form ); + CleanupStack::PopAndDestroy( form ); // - form + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleDataL +// +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleDataL() + { + return CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeRepresentativeSampleData ); + } + // end of file