MCPcopy Create free account
hub / github.com/FunAudioLLM/FunMusic / read_ecdc_header

Function read_ecdc_header

inspiremusic/utils/binary.py:43–51  ·  view source on GitHub ↗
(fo: tp.IO[bytes])

Source from the content-addressed store, hash-verified

41
42
43def read_ecdc_header(fo: tp.IO[bytes]):
44 header_bytes = _read_exactly(fo, _encodec_header_struct.size)
45 magic, version, meta_size = _encodec_header_struct.unpack(header_bytes)
46 if magic != _ENCODEC_MAGIC:
47 raise ValueError("File is not in ECDC format.")
48 if version != 0:
49 raise ValueError("Version not supported.")
50 meta_bytes = _read_exactly(fo, meta_size)
51 return json.loads(meta_bytes.decode('utf-8'))
52
53
54class BitPacker:

Callers

nothing calls this directly

Calls 2

_read_exactlyFunction · 0.85
decodeMethod · 0.45

Tested by

no test coverage detected