1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/a3facf/inc/maudiocodec.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,126 @@
1.4 +/*
1.5 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +
1.24 +/**
1.25 + @file
1.26 + @publishedPartner
1.27 + @released
1.28 +*/
1.29 +
1.30 +#ifndef MAUDIOCODEC_H
1.31 +#define MAUDIOCODEC_H
1.32 +
1.33 +#include <a3f/a3fbase.h>
1.34 +#include <a3f/maudioprocessingunit.h>
1.35 +#include <a3f/maudiocodecobserver.h>
1.36 +
1.37 +
1.38 +/**
1.39 + * A generic abstract interface for codecs.
1.40 + *
1.41 + * The client must add a codec to a stream for operation.
1.42 + * The codec can only be added to a stream when the codec is in uninitialized state.
1.43 + * The codec can only be removed from a stream when the codec is in uninitialized or dead states.
1.44 + */
1.45 +class MAudioCodec
1.46 + {
1.47 + public:
1.48 +
1.49 + /**
1.50 + * Sets the codec format.
1.51 + *
1.52 + * For encoders this sets the output format.
1.53 + * For decoders this configures the input format.
1.54 + * Format must be set before the codec can transfer to initialized state.
1.55 + *
1.56 + * @param aFormat codec format.
1.57 + * @return An error code. KErrNone on success, otherwise one of the system wide error codes.
1.58 + */
1.59 + virtual TInt SetFormat(TUid aFormat)=0;
1.60 +
1.61 + /**
1.62 + * Sets the sample rate in samples/sec.
1.63 + *
1.64 + * sets the sample rate of the encoded data,
1.65 + * and says nothing about the sample rate used on the output device
1.66 + * or whether re-sampling is required that is up to the adaptation.
1.67 + * the result of the operation is returned by MAudioCodecObserver::SampleRateSet().
1.68 + *
1.69 + * @param aSampleRate sample rate to be used, in samples/sec.
1.70 + * @return An error code. KErrNone on success, otherwise one of the system wide error codes.
1.71 + */
1.72 + virtual TInt SetSampleRate(TInt aSampleRate)=0;
1.73 +
1.74 + /**
1.75 + * Sets the mode, e.g. mono/stereo.
1.76 + * The result of the operation is returned by MAudioCodecObserver::ModeSet().
1.77 + *
1.78 + * @param aMode uid stating the mode.
1.79 + * @return An error code. KErrNone on success, otherwise one of the system wide error codes.
1.80 + */
1.81 + virtual TInt SetMode(TUid aMode)=0;
1.82 +
1.83 + /**
1.84 + * This returns a list of supported sample rates. The list need just include those of the standard list
1.85 + * that are supported. Includes rates supported by sample rate conversion.
1.86 + * GetSupportedSampleRatesComplete() callback shows result.
1.87 + * TODO Need to document that the implementation is responsible for calling Reset() on aSupportedRates.
1.88 + *
1.89 + * @param aSupportedRates array that is populated with the supported rates list.
1.90 + * @return An error code. KErrNone on success, otherwise one of the system wide error codes.
1.91 + */
1.92 + virtual TInt GetSupportedSamplesRates(RArray<TInt>& aSupportedRates)=0;
1.93 +
1.94 + /**
1.95 + * This returns a list of supported sample modes. The list corresponds to the current configuration
1.96 + * and support may include the use of mono/stereo conversion etc.
1.97 + * GetSupportedModesComplete() callback shows result.
1.98 + * TODO Need to document that the implementation is responsible for calling Reset() on aSupportedModes.
1.99 + *
1.100 + * @param aSupportedModes array that is populated with the supported modes list.
1.101 + * @return An error code. KErrNone on success, otherwise one of the system wide error codes.
1.102 + */
1.103 + virtual TInt GetSupportedModes(RArray<TUid>& aSupportedModes)=0;
1.104 +
1.105 + /**
1.106 + * Registers an audio codec observer.
1.107 + *
1.108 + * Note that this function is meant for clients of the Audio codec.
1.109 + * The client should unregister using UnregisterAudioCodecObserver() when applicable
1.110 + *
1.111 + * @param aObserver reference to the observer to register.
1.112 + * @return an error code. KErrNone if successful.
1.113 + * KErrAlreadyExists if the client is already registered.
1.114 + * KErrOutOfMemory in case of memory exhaustion.
1.115 + */
1.116 + virtual TInt RegisterAudioCodecObserver(MAudioCodecObserver& aObserver)=0;
1.117 +
1.118 + /**
1.119 + * Unregisters an audio codec observer.
1.120 + *
1.121 + * @param aObserver reference to the observer to unregister.
1.122 + * @return an error code. KErrNone if successful.
1.123 + * KErrNotFound if the client has not been registered as observer.
1.124 + */
1.125 + virtual void UnregisterAudioCodecObserver(MAudioCodecObserver& aObserver)=0;
1.126 +
1.127 + };
1.128 +
1.129 +#endif // MAUDIOCODEC_H