ex

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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mp3dec.h Source File

mp3dec.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 /**************************************************************************************
00037  * Fixed-point MP3 decoder
00038  * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com)
00039  * June 2003
00040  *
00041  * mp3dec.h - public C API for MP3 decoder
00042  **************************************************************************************/
00043 
00044 #ifndef _MP3DEC_H
00045 #define _MP3DEC_H
00046 
00047 #define RDA5991H
00048 
00049 #if defined(_WIN32) && !defined(_WIN32_WCE)
00050 #
00051 #elif defined(_WIN32) && defined(_WIN32_WCE) && defined(ARM)
00052 #
00053 #elif defined(_WIN32) && defined(WINCE_EMULATOR)
00054 #
00055 #elif defined(ARM_ADS)
00056 #
00057 #elif defined(_SYMBIAN) && defined(__WINS__)    /* Symbian emulator for Ix86 */
00058 #
00059 #elif defined(__GNUC__) && defined(ARM)
00060 #
00061 #elif defined(__GNUC__) && defined(__i386__)
00062 #
00063 #elif defined(_OPENWAVE_SIMULATOR) || defined(_OPENWAVE_ARMULATOR)
00064 #
00065 #elif defined(RDA5991H)
00066 #else
00067 #error No platform defined. See valid options in mp3dec.h
00068 #endif
00069 
00070 #ifdef __cplusplus
00071 extern "C" {
00072 #endif
00073 
00074 /* determining MAINBUF_SIZE:
00075  *   max mainDataBegin = (2^9 - 1) bytes (since 9-bit offset) = 511
00076  *   max nSlots (concatenated with mainDataBegin bytes from before) = 1440 - 9 - 4 + 1 = 1428
00077  *   511 + 1428 = 1939, round up to 1940 (4-byte align)
00078  */
00079 #define MAINBUF_SIZE    1940
00080 
00081 #define MAX_NGRAN       2       /* max granules */
00082 #define MAX_NCHAN       2       /* max channels */
00083 #define MAX_NSAMP       576     /* max samples per channel, per granule */
00084 
00085 /* map to 0,1,2 to make table indexing easier */
00086 typedef enum {
00087     MPEG1 =  0,
00088     MPEG2 =  1,
00089     MPEG25 = 2
00090 } MPEGVersion;
00091 
00092 typedef void *HMP3Decoder;
00093 
00094 enum {
00095     ERR_MP3_NONE =                  0,
00096     ERR_MP3_INDATA_UNDERFLOW =     -1,
00097     ERR_MP3_MAINDATA_UNDERFLOW =   -2,
00098     ERR_MP3_FREE_BITRATE_SYNC =    -3,
00099     ERR_MP3_OUT_OF_MEMORY =        -4,
00100     ERR_MP3_NULL_POINTER =         -5,
00101     ERR_MP3_INVALID_FRAMEHEADER =  -6,
00102     ERR_MP3_INVALID_SIDEINFO =     -7,
00103     ERR_MP3_INVALID_SCALEFACT =    -8,
00104     ERR_MP3_INVALID_HUFFCODES =    -9,
00105     ERR_MP3_INVALID_DEQUANTIZE =   -10,
00106     ERR_MP3_INVALID_IMDCT =        -11,
00107     ERR_MP3_INVALID_SUBBAND =      -12,
00108 
00109     ERR_UNKNOWN =                  -9999
00110 };
00111 
00112 typedef struct _MP3FrameInfo {
00113     int bitrate;
00114     int nChans;
00115     int samprate;
00116     int bitsPerSample;
00117     int outputSamps;
00118     int layer;
00119     int version;
00120 } MP3FrameInfo;
00121 
00122 /* public API */
00123 HMP3Decoder MP3InitDecoder(void);
00124 void MP3FreeDecoder(HMP3Decoder hMP3Decoder);
00125 int MP3Decode(HMP3Decoder hMP3Decoder, unsigned char **inbuf, int *bytesLeft, short *outbuf, int useSize);
00126 
00127 void MP3GetLastFrameInfo(HMP3Decoder hMP3Decoder, MP3FrameInfo *mp3FrameInfo);
00128 int MP3GetNextFrameInfo(HMP3Decoder hMP3Decoder, MP3FrameInfo *mp3FrameInfo, unsigned char *buf);
00129 int MP3FindSyncWord(unsigned char *buf, int nBytes);
00130 
00131 #ifdef __cplusplus
00132 }
00133 #endif
00134 
00135 #endif  /* _MP3DEC_H */