ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mpadecobjfixpt.h Source File

mpadecobjfixpt.h

00001 /* ***** BEGIN LICENSE BLOCK ***** 
00002  * Version: RCSL 1.0/RPSL 1.0 
00003  *  
00004  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
00005  *      
00006  * The contents of this file, and the files included with this file, are 
00007  * subject to the current version of the RealNetworks Public Source License 
00008  * Version 1.0 (the "RPSL") available at 
00009  * http://www.helixcommunity.org/content/rpsl unless you have licensed 
00010  * the file under the RealNetworks Community Source License Version 1.0 
00011  * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
00012  * in which case the RCSL will apply. You may also obtain the license terms 
00013  * directly from RealNetworks.  You may not use this file except in 
00014  * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
00015  * applicable to this file, the RCSL.  Please see the applicable RPSL or 
00016  * RCSL for the rights, obligations and limitations governing use of the 
00017  * contents of the file.  
00018  *  
00019  * This file is part of the Helix DNA Technology. RealNetworks is the 
00020  * developer of the Original Code and owns the copyrights in the portions 
00021  * it created. 
00022  *  
00023  * This file, and the files included with this file, is distributed and made 
00024  * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
00025  * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
00026  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
00027  * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
00028  * 
00029  * Technology Compatibility Kit Test Suite(s) Location: 
00030  *    http://www.helixcommunity.org/content/tck 
00031  * 
00032  * Contributor(s): 
00033  *  
00034  * ***** END LICENSE BLOCK ***** */ 
00035 
00036 #ifndef _MPADECOBJFIXPT_H_
00037 #define _MPADECOBJFIXPT_H_
00038 
00039 #include "mp3dec.h"     /* public C API for new MP3 decoder */
00040 
00041 class CMpaDecObj
00042 {
00043 public:
00044     CMpaDecObj();
00045     ~CMpaDecObj();
00046 
00047     ///////////////////////////////////////////////////////////////////////////
00048     // Function:    Init_n
00049     // Purpose:     Initialize the mp3 decoder.
00050     // Parameters:  pSync       a pointer to a syncword
00051     //              ulSize      the size of the buffer pSync points to
00052     //              bUseSize    this tells the decoder to use the input frame
00053     //                          size on the decode instead of calculating
00054     //                          the frame size.  This is necessary when
00055     //                          our formatted mp3 data (main_data_begin always
00056     //                          equal to 0).
00057     //
00058     // Returns:     returns 1 on success, 0 on failure
00059     ///////////////////////////////////////////////////////////////////////////
00060     int     Init_n(unsigned char *pSync,
00061                    unsigned long ulSize,
00062                    unsigned char bUseSize=0);
00063 
00064     ///////////////////////////////////////////////////////////////////////////
00065     // Function:    DecodeFrame_v
00066     // Purpose:     Decodes one mp3 frame
00067     // Parameters:  pSource     pointer to an mp3 frame (at a syncword)
00068     //              pulSize     size of the buffer pSource points to.  It will
00069     //                          contain the number of mp3 bytes decoded upon
00070     //                          return.
00071     //              pPCM        pointer to a buffer to decode into
00072     //              pulPCMSize  size of the PCM buffer.  It will contain the
00073     //                          number of PCM bytes prodced upon return.
00074     ///////////////////////////////////////////////////////////////////////////
00075     void    DecodeFrame_v(unsigned char *pSource,
00076                           unsigned long *pulSize,
00077                           unsigned char *pPCM,
00078                           unsigned long *pulPCMSize);
00079 
00080     // overloaded new version that returns error code in errCode
00081     void    DecodeFrame_v(unsigned char *pSource,
00082                           unsigned long *pulSize,
00083                           unsigned char *pPCM,
00084                           unsigned long *pulPCMSize, 
00085                           int *errCode);
00086 
00087     void    GetPCMInfo_v(unsigned long &ulSampRate,
00088                          int &nChannels,
00089                          int &nBitsPerSample);
00090 
00091     // return number of samples per frame, PER CHANNEL (renderer multiplies this result by nChannels)
00092     int     GetSamplesPerFrame_n();
00093 
00094     void    SetTrustPackets(unsigned char bTrust) { m_bTrustPackets = bTrust; }
00095 
00096 private:
00097     void *              m_pDec;     // generic void ptr
00098 
00099     void *              m_pDecL1;   // not implemented (could use old Xing mpadecl1.cpp)
00100     void *              m_pDecL2;   // not implemented (could use old Xing mpadecl2.cpp)
00101     HMP3Decoder         m_pDecL3;
00102 
00103     MP3FrameInfo        m_lastMP3FrameInfo;
00104     unsigned char       m_bUseFrameSize;
00105         unsigned char           m_bTrustPackets;
00106 };
00107 
00108 #endif  /* _MPADECOBJFIXPT_H_ */