|
1 /* |
|
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 @publishedPartner |
|
24 @released |
|
25 */ |
|
26 |
|
27 #ifndef MAUDIOCODEC_H |
|
28 #define MAUDIOCODEC_H |
|
29 |
|
30 #include <a3f/a3fbase.h> |
|
31 #include <a3f/maudioprocessingunit.h> |
|
32 #include <a3f/maudiocodecobserver.h> |
|
33 |
|
34 |
|
35 /** |
|
36 * A generic abstract interface for codecs. |
|
37 * |
|
38 * The client must add a codec to a stream for operation. |
|
39 * The codec can only be added to a stream when the codec is in uninitialized state. |
|
40 * The codec can only be removed from a stream when the codec is in uninitialized or dead states. |
|
41 */ |
|
42 class MAudioCodec |
|
43 { |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Sets the codec format. |
|
48 * |
|
49 * For encoders this sets the output format. |
|
50 * For decoders this configures the input format. |
|
51 * Format must be set before the codec can transfer to initialized state. |
|
52 * |
|
53 * @param aFormat codec format. |
|
54 * @return An error code. KErrNone on success, otherwise one of the system wide error codes. |
|
55 */ |
|
56 virtual TInt SetFormat(TUid aFormat)=0; |
|
57 |
|
58 /** |
|
59 * Sets the sample rate in samples/sec. |
|
60 * |
|
61 * sets the sample rate of the encoded data, |
|
62 * and says nothing about the sample rate used on the output device |
|
63 * or whether re-sampling is required that is up to the adaptation. |
|
64 * the result of the operation is returned by MAudioCodecObserver::SampleRateSet(). |
|
65 * |
|
66 * @param aSampleRate sample rate to be used, in samples/sec. |
|
67 * @return An error code. KErrNone on success, otherwise one of the system wide error codes. |
|
68 */ |
|
69 virtual TInt SetSampleRate(TInt aSampleRate)=0; |
|
70 |
|
71 /** |
|
72 * Sets the mode, e.g. mono/stereo. |
|
73 * The result of the operation is returned by MAudioCodecObserver::ModeSet(). |
|
74 * |
|
75 * @param aMode uid stating the mode. |
|
76 * @return An error code. KErrNone on success, otherwise one of the system wide error codes. |
|
77 */ |
|
78 virtual TInt SetMode(TUid aMode)=0; |
|
79 |
|
80 /** |
|
81 * This returns a list of supported sample rates. The list need just include those of the standard list |
|
82 * that are supported. Includes rates supported by sample rate conversion. |
|
83 * GetSupportedSampleRatesComplete() callback shows result. |
|
84 * TODO Need to document that the implementation is responsible for calling Reset() on aSupportedRates. |
|
85 * |
|
86 * @param aSupportedRates array that is populated with the supported rates list. |
|
87 * @return An error code. KErrNone on success, otherwise one of the system wide error codes. |
|
88 */ |
|
89 virtual TInt GetSupportedSamplesRates(RArray<TInt>& aSupportedRates)=0; |
|
90 |
|
91 /** |
|
92 * This returns a list of supported sample modes. The list corresponds to the current configuration |
|
93 * and support may include the use of mono/stereo conversion etc. |
|
94 * GetSupportedModesComplete() callback shows result. |
|
95 * TODO Need to document that the implementation is responsible for calling Reset() on aSupportedModes. |
|
96 * |
|
97 * @param aSupportedModes array that is populated with the supported modes list. |
|
98 * @return An error code. KErrNone on success, otherwise one of the system wide error codes. |
|
99 */ |
|
100 virtual TInt GetSupportedModes(RArray<TUid>& aSupportedModes)=0; |
|
101 |
|
102 /** |
|
103 * Registers an audio codec observer. |
|
104 * |
|
105 * Note that this function is meant for clients of the Audio codec. |
|
106 * The client should unregister using UnregisterAudioCodecObserver() when applicable |
|
107 * |
|
108 * @param aObserver reference to the observer to register. |
|
109 * @return an error code. KErrNone if successful. |
|
110 * KErrAlreadyExists if the client is already registered. |
|
111 * KErrOutOfMemory in case of memory exhaustion. |
|
112 */ |
|
113 virtual TInt RegisterAudioCodecObserver(MAudioCodecObserver& aObserver)=0; |
|
114 |
|
115 /** |
|
116 * Unregisters an audio codec observer. |
|
117 * |
|
118 * @param aObserver reference to the observer to unregister. |
|
119 * @return an error code. KErrNone if successful. |
|
120 * KErrNotFound if the client has not been registered as observer. |
|
121 */ |
|
122 virtual void UnregisterAudioCodecObserver(MAudioCodecObserver& aObserver)=0; |
|
123 |
|
124 }; |
|
125 |
|
126 #endif // MAUDIOCODEC_H |