sl@0: /* sl@0: * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: sl@0: #ifndef MAUDIOCODEC_H sl@0: #define MAUDIOCODEC_H sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: /** sl@0: * A generic abstract interface for codecs. sl@0: * sl@0: * The client must add a codec to a stream for operation. sl@0: * The codec can only be added to a stream when the codec is in uninitialized state. sl@0: * The codec can only be removed from a stream when the codec is in uninitialized or dead states. sl@0: */ sl@0: class MAudioCodec sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: * Sets the codec format. sl@0: * sl@0: * For encoders this sets the output format. sl@0: * For decoders this configures the input format. sl@0: * Format must be set before the codec can transfer to initialized state. sl@0: * sl@0: * @param aFormat codec format. sl@0: * @return An error code. KErrNone on success, otherwise one of the system wide error codes. sl@0: */ sl@0: virtual TInt SetFormat(TUid aFormat)=0; sl@0: sl@0: /** sl@0: * Sets the sample rate in samples/sec. sl@0: * sl@0: * sets the sample rate of the encoded data, sl@0: * and says nothing about the sample rate used on the output device sl@0: * or whether re-sampling is required that is up to the adaptation. sl@0: * the result of the operation is returned by MAudioCodecObserver::SampleRateSet(). sl@0: * sl@0: * @param aSampleRate sample rate to be used, in samples/sec. sl@0: * @return An error code. KErrNone on success, otherwise one of the system wide error codes. sl@0: */ sl@0: virtual TInt SetSampleRate(TInt aSampleRate)=0; sl@0: sl@0: /** sl@0: * Sets the mode, e.g. mono/stereo. sl@0: * The result of the operation is returned by MAudioCodecObserver::ModeSet(). sl@0: * sl@0: * @param aMode uid stating the mode. sl@0: * @return An error code. KErrNone on success, otherwise one of the system wide error codes. sl@0: */ sl@0: virtual TInt SetMode(TUid aMode)=0; sl@0: sl@0: /** sl@0: * This returns a list of supported sample rates. The list need just include those of the standard list sl@0: * that are supported. Includes rates supported by sample rate conversion. sl@0: * GetSupportedSampleRatesComplete() callback shows result. sl@0: * TODO Need to document that the implementation is responsible for calling Reset() on aSupportedRates. sl@0: * sl@0: * @param aSupportedRates array that is populated with the supported rates list. sl@0: * @return An error code. KErrNone on success, otherwise one of the system wide error codes. sl@0: */ sl@0: virtual TInt GetSupportedSamplesRates(RArray& aSupportedRates)=0; sl@0: sl@0: /** sl@0: * This returns a list of supported sample modes. The list corresponds to the current configuration sl@0: * and support may include the use of mono/stereo conversion etc. sl@0: * GetSupportedModesComplete() callback shows result. sl@0: * TODO Need to document that the implementation is responsible for calling Reset() on aSupportedModes. sl@0: * sl@0: * @param aSupportedModes array that is populated with the supported modes list. sl@0: * @return An error code. KErrNone on success, otherwise one of the system wide error codes. sl@0: */ sl@0: virtual TInt GetSupportedModes(RArray& aSupportedModes)=0; sl@0: sl@0: /** sl@0: * Registers an audio codec observer. sl@0: * sl@0: * Note that this function is meant for clients of the Audio codec. sl@0: * The client should unregister using UnregisterAudioCodecObserver() when applicable sl@0: * sl@0: * @param aObserver reference to the observer to register. sl@0: * @return an error code. KErrNone if successful. sl@0: * KErrAlreadyExists if the client is already registered. sl@0: * KErrOutOfMemory in case of memory exhaustion. sl@0: */ sl@0: virtual TInt RegisterAudioCodecObserver(MAudioCodecObserver& aObserver)=0; sl@0: sl@0: /** sl@0: * Unregisters an audio codec observer. sl@0: * sl@0: * @param aObserver reference to the observer to unregister. sl@0: * @return an error code. KErrNone if successful. sl@0: * KErrNotFound if the client has not been registered as observer. sl@0: */ sl@0: virtual void UnregisterAudioCodecObserver(MAudioCodecObserver& aObserver)=0; sl@0: sl@0: }; sl@0: sl@0: #endif // MAUDIOCODEC_H