Refactoring de pmoflac -factorisation de code ogg et opus
This commit is contained in:
@@ -26,7 +26,7 @@ pub fn init() -> Result<()> {
|
||||
/// PCM chunk with decoded audio data
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PCMChunk {
|
||||
pub samples: Vec<i16>, // Interleaved 16-bit samples
|
||||
pub samples: Vec<i16>, // Interleaved 16-bit samples
|
||||
pub sample_rate: u32,
|
||||
pub channels: u32,
|
||||
pub position_ms: u64,
|
||||
@@ -52,7 +52,7 @@ impl ProgressiveDecoder {
|
||||
let mut buffer = vec![0u8; 8192];
|
||||
loop {
|
||||
match stream.read(&mut buffer) {
|
||||
Ok(0) => break, // EOF
|
||||
Ok(0) => break, // EOF
|
||||
Ok(n) => {
|
||||
let chunk = Bytes::copy_from_slice(&buffer[..n]);
|
||||
if tx.send(Ok(chunk)).is_err() {
|
||||
|
||||
@@ -881,7 +881,7 @@ fn ms_to_frames(ms: u64, sample_rate: u32) -> usize {
|
||||
|
||||
fn decode_block_audio(data: Vec<u8>) -> anyhow::Result<DecodedBlock> {
|
||||
use symphonia::core::audio::SampleBuffer;
|
||||
use symphonia::core::codecs::{CODEC_TYPE_NULL, DecoderOptions};
|
||||
use symphonia::core::codecs::{DecoderOptions, CODEC_TYPE_NULL};
|
||||
use symphonia::core::errors::Error as SymphoniaError;
|
||||
use symphonia::core::formats::FormatOptions;
|
||||
use symphonia::core::io::MediaSourceStream;
|
||||
|
||||
Reference in New Issue
Block a user