#![forbid(unsafe_code)]
#![allow(
clippy::unused_async,
reason = "wasm_bindgen async exports must match wasm API"
)]
use wasm_bindgen::prelude::*;
use crate::web::chunks::EncodedVideoChunks;
use crate::web::config::{WebAudioOpenConfig, WebVideoOpenConfig};
#[cfg(all(feature = "audio", feature = "video"))]
#[wasm_bindgen]
pub async fn is_webcodecs_av_supported() -> bool {
false
}
#[cfg(all(feature = "audio", feature = "video"))]
#[wasm_bindgen]
pub async fn webcodecs_av_fmp4_smoke() -> Result<Vec<u8>, JsValue> {
Err(JsValue::from_str("wasm32 browser only"))
}
#[cfg(feature = "video")]
#[wasm_bindgen]
pub async fn is_webgpu_video_frame_supported() -> bool {
false
}
#[cfg(feature = "video")]
#[wasm_bindgen]
pub async fn webcodecs_gpu_video_fmp4_smoke() -> Result<Vec<u8>, JsValue> {
Err(JsValue::from_str("wasm32 browser only"))
}
#[cfg(feature = "video")]
#[wasm_bindgen]
pub async fn encode_video_frames(
_codec: String,
_width: u32,
_height: u32,
_bitrate_bps: u32,
_lumas: Vec<u8>,
_timestamps_us: Vec<f64>,
) -> Result<EncodedVideoChunks, JsValue> {
Err(JsValue::from_str("wasm32 browser only"))
}
#[cfg(feature = "video")]
#[wasm_bindgen]
pub fn video_config_label(_config: &WebVideoOpenConfig) -> String {
"h264".to_string()
}
#[cfg(feature = "audio")]
#[wasm_bindgen]
pub fn audio_config_label(_config: &WebAudioOpenConfig) -> String {
"aac".to_string()
}
#[wasm_bindgen]
pub fn fmp4_packet_count(bytes: &[u8]) -> u32 {
let mut demux = iso_bmff::Demuxer::new();
demux.push_bytes(bytes);
let mut n = 0u32;
while demux.poll_packet().is_some() {
n += 1;
}
n
}