Changeset 68 for libmpcdec/branches/zorg/include/mpcdec/mpcdec.h
- Timestamp:
- 10/06/06 17:14:05 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpcdec/branches/zorg/include/mpcdec/mpcdec.h
r37 r68 32 32 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 33 */ 34 35 34 /// \file mpcdec.h 36 35 /// Top level include file for libmpcdec. 36 #ifndef _MPCDEC_H_ 37 #define _MPCDEC_H_ 38 #ifdef WIN32 39 #pragma once 40 #endif 37 41 38 #ifndef _mpcdec_h_ 39 #define _mpcdec_h_ 42 #include "streaminfo.h" 40 43 41 44 #ifdef __cplusplus … … 43 46 #endif 44 47 45 #include <stdio.h> 46 #include <stdlib.h> 47 #include <string.h> 48 49 #ifndef WIN32 50 #include "mpcdec/config_types.h" 51 #else 52 #include "mpcdec/config_win32.h" 53 #endif 54 55 #include "decoder.h" 56 #include "math.h" 57 #include "reader.h" 58 #include "streaminfo.h" 59 60 enum { 61 MPC_FRAME_LENGTH = (36 * 32), /// samples per mpc frame 62 MPC_DECODER_BUFFER_LENGTH = 4 * MPC_FRAME_LENGTH /// required buffer size for decoder 63 }; 64 65 // error codes 66 #define ERROR_CODE_OK 0 67 #define ERROR_CODE_FILE -1 68 #define ERROR_CODE_SV7BETA 1 69 #define ERROR_CODE_CBR 2 70 #define ERROR_CODE_IS 3 71 #define ERROR_CODE_BLOCKSIZE 4 72 #define ERROR_CODE_INVALIDSV 5 73 74 /// Initializes a streaminfo structure. 75 /// \param si streaminfo structure to initialize 76 void mpc_streaminfo_init(mpc_streaminfo *si); 77 78 /// Reads streaminfo header from the mpc stream supplied by r. 79 /// \param si streaminfo pointer to which info will be written 80 /// \param r stream reader to supply raw data 81 /// \return error code 82 mpc_int32_t mpc_streaminfo_read(mpc_streaminfo *si, mpc_reader *r); 83 84 /// Gets length of stream si, in seconds. 85 /// \return length of stream in seconds 86 double mpc_streaminfo_get_length(mpc_streaminfo *si); 87 88 /// Returns length of stream si, in samples. 89 /// \return length of stream in samples 90 mpc_int64_t mpc_streaminfo_get_length_samples(mpc_streaminfo *si); 48 typedef struct mpc_decoder_t mpc_decoder; 91 49 92 50 /// Sets up decoder library. 93 51 /// Call this first when preparing to decode an mpc stream. 94 /// \param r reader that will supply raw data to the decoder95 void mpc_decoder_setup(mpc_decoder * d, mpc_reader *r);52 /// \param p_reader reader that will supply raw data to the decoder 53 void mpc_decoder_setup(mpc_decoder *p_dec, mpc_reader *p_reader); 96 54 97 55 /// Initializes mpc decoder with the supplied stream info parameters. 98 /// Call this next after calling mpc_decoder_setup.99 56 /// \param si streaminfo structure indicating format of source stream 100 57 /// \return TRUE if decoder was initalized successfully, FALSE otherwise 101 mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si); 58 mpc_status mpc_init_decoder(mpc_decoder **p_dec, mpc_streaminfo *si); 59 60 /// Releases input mpc decoder 61 void mpc_exit_decoder(mpc_decoder *p_dec); 102 62 103 63 /// Call this next after calling mpc_decoder_setup. 104 64 /// \param si streaminfo structure indicating format of source stream 105 65 /// \param fast_seeking boolean 0 = use fast seeking if safe, 1 = force fast seeking 106 void mpc_decoder_set_seeking(mpc_decoder * d, mpc_streaminfo *si, mpc_bool_t fast_seeking);66 void mpc_decoder_set_seeking(mpc_decoder *p_dec, mpc_streaminfo *si, mpc_bool_t fast_seeking); 107 67 108 void mpc_decoder_set_streaminfo(mpc_decoder * d, mpc_streaminfo *si);68 void mpc_decoder_set_streaminfo(mpc_decoder *p_dec, mpc_streaminfo *si); 109 69 110 70 /// Sets decoder sample scaling factor. All decoded samples will be multiplied 111 71 /// by this factor. 112 72 /// \param scale_factor multiplicative scaling factor 113 void mpc_decoder_scale_output(mpc_decoder * d, double scale_factor);73 void mpc_decoder_scale_output(mpc_decoder *p_dec, double scale_factor); 114 74 115 75 /// Actually reads data from previously initialized stream. Call … … 122 82 /// \return > 0 to indicate the number of bytes that were actually read from the stream. 123 83 mpc_uint32_t mpc_decoder_decode( 124 mpc_decoder *d,84 mpc_decoder *p_dec, 125 85 MPC_SAMPLE_FORMAT *buffer, 126 mpc_uint32_t *vbr_update_acc,127 mpc_uint32_t *vbr_update_bits);86 mpc_uint32_t *vbr_update_acc, 87 mpc_uint32_t *vbr_update_bits); 128 88 129 89 mpc_uint32_t mpc_decoder_decode_frame( 130 mpc_decoder *d,131 mpc_uint32_t *in_buffer,132 mpc_uint32_t in_len,90 mpc_decoder *p_dec, 91 mpc_uint32_t *in_buffer, 92 mpc_uint32_t in_len, 133 93 MPC_SAMPLE_FORMAT *out_buffer); 134 94 135 95 /// Seeks to the specified sample in the source stream. 136 mpc_bool_t mpc_decoder_seek_sample(mpc_decoder * d, mpc_int64_t destsample);96 mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *p_dec, mpc_int64_t destsample); 137 97 138 98 /// Seeks to specified position in seconds in the source stream. 139 mpc_bool_t mpc_decoder_seek_seconds(mpc_decoder * d, double seconds);99 mpc_bool_t mpc_decoder_seek_seconds(mpc_decoder *p_dec, double seconds); 140 100 141 101 #ifdef __cplusplus 142 102 } 143 #endif // __cplusplus 144 145 #endif // _mpcdec_h_ 103 #endif 104 #endif
Note: See TracChangeset
for help on using the changeset viewer.