#![cfg(target_arch = "wasm32")]
use mediadecode::{
channel::AudioChannelLayout,
frame::{AudioFrame, Dimensions, Plane, VideoFrame},
pixel_format::PixelFormat,
};
use crate::{
buffer::WebCodecsBuffer,
extras::{AudioFrameExtra, VideoFrameExtra},
sample_format::SampleFormat,
};
pub fn empty_video_frame() -> VideoFrame<PixelFormat, VideoFrameExtra, WebCodecsBuffer> {
let planes = [
Plane::new(WebCodecsBuffer::empty(), 0),
Plane::new(WebCodecsBuffer::empty(), 0),
Plane::new(WebCodecsBuffer::empty(), 0),
Plane::new(WebCodecsBuffer::empty(), 0),
];
VideoFrame::new(
Dimensions::new(0, 0),
PixelFormat::Unknown(0),
planes,
0,
VideoFrameExtra::new(false),
)
}
pub fn empty_audio_frame()
-> AudioFrame<SampleFormat, AudioChannelLayout, AudioFrameExtra, WebCodecsBuffer> {
let planes = [
Plane::new(WebCodecsBuffer::empty(), 0),
Plane::new(WebCodecsBuffer::empty(), 0),
Plane::new(WebCodecsBuffer::empty(), 0),
Plane::new(WebCodecsBuffer::empty(), 0),
Plane::new(WebCodecsBuffer::empty(), 0),
Plane::new(WebCodecsBuffer::empty(), 0),
Plane::new(WebCodecsBuffer::empty(), 0),
Plane::new(WebCodecsBuffer::empty(), 0),
];
AudioFrame::new(
0,
0,
0,
SampleFormat::S16,
AudioChannelLayout::new(0),
planes,
0,
AudioFrameExtra::new(false),
)
}