mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 22:01:13 +00:00
Add support for u8 as audio output format
This commit is contained in:
parent
e5d4ec7713
commit
6ece192eec
1 changed files with 23 additions and 12 deletions
|
@ -51,18 +51,29 @@ impl AudioPlaybackThread {
|
|||
_ => todo!(),
|
||||
};
|
||||
|
||||
let output_format = ffmpeg_next::util::format::sample::Sample::F32(
|
||||
ffmpeg_next::util::format::sample::Type::Packed,
|
||||
);
|
||||
|
||||
let mut ffmpeg_to_cpal_forwarder = FFmpegToCPalForwarder::new::<f32>(
|
||||
let mut ffmpeg_to_cpal_forwarder = match config.sample_format() {
|
||||
cpal::SampleFormat::U8 => FFmpegToCPalForwarder::new::<u8>(
|
||||
config,
|
||||
&device,
|
||||
packet_receiver,
|
||||
packet_decoder,
|
||||
output_format,
|
||||
ffmpeg_next::util::format::sample::Sample::U8(
|
||||
ffmpeg_next::util::format::sample::Type::Packed,
|
||||
),
|
||||
output_channel_layout,
|
||||
);
|
||||
),
|
||||
cpal::SampleFormat::F32 => FFmpegToCPalForwarder::new::<f32>(
|
||||
config,
|
||||
&device,
|
||||
packet_receiver,
|
||||
packet_decoder,
|
||||
ffmpeg_next::util::format::sample::Sample::F32(
|
||||
ffmpeg_next::util::format::sample::Type::Packed,
|
||||
),
|
||||
output_channel_layout,
|
||||
),
|
||||
format @ _ => todo!("unsupported cpal output format {:#?}", format),
|
||||
};
|
||||
|
||||
let packet_receiver_impl =
|
||||
async { ffmpeg_to_cpal_forwarder.stream().await }.fuse().shared();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue