os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/WavDecodeUtility.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 class CWavDecodeUtility: public CBase
    17 	{
    18 public:
    19 	static CWavDecodeUtility* NewL(TDesC8& aBuffer);
    20 	~CWavDecodeUtility();
    21 
    22 	inline TUint GetChannels(void) const  {return iChannels;};
    23 	inline TUint GetSampleRate(void) const {return iSampleRate;};
    24 	inline TUint GetBitsPerSample(void) const {return iBitsPerSample;};
    25 	inline TUint GetDataLength(void) const {return iDataLength;};
    26 
    27 	inline TUint GetSamples(void) const {return iDataLength / (iChannels * iBitsPerSample / 8);};
    28 	
    29 
    30 private:
    31 	CWavDecodeUtility();
    32 	void ConstructL(TDesC8& aBuffer);
    33 	TUint16 Read16(const TUint8* aPtr);
    34 	TUint32 Read32(const TUint8* aPtr);
    35 	void FindRiffChunksL(void);
    36 	void ProcessFormatHeaderL();
    37 	void ReadChunk(TMdaRiffChunk* aChunk);
    38 	void AssignChunkTo(TMdaRiffChunk* aAssignedChunk);
    39 	
    40 private:
    41 //	CMMFDataBuffer* iBuffer;
    42 	TDesC8* iBuffer;
    43 	const TUint8* iStartPtr;
    44 	TUint iLastReadPosition;
    45 	TBool iHasFactChunk;
    46 	TMdaRiffChunk iCurrent;
    47 	TMdaRiffChunk iFormatChunk;
    48 	TMdaRiffChunk iFactChunk;
    49 	TMdaRiffChunk iDataChunk;
    50 	TUint iRiffChunkLength;
    51 	TBool iFoundChunks;
    52 	TBool iDone;
    53 	TUint iStartPosition;
    54 
    55 	TUint iCodecId;
    56 	TUint iChannels;
    57 	TUint iSampleRate;
    58 	TUint iBlockAlign;				//needed for correct IMA
    59 	TUint iBitsPerSample;
    60 
    61 	TUint iDataLength;
    62 	TUint iAverageBytesPerSecond;	//needed for correct IMA
    63 	TUint iSamplesPerBlock;
    64 	
    65 	TUint iPos;
    66 	TUint iClipLength;
    67 
    68 	};
    69 
    70