|
1 // Copyright (c) 2002-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 // include\mmf\utils\rateconvert.h |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef RATECONVERT_H |
|
19 #define RATECONVERT_H |
|
20 |
|
21 /** |
|
22 @internalTechnology |
|
23 @file |
|
24 */ |
|
25 |
|
26 #include <e32base.h> |
|
27 |
|
28 /** |
|
29 Base utility class to change the sample rate of audio data in a buffer |
|
30 */ |
|
31 class CChannelAndSampleRateConverter : public CBase |
|
32 { |
|
33 protected: |
|
34 CChannelAndSampleRateConverter(); |
|
35 |
|
36 public: |
|
37 /* |
|
38 Create a converter that will do rate and channel conversion as requested |
|
39 */ |
|
40 IMPORT_C static CChannelAndSampleRateConverter* CreateL(TInt aFromRate,TInt aFromChannels, |
|
41 TInt aToRate,TInt aToChannels); |
|
42 /** |
|
43 Reads the audio data from the source buffer, |
|
44 converts the number of channels and the sample rate |
|
45 and copies the result to the destination buffer |
|
46 |
|
47 @param aSrcBuffer |
|
48 The source buffer containing the audio data to convert. |
|
49 @param aDstBuffer |
|
50 The destination buffer - assumed big enough |
|
51 |
|
52 @return The length of the source buffer that was consumed. |
|
53 */ |
|
54 virtual TInt Convert(const TDesC8& aSrcBuffer, TDes8& aDstBuffer)=0; |
|
55 virtual void Reset()=0; |
|
56 |
|
57 /* |
|
58 Indicates what buffer size is required to hold the converted data. |
|
59 Support size of original buffer. |
|
60 aRoundUpToPower means give next power of 2 size up from raw size. |
|
61 NB. May be bigger than strictly necessary. |
|
62 */ |
|
63 virtual TInt MaxConvertBufferSize(TInt aSrcBufferSize, TBool aRoundUpToPower=EFalse)=0; |
|
64 }; |
|
65 |
|
66 |
|
67 #endif |
|
68 |