Ignore:
Timestamp:
02/17/07 18:49:10 (18 years ago)
Author:
r2d
Message:
  • updated according to the spec
  • now reads / write beginning / end silences, but decoder does not care.
  • please test !
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpc/branches/r2d/libmpcdec/streaminfo.c

    r219 r220  
    8484                int major = si->encoder_version >> 24;
    8585                int minor = (si->encoder_version >> 16) & 0xFF;
    86                 int impl = (si->encoder_version >> 8) & 0xFF;
    87                 int build = si->encoder_version & 0xFF;
     86                int build = (si->encoder_version >> 8) & 0xFF;
    8887                char * tmp = "--Stable--";
    8988
     
    9190                        tmp = "--Unstable--";
    9291
    93                 sprintf(si->encoder, "%s %u.%u.%u build %u", tmp, major, minor, impl,
    94                                 build);
     92                sprintf(si->encoder, "%s %u.%u build %u", tmp, major, minor, build);
    9593        }
    9694}
     
    164162        mpc_bits_reader r = *r_in;
    165163
    166         mpc_bits_read(&r, 8); // gain version
     164        int version = mpc_bits_read(&r, 8); // gain version
     165        if (version != 1) // we only know ver 1
     166                return;
    167167        si->gain_title         = (mpc_uint16_t) mpc_bits_read(&r, 16);
    168168        si->peak_title         = (mpc_uint16_t) mpc_bits_read(&r, 16);
     
    177177{
    178178        mpc_uint32_t CRC;
    179         mpc_uint64_t info_len;
    180         mpc_bits_reader r = *r_in, r_gain;
     179        mpc_bits_reader r = *r_in;
    181180
    182181        CRC = mpc_bits_read(&r, 32);
     
    184183                return MPC_STATUS_FILE;
    185184
    186         r_gain = r;
    187         mpc_bits_get_size(&r, &info_len);
    188         r_gain.buff += info_len;
    189 
    190185        si->stream_version = mpc_bits_read(&r, 8);
    191186        if (si->stream_version != 8)
     
    193188
    194189        mpc_bits_get_size(&r, &si->samples);
     190        mpc_bits_get_size(&r, &si->beg_silence);
     191        mpc_bits_get_size(&r, &si->end_silence);
     192
    195193        si->is_true_gapless = 1;
    196194        si->sample_freq = samplefreqs[mpc_bits_read(&r, 3)];
     195        si->max_band = mpc_bits_read(&r, 5) + 1;
    197196        si->channels = mpc_bits_read(&r, 4) + 1;
    198         si->max_band = mpc_bits_read(&r, 5) + 1;
    199197        si->ms = mpc_bits_read(&r, 1);
    200198        si->block_pwr = mpc_bits_read(&r, 3) * 2;
     
    206204                                *  si->sample_freq / si->samples;
    207205
    208         streaminfo_gain(si, &r_gain);
    209 
    210206        return MPC_STATUS_OK;
    211207}
     
    219215        si->profile_name       = mpc_get_version_string(si->profile);
    220216        si->pns                = mpc_bits_read(&r, 1);
    221         si->encoder_version = mpc_bits_read(&r, 4) << 24; // major
     217        si->encoder_version = mpc_bits_read(&r, 8) << 24; // major
    222218        si->encoder_version |= mpc_bits_read(&r, 8) << 16; // minor
    223         si->encoder_version |= mpc_bits_read(&r, 4) << 8; // implementation
    224         si->encoder_version |= mpc_bits_read(&r, 8); // build
     219        si->encoder_version |= mpc_bits_read(&r, 8) << 8; // build
     220
    225221
    226222        mpc_get_encoder_string(si);
Note: See TracChangeset for help on using the changeset viewer.