os/mm/mmhais/refacladapt/src/audiocodec/resourcedata.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
#ifndef RESOURCEDATA_H
sl@0
    20
#define RESOURCEDATA_H
sl@0
    21
sl@0
    22
// INCLUDES
sl@0
    23
#include <e32base.h>
sl@0
    24
#include <barsread.h>
sl@0
    25
#include <mmf/server/mmfhwdevice.h>
sl@0
    26
#include "audiocodec.h"
sl@0
    27
sl@0
    28
_LIT16(KDrive,"z:");
sl@0
    29
_LIT16(KFileNameFormat,"HwDev0x%x.rsc");
sl@0
    30
const TInt8 KResFileNameLength = 20;
sl@0
    31
const TInt8 KResFileNameAndPathLength = 50;
sl@0
    32
// CLASS DECLARATION
sl@0
    33
sl@0
    34
/////
sl@0
    35
// Class is used to read capabilities and initilaization data from codec
sl@0
    36
// resource data files.
sl@0
    37
///
sl@0
    38
NONSHARABLE_CLASS (CResourceData) : public CBase
sl@0
    39
	{
sl@0
    40
public: // Constructors and destructor
sl@0
    41
sl@0
    42
	/////
sl@0
    43
	 // Two-phased constructor.
sl@0
    44
	 //
sl@0
    45
	 // @param aResourceUid       UID of the resource whose data to read.
sl@0
    46
	 // @return CResourceData*  Pointer to a newly constructed object.
sl@0
    47
	 ///
sl@0
    48
	static CResourceData* NewL(TUid aResourceUid);
sl@0
    49
sl@0
    50
	/////
sl@0
    51
	 // Destructor.
sl@0
    52
     ///
sl@0
    53
	~CResourceData();
sl@0
    54
sl@0
    55
public:
sl@0
    56
sl@0
    57
	/////
sl@0
    58
	 // Reads the capabilities data.
sl@0
    59
	 //
sl@0
    60
	 // @param aMode      Mode of the resource.
sl@0
    61
	 // @param aConf      On return from a succesful call, contains the capabilities data.
sl@0
    62
 	 // @return           error code
sl@0
    63
	 ///
sl@0
    64
	TInt GetSSampleRates(TMode aMode, RArray<TInt>& aSampleRate);
sl@0
    65
	TInt GetSModes(TMode aMode, RArray<TUid>& aModeConfig);
sl@0
    66
sl@0
    67
private:
sl@0
    68
sl@0
    69
	
sl@0
    70
	//Constructor.
sl@0
    71
	
sl@0
    72
	CResourceData();
sl@0
    73
sl@0
    74
	
sl@0
    75
	//2nd phase constructor is private.
sl@0
    76
	//The param is the UID of the resource whose data to read.
sl@0
    77
	
sl@0
    78
	void ConstructL(TUid aResourceUid);
sl@0
    79
sl@0
    80
	
sl@0
    81
	//Utility method for seeking resource to the correct mode. Leaves with
sl@0
    82
	//KErrNotFound if mode is not found in the opened resource.
sl@0
    83
	
sl@0
    84
	//aMode is the codec mode.
sl@0
    85
	
sl@0
    86
	TInt SeekToMode(TMode aMode);
sl@0
    87
sl@0
    88
private: // Data
sl@0
    89
sl@0
    90
	// Resource UID.
sl@0
    91
	TUid iResourceUid;
sl@0
    92
sl@0
    93
	// Resource file data.
sl@0
    94
	HBufC8* iResourceData;
sl@0
    95
sl@0
    96
	// Resource file reader.
sl@0
    97
	TResourceReader iResourceReader;
sl@0
    98
sl@0
    99
	// Resource data end pointer (for safety checks).
sl@0
   100
	const TUint8* iResourceDataEnd;
sl@0
   101
	};
sl@0
   102
sl@0
   103
#endif // RESOURCEDATA_H
sl@0
   104
sl@0
   105
// End of File