Changeset 425


Ignore:
Timestamp:
02/16/09 22:33:42 (14 years ago)
Author:
r2d
Message:

check streaminfo values

Location:
libmpc/trunk/libmpcdec
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libmpc/trunk/libmpcdec/mpc_demux.c

    r424 r425  
    429429                d->si.pns = magic[3] >> 4;
    430430                if (d->si.stream_version == 7) {
     431                        mpc_status ret;
    431432                        mpc_demux_fill(d, 6 * 4, MPC_BUFFER_SWAP); // header block size + endian convertion
    432                         streaminfo_read_header_sv7(&d->si, &d->bits_reader);
     433                        ret = streaminfo_read_header_sv7(&d->si, &d->bits_reader);
     434                        if (ret != MPC_STATUS_OK) return ret;
    433435                } else {
    434436                        return MPC_STATUS_INVALIDSV;
  • libmpc/trunk/libmpcdec/streaminfo.c

    r390 r425  
    5151    "'BrainDead'", "'quality 9'", "'quality 10'"
    5252};
    53 static const mpc_int32_t samplefreqs[4] = { 44100, 48000, 37800, 32000 };
     53static const mpc_int32_t samplefreqs[8] = { 44100, 48000, 37800, 32000 };
    5454
    5555static const char *
     
    9797}
    9898
     99static mpc_status check_streaminfo(mpc_streaminfo * si)
     100{
     101        if (si->max_band == 0 || si->max_band > 32
     102            || si->channels > 2)
     103                return MPC_STATUS_FILE;
     104        return MPC_STATUS_OK;
     105}
     106
    99107/// Reads streaminfo from SV7 header.
    100108mpc_status
     
    157165                        *  si->sample_freq / si->samples;
    158166
    159     return MPC_STATUS_OK;
     167        return check_streaminfo(si);
    160168}
    161169
     
    206214                                *  si->sample_freq / (si->samples - si->beg_silence);
    207215
    208         return MPC_STATUS_OK;
     216        return check_streaminfo(si);
    209217}
    210218
Note: See TracChangeset for help on using the changeset viewer.