Ignore:
Timestamp:
10/06/06 17:14:05 (18 years ago)
Author:
zorg
Message:

Separated public interface from private headers
Use opaque objects whenever possible
Some (useless?) cosmetics on libmpcdec
Remove sv5-6 outdated support
Added libwavformat for upcoming mpcdec
New layout
Work in progress...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpcdec/branches/zorg/include/mpcdec/mpcdec.h

    r37 r68  
    3232  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    3333*/
    34 
    3534/// \file mpcdec.h
    3635/// Top level include file for libmpcdec.
     36#ifndef _MPCDEC_H_
     37#define _MPCDEC_H_
     38#ifdef WIN32
     39#pragma once
     40#endif
    3741
    38 #ifndef _mpcdec_h_
    39 #define _mpcdec_h_
     42#include "streaminfo.h"
    4043
    4144#ifdef __cplusplus
     
    4346#endif
    4447
    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);
     48typedef struct mpc_decoder_t mpc_decoder;
    9149
    9250/// Sets up decoder library.
    9351/// Call this first when preparing to decode an mpc stream.
    94 /// \param r reader that will supply raw data to the decoder
    95 void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r);
     52/// \param p_reader reader that will supply raw data to the decoder
     53void mpc_decoder_setup(mpc_decoder *p_dec, mpc_reader *p_reader);
    9654
    9755/// Initializes mpc decoder with the supplied stream info parameters.
    98 /// Call this next after calling mpc_decoder_setup.
    9956/// \param si streaminfo structure indicating format of source stream
    10057/// \return TRUE if decoder was initalized successfully, FALSE otherwise   
    101 mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si);
     58mpc_status mpc_init_decoder(mpc_decoder **p_dec, mpc_streaminfo *si);
     59
     60/// Releases input mpc decoder
     61void mpc_exit_decoder(mpc_decoder *p_dec);
    10262
    10363/// Call this next after calling mpc_decoder_setup.
    10464/// \param si streaminfo structure indicating format of source stream
    10565/// \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);
     66void mpc_decoder_set_seeking(mpc_decoder *p_dec, mpc_streaminfo *si, mpc_bool_t fast_seeking);
    10767
    108 void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si);
     68void mpc_decoder_set_streaminfo(mpc_decoder *p_dec, mpc_streaminfo *si);
    10969
    11070/// Sets decoder sample scaling factor.  All decoded samples will be multiplied
    11171/// by this factor.
    11272/// \param scale_factor multiplicative scaling factor
    113 void mpc_decoder_scale_output(mpc_decoder *d, double scale_factor);
     73void mpc_decoder_scale_output(mpc_decoder *p_dec, double scale_factor);
    11474
    11575/// Actually reads data from previously initialized stream.  Call
     
    12282/// \return > 0 to indicate the number of bytes that were actually read from the stream.
    12383mpc_uint32_t mpc_decoder_decode(
    124     mpc_decoder *d,
     84    mpc_decoder       *p_dec,
    12585    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);
    12888
    12989mpc_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,
    13393    MPC_SAMPLE_FORMAT *out_buffer);
    13494
    13595/// Seeks to the specified sample in the source stream.
    136 mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample);
     96mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *p_dec, mpc_int64_t destsample);
    13797
    13898/// Seeks to specified position in seconds in the source stream.
    139 mpc_bool_t mpc_decoder_seek_seconds(mpc_decoder *d, double seconds);
     99mpc_bool_t mpc_decoder_seek_seconds(mpc_decoder *p_dec, double seconds);
    140100
    141101#ifdef __cplusplus
    142102}
    143 #endif // __cplusplus
    144 
    145 #endif // _mpcdec_h_
     103#endif
     104#endif
Note: See TracChangeset for help on using the changeset viewer.