#![cfg(target_os = "macos")]
pub mod sys;
#[cfg(feature = "registry")]
pub mod decoder;
#[cfg(feature = "registry")]
pub mod encoder;
#[cfg(feature = "registry")]
pub fn register(ctx: &mut oxideav_core::RuntimeContext) {
use oxideav_core::{CodecCapabilities, CodecId, CodecInfo, CodecTag};
match sys::vtable() {
Ok(_) => {}
Err(e) => {
eprintln!("oxideav-videotoolbox: framework unavailable, skipping registration: {e}");
return;
}
}
let h264_caps = CodecCapabilities::video("h264_videotoolbox")
.with_lossy(true)
.with_intra_only(false)
.with_hardware(true)
.with_priority(10);
ctx.codecs.register(
CodecInfo::new(CodecId::new("h264"))
.capabilities(h264_caps.clone().with_decode())
.decoder(decoder::H264VtDecoder::make)
.tags([
CodecTag::fourcc(b"H264"),
CodecTag::fourcc(b"h264"),
CodecTag::fourcc(b"AVC1"),
CodecTag::fourcc(b"avc1"),
CodecTag::fourcc(b"X264"),
CodecTag::matroska("V_MPEG4/ISO/AVC"),
]),
);
ctx.codecs.register(
CodecInfo::new(CodecId::new("h264"))
.capabilities(
CodecCapabilities::video("h264_videotoolbox")
.with_lossy(true)
.with_intra_only(false)
.with_hardware(true)
.with_priority(10)
.with_encode(),
)
.encoder(encoder::make_h264_encoder),
);
let hevc_caps = CodecCapabilities::video("hevc_videotoolbox")
.with_lossy(true)
.with_intra_only(false)
.with_hardware(true)
.with_priority(10);
ctx.codecs.register(
CodecInfo::new(CodecId::new("hevc"))
.capabilities(hevc_caps.clone().with_decode())
.decoder(decoder::HevcVtDecoder::make)
.tags([
CodecTag::fourcc(b"hvc1"),
CodecTag::fourcc(b"hev1"),
CodecTag::matroska("V_MPEGH/ISO/HEVC"),
]),
);
ctx.codecs.register(
CodecInfo::new(CodecId::new("hevc"))
.capabilities(
CodecCapabilities::video("hevc_videotoolbox")
.with_lossy(true)
.with_intra_only(false)
.with_hardware(true)
.with_priority(10)
.with_encode(),
)
.encoder(encoder::make_hevc_encoder),
);
let _ = (h264_caps, hevc_caps); }
#[cfg(feature = "registry")]
oxideav_core::register!("videotoolbox", register);