mpcdec.h

Go to the documentation of this file.
00001 /*
00002   Copyright (c) 2005-2009, The Musepack Development Team
00003   All rights reserved.
00004 
00005   Redistribution and use in source and binary forms, with or without
00006   modification, are permitted provided that the following conditions are
00007   met:
00008 
00009   * Redistributions of source code must retain the above copyright
00010   notice, this list of conditions and the following disclaimer.
00011 
00012   * Redistributions in binary form must reproduce the above
00013   copyright notice, this list of conditions and the following
00014   disclaimer in the documentation and/or other materials provided
00015   with the distribution.
00016 
00017   * Neither the name of the The Musepack Development Team nor the
00018   names of its contributors may be used to endorse or promote
00019   products derived from this software without specific prior
00020   written permission.
00021 
00022   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00025   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00026   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00027   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00028   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00029   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00030   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00031   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00032   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 */
00036 #ifndef _MPCDEC_H_
00037 #define _MPCDEC_H_
00038 #ifdef WIN32
00039 #pragma once
00040 #endif
00041 
00042 #include "reader.h"
00043 #include "streaminfo.h"
00044 
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif
00048 
00049 enum {
00050     MPC_FRAME_LENGTH          = (36 * 32),              
00051     MPC_DECODER_BUFFER_LENGTH = (MPC_FRAME_LENGTH * 4), 
00052     MPC_DECODER_SYNTH_DELAY   = 481
00053 };
00054 
00055 typedef struct mpc_decoder_t mpc_decoder;
00056 typedef struct mpc_demux_t mpc_demux;
00057 
00058 typedef struct mpc_bits_reader_t {
00059         unsigned char * buff; 
00060         unsigned int count; 
00061 } mpc_bits_reader;
00062 
00063 typedef struct mpc_frame_info_t {
00064         mpc_uint32_t samples;           
00065         mpc_int32_t bits;                       
00066         MPC_SAMPLE_FORMAT * buffer;     
00067         mpc_bool_t is_key_frame;        
00068 } mpc_frame_info;
00069 
00070 typedef struct mpc_chap_info_t {
00071         mpc_uint64_t sample;    
00072         mpc_uint16_t gain;              
00073         mpc_uint16_t peak;              
00074         mpc_uint_t tag_size;    
00075         char * tag;                             
00076 } mpc_chap_info;
00077 
00081 MPC_API mpc_decoder * mpc_decoder_init(mpc_streaminfo *si);
00082 
00084 MPC_API void mpc_decoder_exit(mpc_decoder *p_dec);
00085 
00091 MPC_API void mpc_decoder_scale_output(mpc_decoder *p_dec, double scale_factor);
00092 
00093 MPC_API void mpc_decoder_decode_frame(mpc_decoder * d, mpc_bits_reader * r, mpc_frame_info * i);
00094 
00095 // This is the gain reference used in old replaygain
00096 #define MPC_OLD_GAIN_REF 64.82
00097 
00103 MPC_API mpc_demux * mpc_demux_init(mpc_reader * p_reader);
00105 MPC_API void mpc_demux_exit(mpc_demux * d);
00115 MPC_API void mpc_set_replay_level(mpc_demux * d, float level, mpc_bool_t use_gain,
00116                           mpc_bool_t use_title, mpc_bool_t clip_prevention);
00118 MPC_API mpc_status mpc_demux_decode(mpc_demux * d, mpc_frame_info * i);
00120 MPC_API void mpc_demux_get_info(mpc_demux * d, mpc_streaminfo * i);
00122 MPC_API mpc_status mpc_demux_seek_sample(mpc_demux * d, mpc_uint64_t destsample);
00124 MPC_API mpc_status mpc_demux_seek_second(mpc_demux * d, double seconds);
00125 
00127 MPC_API mpc_seek_t mpc_demux_pos(mpc_demux * d);
00128 
00130 
00135 MPC_API mpc_int_t mpc_demux_chap_nb(mpc_demux * d);
00143 MPC_API mpc_chap_info const * mpc_demux_chap(mpc_demux * d, int chap_nb);
00144 
00145 #ifdef __cplusplus
00146 }
00147 #endif
00148 #endif

Generated on 20 Jan 2011 for libmpcdec by  doxygen 1.6.1