Rework Python binding

This commit is contained in:
Josh Wu
2024-12-11 17:50:20 +08:00
committed by Antoine SOULIER
parent bb85f7dde4
commit 9c59375ae0
5 changed files with 363 additions and 191 deletions

View File

@@ -53,7 +53,7 @@ if header[0] != 0xcc1c:
samplerate = header[2] * 100
nchannels = header[4]
frame_duration = header[5] / 100
frame_duration = header[5] * 10
stream_length = header[7]
# --- Setup output ---
@@ -80,7 +80,7 @@ encoded_length = stream_length + dec.get_delay_samples()
for i in range(0, encoded_length, frame_length):
lc3_frame_size = struct.unpack('=H', f_lc3.read(2))[0]
pcm = dec.decode(f_lc3.read(lc3_frame_size), bitdepth=bitdepth)
pcm = dec.decode(f_lc3.read(lc3_frame_size), bit_depth=bitdepth)
pcm = pcm[max(encoded_length - stream_length - i, 0) * pcm_size:
min(encoded_length - i, frame_length) * pcm_size]