sl@0: /* sl@0: * Copyright (c) 2007 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: Header file for EAacPlusUtil.cpp sl@0: * sl@0: */ sl@0: sl@0: sl@0: #ifndef EAACPLUSUTIL_H sl@0: #define EAACPLUSUTIL_H sl@0: sl@0: // INCLUDES sl@0: #include sl@0: sl@0: // CLASS DECLARATION sl@0: class EAacpAudioFrameInfo; sl@0: sl@0: /** sl@0: * This class implements utility functions to extract AAC frame sl@0: * information. sl@0: * sl@0: * @lib MmfEAacPlusUtil.lib sl@0: * @since 3.2 sl@0: */ sl@0: class CEAacPlusUtil : public CBase sl@0: { sl@0: public: sl@0: // CONSTANTS sl@0: enum TEAacPlusFormatType sl@0: { sl@0: EAacPlusFormatRaw=0, sl@0: EAacPlusFormatAdif=1, sl@0: EAacPlusFormatAdts=2 sl@0: }; sl@0: /** sl@0: * EAAC+ frame info struct. sl@0: * sl@0: * @lib MmfEAacPlusUtil.lib sl@0: * @since 3.2 sl@0: */ sl@0: class TEAacPlusFrameInfo sl@0: { sl@0: public: sl@0: TInt iOutFrameSize; // Size of PCM Samples generated by decoder sl@0: TInt iNoOfSamples; // Number of PCM Samples generated by decoder per frame sl@0: TInt iSamplingFrequency; // Sampling freq of AAC Code decoder sl@0: TInt iNoOfChannels; // No of output channel 1=Mono; 2=Stereo sl@0: TInt iObjectType; // MPEG Audio Object Type 2=AAC-LC; 4=AAC-LTP sl@0: TInt iOutSamplingFrequency; // Sampling Frequence for the output samples sl@0: TInt iDownSampledMode; // 0=Normal Mode; 1=Down Sampled mode sl@0: TInt iSbr; // 0=SBR not present; 1=SBR present sl@0: TInt iPs; // 0=PS not present; 1=PS present sl@0: }; sl@0: sl@0: class TEAacPlusFrameLenConfig sl@0: { sl@0: public: sl@0: TEAacPlusFormatType iFormatType; // Container type. sl@0: TInt iSamplingFrequency; // Sampling freq of AAC core decoder sl@0: TInt iObjectType; // MPEG Audio Object Type 2=AAC-LC; 4=AAC-LTP sl@0: }; sl@0: sl@0: sl@0: public: // Constructors and destructor sl@0: sl@0: /** sl@0: * Two-phased constructor. sl@0: */ sl@0: IMPORT_C static CEAacPlusUtil* NewL(); sl@0: sl@0: /** sl@0: * Destructor. sl@0: */ sl@0: IMPORT_C virtual ~CEAacPlusUtil(); sl@0: sl@0: public: // New functions sl@0: sl@0: /** sl@0: * Used to get the format type. sl@0: * @since 3.2 sl@0: * @param aBuf buffer of AAC data from start of aac content sl@0: * @param aBufLen length of aBuf sl@0: * @param TEAacPlusFormatType returned format type 0=raw; 1=ADIF; 2=ADTS sl@0: * @return status sl@0: */ sl@0: IMPORT_C TInt GetAacFormatType(const TUint8* aBuf, TInt aBufLen, TEAacPlusFormatType& aFormatType); sl@0: sl@0: /** sl@0: * Used to get the audio format information for ADIF and ADTS content. sl@0: * Data should be provided beginning with start of aac content including header. sl@0: * Enough data should follow the header to determine SBR and PS if needed. sl@0: * Can be used with mpeg data where aHdrBuf will contain the AudioSpecificConfig. Implicit SBR and PS sl@0: * will not be determined. sl@0: * @since 3.2 sl@0: * @param aHdrBuf buffer with AAC data beginning at start of aac content including ADIF or ADTS header sl@0: * @param aHdrLen length of aHdrBuf; header length is returned in this parameter sl@0: * @param aFrameInfo returns the format information sl@0: * @return status sl@0: */ sl@0: IMPORT_C TInt GetAacFrameInfo (const TUint8* aHdrBuf, TInt& aHdrLen, TEAacPlusFrameInfo& aFrameInfo); sl@0: sl@0: /** sl@0: * Used to get the audio format information for mpeg aac. sl@0: * aHdrBuf will contain the AudioSpecificConfig. aDataBuf will contain data at beginning of raw audio frames. sl@0: * Implicit SBR and PS can be determined. sl@0: * @since 3.2 sl@0: * @param aHdrBuf buffer with AudioSpecificConfig data. sl@0: * @param aHdrLen length of aHdrBuf sl@0: * @param aFrameInfo returns the format information sl@0: * @param aDataBuf buffer with raw audio frames sl@0: * @param aDataBufLen length of aDataBuf sl@0: * @return status sl@0: */ sl@0: IMPORT_C TInt GetAacFrameInfo (const TUint8* aHdrBuf, TInt& aHdrLen, TEAacPlusFrameInfo& aFrameInfo, sl@0: TUint8* aDataBuf, TInt aDataBufLen); sl@0: sl@0: /** sl@0: * Used to get the size in bytes of the frame found at the start of aBuf. sl@0: * @since 3.2 sl@0: * @param aBuf buffer with AAC data frame sl@0: * @param aBufLen length of aBuf sl@0: * @param aFrameLen returns the frame size in bytes sl@0: * @return status sl@0: */ sl@0: IMPORT_C TInt GetAacFrameLength(const TUint8* aBuf, TInt aBufLen, TInt& aFrameLen); sl@0: sl@0: /** sl@0: * Used to configure the utility with information needed to enable the apis. sl@0: * This api can be used if GetAacFrameInfo is not used to initialize the utility. sl@0: * @since 3.2 sl@0: * @param aFormatType format type sl@0: * @param aSamplingFrequency sampling frequency sl@0: * @return status sl@0: */ sl@0: IMPORT_C TInt Config(TEAacPlusFrameLenConfig& aFrameLenConfig); sl@0: sl@0: private: sl@0: sl@0: /** sl@0: * C++ default constructor. sl@0: */ sl@0: CEAacPlusUtil(); sl@0: sl@0: /** sl@0: * By default Symbian 2nd phase constructor is private. sl@0: */ sl@0: void ConstructL(); sl@0: sl@0: private: // Data sl@0: TEAacPlusFormatType iFormat; sl@0: EAacpAudioFrameInfo* iGetFrameLenParam; sl@0: TBool iInitialized; sl@0: }; sl@0: sl@0: #endif // EAACPLUSUTIL_H sl@0: sl@0: // End of File