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