ex

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

Committer:
TMBOY
Date:
Tue Jul 18 16:54:45 2017 +0800
Revision:
47:9e361da97763
?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TMBOY 47:9e361da97763 1 /* ***** BEGIN LICENSE BLOCK *****
TMBOY 47:9e361da97763 2 * Version: RCSL 1.0/RPSL 1.0
TMBOY 47:9e361da97763 3 *
TMBOY 47:9e361da97763 4 * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
TMBOY 47:9e361da97763 5 *
TMBOY 47:9e361da97763 6 * The contents of this file, and the files included with this file, are
TMBOY 47:9e361da97763 7 * subject to the current version of the RealNetworks Public Source License
TMBOY 47:9e361da97763 8 * Version 1.0 (the "RPSL") available at
TMBOY 47:9e361da97763 9 * http://www.helixcommunity.org/content/rpsl unless you have licensed
TMBOY 47:9e361da97763 10 * the file under the RealNetworks Community Source License Version 1.0
TMBOY 47:9e361da97763 11 * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
TMBOY 47:9e361da97763 12 * in which case the RCSL will apply. You may also obtain the license terms
TMBOY 47:9e361da97763 13 * directly from RealNetworks. You may not use this file except in
TMBOY 47:9e361da97763 14 * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
TMBOY 47:9e361da97763 15 * applicable to this file, the RCSL. Please see the applicable RPSL or
TMBOY 47:9e361da97763 16 * RCSL for the rights, obligations and limitations governing use of the
TMBOY 47:9e361da97763 17 * contents of the file.
TMBOY 47:9e361da97763 18 *
TMBOY 47:9e361da97763 19 * This file is part of the Helix DNA Technology. RealNetworks is the
TMBOY 47:9e361da97763 20 * developer of the Original Code and owns the copyrights in the portions
TMBOY 47:9e361da97763 21 * it created.
TMBOY 47:9e361da97763 22 *
TMBOY 47:9e361da97763 23 * This file, and the files included with this file, is distributed and made
TMBOY 47:9e361da97763 24 * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
TMBOY 47:9e361da97763 25 * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
TMBOY 47:9e361da97763 26 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
TMBOY 47:9e361da97763 27 * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
TMBOY 47:9e361da97763 28 *
TMBOY 47:9e361da97763 29 * Technology Compatibility Kit Test Suite(s) Location:
TMBOY 47:9e361da97763 30 * http://www.helixcommunity.org/content/tck
TMBOY 47:9e361da97763 31 *
TMBOY 47:9e361da97763 32 * Contributor(s):
TMBOY 47:9e361da97763 33 *
TMBOY 47:9e361da97763 34 * ***** END LICENSE BLOCK ***** */
TMBOY 47:9e361da97763 35
TMBOY 47:9e361da97763 36 /**************************************************************************************
TMBOY 47:9e361da97763 37 * Fixed-point MP3 decoder
TMBOY 47:9e361da97763 38 * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com)
TMBOY 47:9e361da97763 39 * June 2003
TMBOY 47:9e361da97763 40 *
TMBOY 47:9e361da97763 41 * mp3dec.h - public C API for MP3 decoder
TMBOY 47:9e361da97763 42 **************************************************************************************/
TMBOY 47:9e361da97763 43
TMBOY 47:9e361da97763 44 #ifndef _MP3DEC_H
TMBOY 47:9e361da97763 45 #define _MP3DEC_H
TMBOY 47:9e361da97763 46
TMBOY 47:9e361da97763 47 #define RDA5991H
TMBOY 47:9e361da97763 48
TMBOY 47:9e361da97763 49 #if defined(_WIN32) && !defined(_WIN32_WCE)
TMBOY 47:9e361da97763 50 #
TMBOY 47:9e361da97763 51 #elif defined(_WIN32) && defined(_WIN32_WCE) && defined(ARM)
TMBOY 47:9e361da97763 52 #
TMBOY 47:9e361da97763 53 #elif defined(_WIN32) && defined(WINCE_EMULATOR)
TMBOY 47:9e361da97763 54 #
TMBOY 47:9e361da97763 55 #elif defined(ARM_ADS)
TMBOY 47:9e361da97763 56 #
TMBOY 47:9e361da97763 57 #elif defined(_SYMBIAN) && defined(__WINS__) /* Symbian emulator for Ix86 */
TMBOY 47:9e361da97763 58 #
TMBOY 47:9e361da97763 59 #elif defined(__GNUC__) && defined(ARM)
TMBOY 47:9e361da97763 60 #
TMBOY 47:9e361da97763 61 #elif defined(__GNUC__) && defined(__i386__)
TMBOY 47:9e361da97763 62 #
TMBOY 47:9e361da97763 63 #elif defined(_OPENWAVE_SIMULATOR) || defined(_OPENWAVE_ARMULATOR)
TMBOY 47:9e361da97763 64 #
TMBOY 47:9e361da97763 65 #elif defined(RDA5991H)
TMBOY 47:9e361da97763 66 #else
TMBOY 47:9e361da97763 67 #error No platform defined. See valid options in mp3dec.h
TMBOY 47:9e361da97763 68 #endif
TMBOY 47:9e361da97763 69
TMBOY 47:9e361da97763 70 #ifdef __cplusplus
TMBOY 47:9e361da97763 71 extern "C" {
TMBOY 47:9e361da97763 72 #endif
TMBOY 47:9e361da97763 73
TMBOY 47:9e361da97763 74 /* determining MAINBUF_SIZE:
TMBOY 47:9e361da97763 75 * max mainDataBegin = (2^9 - 1) bytes (since 9-bit offset) = 511
TMBOY 47:9e361da97763 76 * max nSlots (concatenated with mainDataBegin bytes from before) = 1440 - 9 - 4 + 1 = 1428
TMBOY 47:9e361da97763 77 * 511 + 1428 = 1939, round up to 1940 (4-byte align)
TMBOY 47:9e361da97763 78 */
TMBOY 47:9e361da97763 79 #define MAINBUF_SIZE 1940
TMBOY 47:9e361da97763 80
TMBOY 47:9e361da97763 81 #define MAX_NGRAN 2 /* max granules */
TMBOY 47:9e361da97763 82 #define MAX_NCHAN 2 /* max channels */
TMBOY 47:9e361da97763 83 #define MAX_NSAMP 576 /* max samples per channel, per granule */
TMBOY 47:9e361da97763 84
TMBOY 47:9e361da97763 85 /* map to 0,1,2 to make table indexing easier */
TMBOY 47:9e361da97763 86 typedef enum {
TMBOY 47:9e361da97763 87 MPEG1 = 0,
TMBOY 47:9e361da97763 88 MPEG2 = 1,
TMBOY 47:9e361da97763 89 MPEG25 = 2
TMBOY 47:9e361da97763 90 } MPEGVersion;
TMBOY 47:9e361da97763 91
TMBOY 47:9e361da97763 92 typedef void *HMP3Decoder;
TMBOY 47:9e361da97763 93
TMBOY 47:9e361da97763 94 enum {
TMBOY 47:9e361da97763 95 ERR_MP3_NONE = 0,
TMBOY 47:9e361da97763 96 ERR_MP3_INDATA_UNDERFLOW = -1,
TMBOY 47:9e361da97763 97 ERR_MP3_MAINDATA_UNDERFLOW = -2,
TMBOY 47:9e361da97763 98 ERR_MP3_FREE_BITRATE_SYNC = -3,
TMBOY 47:9e361da97763 99 ERR_MP3_OUT_OF_MEMORY = -4,
TMBOY 47:9e361da97763 100 ERR_MP3_NULL_POINTER = -5,
TMBOY 47:9e361da97763 101 ERR_MP3_INVALID_FRAMEHEADER = -6,
TMBOY 47:9e361da97763 102 ERR_MP3_INVALID_SIDEINFO = -7,
TMBOY 47:9e361da97763 103 ERR_MP3_INVALID_SCALEFACT = -8,
TMBOY 47:9e361da97763 104 ERR_MP3_INVALID_HUFFCODES = -9,
TMBOY 47:9e361da97763 105 ERR_MP3_INVALID_DEQUANTIZE = -10,
TMBOY 47:9e361da97763 106 ERR_MP3_INVALID_IMDCT = -11,
TMBOY 47:9e361da97763 107 ERR_MP3_INVALID_SUBBAND = -12,
TMBOY 47:9e361da97763 108
TMBOY 47:9e361da97763 109 ERR_UNKNOWN = -9999
TMBOY 47:9e361da97763 110 };
TMBOY 47:9e361da97763 111
TMBOY 47:9e361da97763 112 typedef struct _MP3FrameInfo {
TMBOY 47:9e361da97763 113 int bitrate;
TMBOY 47:9e361da97763 114 int nChans;
TMBOY 47:9e361da97763 115 int samprate;
TMBOY 47:9e361da97763 116 int bitsPerSample;
TMBOY 47:9e361da97763 117 int outputSamps;
TMBOY 47:9e361da97763 118 int layer;
TMBOY 47:9e361da97763 119 int version;
TMBOY 47:9e361da97763 120 } MP3FrameInfo;
TMBOY 47:9e361da97763 121
TMBOY 47:9e361da97763 122 /* public API */
TMBOY 47:9e361da97763 123 HMP3Decoder MP3InitDecoder(void);
TMBOY 47:9e361da97763 124 void MP3FreeDecoder(HMP3Decoder hMP3Decoder);
TMBOY 47:9e361da97763 125 int MP3Decode(HMP3Decoder hMP3Decoder, unsigned char **inbuf, int *bytesLeft, short *outbuf, int useSize);
TMBOY 47:9e361da97763 126
TMBOY 47:9e361da97763 127 void MP3GetLastFrameInfo(HMP3Decoder hMP3Decoder, MP3FrameInfo *mp3FrameInfo);
TMBOY 47:9e361da97763 128 int MP3GetNextFrameInfo(HMP3Decoder hMP3Decoder, MP3FrameInfo *mp3FrameInfo, unsigned char *buf);
TMBOY 47:9e361da97763 129 int MP3FindSyncWord(unsigned char *buf, int nBytes);
TMBOY 47:9e361da97763 130
TMBOY 47:9e361da97763 131 #ifdef __cplusplus
TMBOY 47:9e361da97763 132 }
TMBOY 47:9e361da97763 133 #endif
TMBOY 47:9e361da97763 134
TMBOY 47:9e361da97763 135 #endif /* _MP3DEC_H */