diff -r a05c44bc3c61 -r d881023c13eb mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderdescriptionutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderdescriptionutility.cpp Mon May 03 12:58:40 2010 +0300 @@ -0,0 +1,224 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Media dp specific property description construction utility. +* Used by all request processors which related to property description +* +*/ + +#include +#include +#include + +#include "cabstractmediamtpdataproviderdescriptionutility.h" +#include "abstractmediamtpdataproviderconst.h" +#include "mmmtpdpconfig.h" +#include "mmmtpdplogger.h" + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderDescriptionUtility::NewL +// +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderDescriptionUtility* CAbstractMediaMtpDataProviderDescriptionUtility::NewL() + { + CAbstractMediaMtpDataProviderDescriptionUtility* self = + new( ELeave ) CAbstractMediaMtpDataProviderDescriptionUtility(); + + return self; + } + +CAbstractMediaMtpDataProviderDescriptionUtility::CAbstractMediaMtpDataProviderDescriptionUtility() + { + // Do nothing + } + +CAbstractMediaMtpDataProviderDescriptionUtility::~CAbstractMediaMtpDataProviderDescriptionUtility() + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderDescriptionUtility::NewInterdepentPropDescL +// Construct media dp specific interdependent property description. +// ----------------------------------------------------------------------------- +// +CMTPTypeInterdependentPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewInterdepentPropDescL( MMmMtpDpConfig& /*aDpConfig*/, + TUint /*aFormatCode*/ ) + { + PRINT( _L( "MM MTP => CAbstractMediaMtpDataProviderDescriptionUtility::NewInterdepentPropDescL" ) ); + + CMTPTypeInterdependentPropDesc* interdependentPropDesc = CMTPTypeInterdependentPropDesc::NewL(); + + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderDescriptionUtility::NewInterdepentPropDescL" ) ); + return interdependentPropDesc; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderDescriptionUtility::NewSpecificPropDescL +// Construct media dp specific property description. +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewSpecificPropDescL( TUint aFormatCode, + TUint16 aPropCode ) + { + CMTPTypeObjectPropDesc* propertyDesc = NULL; + if( aFormatCode == EMTPFormatCodeAbstractAudioAlbum ) + { + 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