libmpcdec: include/mpcdec/mpcdec.h Source File

Main Page | Class List | Directories | File List | Class Members | File Members | Related Pages

# mpcdec.h

Go to the documentation of this file.

    00001 /*
    00002   Copyright (c) 2005, 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 */
    00034
    00037
    00038 #ifndef _mpcdec_h_
    00039 #define _mpcdec_h_
    00040
    00041 #ifdef __cplusplus
    00042 extern "C" {
    00043 #endif
    00044
    00045 #include <stdio.h>
    00046 #include <stdlib.h>
    00047 #include <string.h>
    00048
    00049 #ifndef WIN32
    00050 #include "mpcdec/config_types.h"
    00051 #else
    00052 #include "mpcdec/config_win32.h"
    00053 #endif
    00054
    00055 #include "decoder.h"
    00056 #include "math.h"
    00057 #include "reader.h"
    00058 #include "streaminfo.h"
    00059
    00060 enum {
    00061     MPC_FRAME_LENGTH = (36 * 32),
    00062     MPC_DECODER_BUFFER_LENGTH = 4 * MPC_FRAME_LENGTH
    00063 };
    00064
    00065 // error codes
    00066 #define ERROR_CODE_OK            0
    00067 #define ERROR_CODE_FILE         -1
    00068 #define ERROR_CODE_SV7BETA       1
    00069 #define ERROR_CODE_CBR           2
    00070 #define ERROR_CODE_IS            3
    00071 #define ERROR_CODE_BLOCKSIZE     4
    00072 #define ERROR_CODE_INVALIDSV     5
    00073
    00076 void mpc_streaminfo_init(mpc_streaminfo *si);
    00077
    00082 mpc_int32_t mpc_streaminfo_read(mpc_streaminfo *si, mpc_reader *r);
    00083
    00086 double mpc_streaminfo_get_length(mpc_streaminfo *si);
    00087
    00090 mpc_int64_t mpc_streaminfo_get_length_samples(mpc_streaminfo *si);
    00091
    00095 void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r);
    00096
    00101 mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si);
    00102
    00103 void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si);
    00104
    00108 void mpc_decoder_scale_output(mpc_decoder *d, double scale_factor);
    00109
    00118 mpc_uint32_t mpc_decoder_decode(
    00119     mpc_decoder *d,
    00120     MPC_SAMPLE_FORMAT *buffer,
    00121     mpc_uint32_t *vbr_update_acc,
    00122     mpc_uint32_t *vbr_update_bits);
    00123
    00124 mpc_uint32_t mpc_decoder_decode_frame(
    00125     mpc_decoder *d,
    00126     mpc_uint32_t *in_buffer,
    00127     mpc_uint32_t in_len,
    00128     MPC_SAMPLE_FORMAT *out_buffer);
    00129
    00131 mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample);
    00132
    00134 mpc_bool_t mpc_decoder_seek_seconds(mpc_decoder *d, double seconds);
    00135
    00136 #ifdef __cplusplus
    00137 }
    00138 #endif // __cplusplus
    00139
    00140 #endif // _mpcdec_h_