// Decode reads a FLAC file, decodes it, verifies its MD5 checksum, and returns the data and metadata.
542395
func Decode(r io.Reader) ([]byte, MetaData, error) {
	d, err := NewDecoder(r)
	if err != nil {
		return nil, MetaData{}, err
	}

	data := make([]byte, 0, d.TotalSamples*int64(d.NChannels)*int64(d.BitsPerSample/8))
	for {
		frame, err := d.Next()
		if err == io.EOF {
			break
		} else if err != nil {
			return nil, MetaData{}, err
		}
		data = append(data, frame...)
	}

	h := md5.New()
	if _, err := h.Write(data); err != nil {
		return nil, MetaData{}, err
	}
	if !bytes.Equal(h.Sum(nil), d.MD5[:]) {
		return nil, MetaData{}, errors.New("Bad MD5 checksum")
	}
	return data, d.MetaData, nil
}
1130487
func (b binaryEncoderDecoder) Decode(data []byte, v interface{}) error {
	buf := bytes.NewBuffer(data)
	dec := gob.NewDecoder(buf)
	return dec.Decode(v)
}
1169574
func Decode(input string) ([]byte, error) {
	if len(input) == 0 {
		return nil, ErrEmptyString
	}
	if !has0xPrefix(input) {
		return nil, ErrMissingPrefix
	}
	b, err := hex.DecodeString(input[2:])
	if err != nil {
		err = mapError(err)
	}
	return b, err
}
423002
func Decode(src []byte) (body []byte, err error) {
	body = make([]byte, Encoding.DecodedLen(len(src)))
	_, err = Encoding.Decode(body, src)
	return
}
1032742
func (m *SerialControl) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.BAUDRATE)
	binary.Read(data, binary.LittleEndian, &m.TIMEOUT)
	binary.Read(data, binary.LittleEndian, &m.DEVICE)
	binary.Read(data, binary.LittleEndian, &m.FLAGS)
	binary.Read(data, binary.LittleEndian, &m.COUNT)
	binary.Read(data, binary.LittleEndian, &m.DATA)
}
1354451
func Decode(data bytes.Buffer, strict bool) (Playlist, ListType, error) {
	return decode(&data, strict)
}
292332
func (e *encoding) decode(s string) uint64 {
	x := uint64(0)
	for i := 0; i < len(s); i++ {
		x = (x << 5) | uint64(e.dec[s[i]])
	}
	return x
}
696829
func Decode(code *string) error {
	// Don't decode empty strings
	if *code == "" {
		return nil
	}
	unhexedBytes, err := hex.DecodeString(*code)
	if err != nil {
		return err
	}
	buf := bytes.NewBuffer(unhexedBytes)
	decompressorReader := flate.NewReader(buf)
	decompressedBytes, err := ioutil.ReadAll(decompressorReader)
	decompressorReader.Close()
	if err != nil {
		return err
	}
	*code = string(decompressedBytes)
	return nil
}
378617
func decode(dest interface{}, data []byte) error {
	reader, err := gzip.NewReader(bytes.NewReader(data))
	if err != nil {
		return err
	}
	err = json.NewDecoder(reader).Decode(dest)
	if err != nil {
		return err
	}
	return reader.Close()
}
540932
func (m *StateCorrection) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.XERR)
	binary.Read(data, binary.LittleEndian, &m.YERR)
	binary.Read(data, binary.LittleEndian, &m.ZERR)
	binary.Read(data, binary.LittleEndian, &m.ROLLERR)
	binary.Read(data, binary.LittleEndian, &m.PITCHERR)
	binary.Read(data, binary.LittleEndian, &m.YAWERR)
	binary.Read(data, binary.LittleEndian, &m.VXERR)
	binary.Read(data, binary.LittleEndian, &m.VYERR)
	binary.Read(data, binary.LittleEndian, &m.VZERR)
}
1265880
func DecodeFile(fpath string, v interface{}) (MetaData, error) {
	bs, err := ioutil.ReadFile(fpath)
	if err != nil {
		return MetaData{}, err
	}
	return Decode(string(bs), v)
}
296151
func (i *Image) Decode() (image.Image, string, error) {
	data := i.Data()
	buffer := bytes.NewBuffer(data)
	return image.Decode(buffer)
}
360732
func (jsonEncoderDecoder) Decode(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}
1171372
func Decode(im *imageserver.Image) (image.Image, error) {
	nim, format, err := image.Decode(bytes.NewReader(im.Data))
	if err != nil {
		return nil, &imageserver.ImageError{Message: err.Error()}
	}
	if format != im.Format {
		return nil, &imageserver.ImageError{Message: fmt.Sprintf("decoded format \"%s\" does not match image format \"%s\"", format, im.Format)}
	}
	return nim, nil
}
361892
func (u *DefaultDecoder) Decode(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}
1163229
func (m *FileTransferRes) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.TRANSFER_UID)
	binary.Read(data, binary.LittleEndian, &m.RESULT)
}
868786
func (m *ParamValue) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.PARAM_VALUE)
	binary.Read(data, binary.LittleEndian, &m.PARAM_COUNT)
	binary.Read(data, binary.LittleEndian, &m.PARAM_INDEX)
	binary.Read(data, binary.LittleEndian, &m.PARAM_ID)
	binary.Read(data, binary.LittleEndian, &m.PARAM_TYPE)
}