Ignore:
Timestamp:
11/09/06 21:39:12 (18 years ago)
Author:
r2d
Message:
  • report file size
Location:
libmpcdec/branches/zorg/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libmpcdec/branches/zorg/src/decoder.h

    r107 r108  
    6464    /// @name internal state variables
    6565    //@{
    66         mpc_uint32_t  stream_version; ///< Streamversion of stream
    67         mpc_uint32_t  max_band; ///< Maximum band-index used in stream (0...31)
    68         mpc_uint32_t  ms; ///< Mid/side stereo (0: off, 1: on)
    69         mpc_uint32_t  is_true_gapless; ///< True gapless? (0: no, 1: yes)
    70         mpc_uint32_t  frames; ///< Number of frames in stream
    71         mpc_uint32_t  last_frame_samples; ///< Number of valid samples within last frame
    72         mpc_uint32_t channels; ///< Number of channels in stream
     66        mpc_uint32_t stream_version;    ///< Streamversion of stream
     67        mpc_uint32_t max_band;          ///< Maximum band-index used in stream (0...31)
     68        mpc_uint32_t ms;                ///< Mid/side stereo (0: off, 1: on)
     69        mpc_uint32_t is_true_gapless;    ///< True gapless? (0: no, 1: yes)
     70        mpc_uint32_t frames;            ///< Number of frames in stream
     71        mpc_uint32_t last_frame_samples; ///< Number of valid samples within last frame
     72        mpc_uint32_t channels;           ///< Number of channels in stream
    7373
    74         mpc_uint32_t  samples_to_skip;
    75         mpc_uint32_t  decoded_frames;
     74        mpc_uint32_t samples_to_skip;    ///< Number samples to skip (used for seeking)
     75        mpc_uint32_t decoded_frames;     ///< Number of frames decoded from file begining
    7676
    7777    // randomizer state variables
  • libmpcdec/branches/zorg/src/mpc_decoder.c

    r107 r108  
    119119                                                          mpc_frame_info * i)
    120120{
    121         d->decoded_frames++;
    122 
    123         if (d->decoded_frames > d->frames && !d->is_true_gapless) {
     121        mpc_int64_t samples_left;
     122        if (d->decoded_frames >= d->frames && !d->is_true_gapless) {
    124123                mpc_decoder_reset_y(d);
    125124        } else {
     
    129128        mpc_decoder_synthese_filter_float(d, i->buffer);
    130129
     130        d->decoded_frames++;
     131
    131132    // cut off first MPC_DECODER_SYNTH_DELAY zero-samples
    132133    // reconstruct exact filelength
    133         if (d->decoded_frames == d->frames && (d->stream_version & 15) == 7) {
    134                 d->last_frame_samples = mpc_bits_read(r, 11);
    135                 if (d->last_frame_samples == 0) {
    136             // Encoder bugfix
    137                         d->last_frame_samples = MPC_FRAME_LENGTH;
    138                 }
    139         }
    140 
    141         mpc_int32_t samples_left = d->last_frame_samples + MPC_DECODER_SYNTH_DELAY
    142                         + (d->frames - d->decoded_frames) * MPC_FRAME_LENGTH;
     134        if (d->decoded_frames == d->frames && (d->stream_version & 15) == 7 &&
     135                (d->last_frame_samples = mpc_bits_read(r, 11)) == 0)
     136                // Encoder bugfix
     137                d->last_frame_samples = MPC_FRAME_LENGTH;
     138
     139        samples_left = d->last_frame_samples + MPC_DECODER_SYNTH_DELAY
     140                        + ((mpc_int64_t)d->frames - d->decoded_frames) * MPC_FRAME_LENGTH;
    143141
    144142        i->samples = samples_left > MPC_FRAME_LENGTH ? MPC_FRAME_LENGTH : samples_left < 0 ? 0 : samples_left;
     143
     144        if (samples_left <= MPC_FRAME_LENGTH) d->is_true_gapless = 0;
    145145
    146146        if (d->samples_to_skip) {
  • libmpcdec/branches/zorg/src/mpc_demux.c

    r107 r108  
    9898        int err;
    9999
     100        memset(&d->si, 0, sizeof d->si);
     101
    100102    // get header position
    101103        err = d->si.header_position = mpc_skip_id3v2(d->r);
     
    106108        if(!err) return MPC_STATUS_FILE;
    107109
    108         memset(&d->si, 0, sizeof d->si);
     110        d->si.tag_offset = d->si.total_file_length = d->r->get_size(d->r);
     111
    109112        mpc_demux_fill(d, 4, 0);
    110113        magic[0] = mpc_bits_read(&d->bits_reader, 8);
Note: See TracChangeset for help on using the changeset viewer.