1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mm_plat/eaacplusutil_api/inc/EAacPlusUtil.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,167 @@
1.4 +/*
1.5 +* Copyright (c) 2007 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: Header file for EAacPlusUtil.cpp
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#ifndef EAACPLUSUTIL_H
1.23 +#define EAACPLUSUTIL_H
1.24 +
1.25 +// INCLUDES
1.26 +#include <e32base.h>
1.27 +
1.28 +// CLASS DECLARATION
1.29 +class EAacpAudioFrameInfo;
1.30 +
1.31 +/**
1.32 +* This class implements utility functions to extract AAC frame
1.33 +* information.
1.34 +*
1.35 +* @lib MmfEAacPlusUtil.lib
1.36 +* @since 3.2
1.37 +*/
1.38 +class CEAacPlusUtil : public CBase
1.39 + {
1.40 + public:
1.41 + // CONSTANTS
1.42 + enum TEAacPlusFormatType
1.43 + {
1.44 + EAacPlusFormatRaw=0,
1.45 + EAacPlusFormatAdif=1,
1.46 + EAacPlusFormatAdts=2
1.47 + };
1.48 + /**
1.49 + * EAAC+ frame info struct.
1.50 + *
1.51 + * @lib MmfEAacPlusUtil.lib
1.52 + * @since 3.2
1.53 + */
1.54 + class TEAacPlusFrameInfo
1.55 + {
1.56 + public:
1.57 + TInt iOutFrameSize; // Size of PCM Samples generated by decoder
1.58 + TInt iNoOfSamples; // Number of PCM Samples generated by decoder per frame
1.59 + TInt iSamplingFrequency; // Sampling freq of AAC Code decoder
1.60 + TInt iNoOfChannels; // No of output channel 1=Mono; 2=Stereo
1.61 + TInt iObjectType; // MPEG Audio Object Type 2=AAC-LC; 4=AAC-LTP
1.62 + TInt iOutSamplingFrequency; // Sampling Frequence for the output samples
1.63 + TInt iDownSampledMode; // 0=Normal Mode; 1=Down Sampled mode
1.64 + TInt iSbr; // 0=SBR not present; 1=SBR present
1.65 + TInt iPs; // 0=PS not present; 1=PS present
1.66 + };
1.67 +
1.68 + class TEAacPlusFrameLenConfig
1.69 + {
1.70 + public:
1.71 + TEAacPlusFormatType iFormatType; // Container type.
1.72 + TInt iSamplingFrequency; // Sampling freq of AAC core decoder
1.73 + TInt iObjectType; // MPEG Audio Object Type 2=AAC-LC; 4=AAC-LTP
1.74 + };
1.75 +
1.76 +
1.77 + public: // Constructors and destructor
1.78 +
1.79 + /**
1.80 + * Two-phased constructor.
1.81 + */
1.82 + IMPORT_C static CEAacPlusUtil* NewL();
1.83 +
1.84 + /**
1.85 + * Destructor.
1.86 + */
1.87 + IMPORT_C virtual ~CEAacPlusUtil();
1.88 +
1.89 + public: // New functions
1.90 +
1.91 + /**
1.92 + * Used to get the format type.
1.93 + * @since 3.2
1.94 + * @param aBuf buffer of AAC data from start of aac content
1.95 + * @param aBufLen length of aBuf
1.96 + * @param TEAacPlusFormatType returned format type 0=raw; 1=ADIF; 2=ADTS
1.97 + * @return status
1.98 + */
1.99 + IMPORT_C TInt GetAacFormatType(const TUint8* aBuf, TInt aBufLen, TEAacPlusFormatType& aFormatType);
1.100 +
1.101 + /**
1.102 + * Used to get the audio format information for ADIF and ADTS content.
1.103 + * Data should be provided beginning with start of aac content including header.
1.104 + * Enough data should follow the header to determine SBR and PS if needed.
1.105 + * Can be used with mpeg data where aHdrBuf will contain the AudioSpecificConfig. Implicit SBR and PS
1.106 + * will not be determined.
1.107 + * @since 3.2
1.108 + * @param aHdrBuf buffer with AAC data beginning at start of aac content including ADIF or ADTS header
1.109 + * @param aHdrLen length of aHdrBuf; header length is returned in this parameter
1.110 + * @param aFrameInfo returns the format information
1.111 + * @return status
1.112 + */
1.113 + IMPORT_C TInt GetAacFrameInfo (const TUint8* aHdrBuf, TInt& aHdrLen, TEAacPlusFrameInfo& aFrameInfo);
1.114 +
1.115 + /**
1.116 + * Used to get the audio format information for mpeg aac.
1.117 + * aHdrBuf will contain the AudioSpecificConfig. aDataBuf will contain data at beginning of raw audio frames.
1.118 + * Implicit SBR and PS can be determined.
1.119 + * @since 3.2
1.120 + * @param aHdrBuf buffer with AudioSpecificConfig data.
1.121 + * @param aHdrLen length of aHdrBuf
1.122 + * @param aFrameInfo returns the format information
1.123 + * @param aDataBuf buffer with raw audio frames
1.124 + * @param aDataBufLen length of aDataBuf
1.125 + * @return status
1.126 + */
1.127 + IMPORT_C TInt GetAacFrameInfo (const TUint8* aHdrBuf, TInt& aHdrLen, TEAacPlusFrameInfo& aFrameInfo,
1.128 + TUint8* aDataBuf, TInt aDataBufLen);
1.129 +
1.130 + /**
1.131 + * Used to get the size in bytes of the frame found at the start of aBuf.
1.132 + * @since 3.2
1.133 + * @param aBuf buffer with AAC data frame
1.134 + * @param aBufLen length of aBuf
1.135 + * @param aFrameLen returns the frame size in bytes
1.136 + * @return status
1.137 + */
1.138 + IMPORT_C TInt GetAacFrameLength(const TUint8* aBuf, TInt aBufLen, TInt& aFrameLen);
1.139 +
1.140 + /**
1.141 + * Used to configure the utility with information needed to enable the apis.
1.142 + * This api can be used if GetAacFrameInfo is not used to initialize the utility.
1.143 + * @since 3.2
1.144 + * @param aFormatType format type
1.145 + * @param aSamplingFrequency sampling frequency
1.146 + * @return status
1.147 + */
1.148 + IMPORT_C TInt Config(TEAacPlusFrameLenConfig& aFrameLenConfig);
1.149 +
1.150 + private:
1.151 +
1.152 + /**
1.153 + * C++ default constructor.
1.154 + */
1.155 + CEAacPlusUtil();
1.156 +
1.157 + /**
1.158 + * By default Symbian 2nd phase constructor is private.
1.159 + */
1.160 + void ConstructL();
1.161 +
1.162 + private: // Data
1.163 + TEAacPlusFormatType iFormat;
1.164 + EAacpAudioFrameInfo* iGetFrameLenParam;
1.165 + TBool iInitialized;
1.166 + };
1.167 +
1.168 +#endif // EAACPLUSUTIL_H
1.169 +
1.170 +// End of File