diff --git a/decoder.go b/decoder.go index 8c96f53..31ee0d6 100644 --- a/decoder.go +++ b/decoder.go @@ -22,5 +22,9 @@ func (d *Decoder) Decode(in []byte) (bandwidth Bandwidth, isStereo bool, frames return 0, false, nil, fmt.Errorf("%w: %d", errUnsupportedFrameCode, tocHeader.frameCode()) } + if cfg.mode() != configurationModeCELTOnly { + return 0, false, nil, fmt.Errorf("%w: %d", errUnsupportedConfigurationMode, cfg.mode()) + } + return cfg.bandwidth(), tocHeader.isStereo(), nil, nil } diff --git a/errors.go b/errors.go index ff17761..6f15636 100644 --- a/errors.go +++ b/errors.go @@ -9,4 +9,6 @@ var ( errTooShortForArbitraryLengthFrames = errors.New("packet is too short to contain arbitrary length frames") errArbitraryLengthFrameVBRUnsupported = errors.New("arbitrary length frames with VBR is unsupported") errArbitraryLengthFramePaddingUnsupported = errors.New("arbitrary length frames with padding is unsupported") + + errUnsupportedConfigurationMode = errors.New("unsupported configuration mode") )