1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmhais/refacladapt/src/audiocodec/resourcedata.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,105 @@
1.4 +/*
1.5 +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#ifndef RESOURCEDATA_H
1.23 +#define RESOURCEDATA_H
1.24 +
1.25 +// INCLUDES
1.26 +#include <e32base.h>
1.27 +#include <barsread.h>
1.28 +#include <mmf/server/mmfhwdevice.h>
1.29 +#include "audiocodec.h"
1.30 +
1.31 +_LIT16(KDrive,"z:");
1.32 +_LIT16(KFileNameFormat,"HwDev0x%x.rsc");
1.33 +const TInt8 KResFileNameLength = 20;
1.34 +const TInt8 KResFileNameAndPathLength = 50;
1.35 +// CLASS DECLARATION
1.36 +
1.37 +/////
1.38 +// Class is used to read capabilities and initilaization data from codec
1.39 +// resource data files.
1.40 +///
1.41 +NONSHARABLE_CLASS (CResourceData) : public CBase
1.42 + {
1.43 +public: // Constructors and destructor
1.44 +
1.45 + /////
1.46 + // Two-phased constructor.
1.47 + //
1.48 + // @param aResourceUid UID of the resource whose data to read.
1.49 + // @return CResourceData* Pointer to a newly constructed object.
1.50 + ///
1.51 + static CResourceData* NewL(TUid aResourceUid);
1.52 +
1.53 + /////
1.54 + // Destructor.
1.55 + ///
1.56 + ~CResourceData();
1.57 +
1.58 +public:
1.59 +
1.60 + /////
1.61 + // Reads the capabilities data.
1.62 + //
1.63 + // @param aMode Mode of the resource.
1.64 + // @param aConf On return from a succesful call, contains the capabilities data.
1.65 + // @return error code
1.66 + ///
1.67 + TInt GetSSampleRates(TMode aMode, RArray<TInt>& aSampleRate);
1.68 + TInt GetSModes(TMode aMode, RArray<TUid>& aModeConfig);
1.69 +
1.70 +private:
1.71 +
1.72 +
1.73 + //Constructor.
1.74 +
1.75 + CResourceData();
1.76 +
1.77 +
1.78 + //2nd phase constructor is private.
1.79 + //The param is the UID of the resource whose data to read.
1.80 +
1.81 + void ConstructL(TUid aResourceUid);
1.82 +
1.83 +
1.84 + //Utility method for seeking resource to the correct mode. Leaves with
1.85 + //KErrNotFound if mode is not found in the opened resource.
1.86 +
1.87 + //aMode is the codec mode.
1.88 +
1.89 + TInt SeekToMode(TMode aMode);
1.90 +
1.91 +private: // Data
1.92 +
1.93 + // Resource UID.
1.94 + TUid iResourceUid;
1.95 +
1.96 + // Resource file data.
1.97 + HBufC8* iResourceData;
1.98 +
1.99 + // Resource file reader.
1.100 + TResourceReader iResourceReader;
1.101 +
1.102 + // Resource data end pointer (for safety checks).
1.103 + const TUint8* iResourceDataEnd;
1.104 + };
1.105 +
1.106 +#endif // RESOURCEDATA_H
1.107 +
1.108 +// End of File