#![cfg(target_os = "macos")]
pub mod sys;
#[cfg(feature = "registry")]
pub mod blob;
#[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 jpeg_caps = CodecCapabilities::video("mjpeg_videotoolbox")
.with_lossy(true)
.with_intra_only(true)
.with_hardware(true)
.with_priority(10);
ctx.codecs.register(
CodecInfo::new(CodecId::new("mjpeg"))
.capabilities(jpeg_caps.clone().with_decode())
.decoder(blob::make_jpeg_decoder)
.tags([
CodecTag::fourcc(b"jpeg"),
CodecTag::fourcc(b"JPEG"),
CodecTag::fourcc(b"MJPG"),
CodecTag::fourcc(b"mjpg"),
]),
);
ctx.codecs.register(
CodecInfo::new(CodecId::new("mjpeg"))
.capabilities(jpeg_caps.clone().with_encode())
.encoder(blob::make_jpeg_encoder),
);
let prores_caps = CodecCapabilities::video("prores_videotoolbox")
.with_lossy(true)
.with_intra_only(true)
.with_hardware(true)
.with_priority(10);
ctx.codecs.register(
CodecInfo::new(CodecId::new("prores"))
.capabilities(prores_caps.clone().with_decode())
.decoder(blob::make_prores_decoder)
.tags([
CodecTag::fourcc(b"apco"),
CodecTag::fourcc(b"apcs"),
CodecTag::fourcc(b"apcn"),
CodecTag::fourcc(b"apch"),
CodecTag::fourcc(b"ap4h"),
CodecTag::fourcc(b"ap4x"),
]),
);
ctx.codecs.register(
CodecInfo::new(CodecId::new("prores"))
.capabilities(prores_caps.clone().with_encode())
.encoder(blob::make_prores_encoder),
);
let mpeg2_caps = CodecCapabilities::video("mpeg2_videotoolbox")
.with_lossy(true)
.with_intra_only(false)
.with_hardware(true)
.with_priority(10);
ctx.codecs.register(
CodecInfo::new(CodecId::new("mpeg2video"))
.capabilities(mpeg2_caps.clone().with_decode())
.decoder(blob::make_mpeg2_decoder)
.tags([
CodecTag::fourcc(b"mp2v"),
CodecTag::fourcc(b"MPG2"),
CodecTag::fourcc(b"mpg2"),
CodecTag::fourcc(b"hdv2"),
CodecTag::fourcc(b"m2v1"),
CodecTag::matroska("V_MPEG2"),
]),
);
let vp9_caps = CodecCapabilities::video("vp9_videotoolbox")
.with_lossy(true)
.with_intra_only(false)
.with_hardware(true)
.with_priority(10);
ctx.codecs.register(
CodecInfo::new(CodecId::new("vp9"))
.capabilities(vp9_caps.clone().with_decode())
.decoder(blob::make_vp9_decoder)
.tags([
CodecTag::fourcc(b"vp09"),
CodecTag::fourcc(b"VP90"),
CodecTag::matroska("V_VP9"),
]),
);
let mpeg4_caps = CodecCapabilities::video("mpeg4_videotoolbox")
.with_lossy(true)
.with_intra_only(false)
.with_hardware(true)
.with_priority(10);
ctx.codecs.register(
CodecInfo::new(CodecId::new("mpeg4"))
.capabilities(mpeg4_caps.clone().with_decode())
.decoder(blob::make_mpeg4_part_two_decoder)
.tags([
CodecTag::fourcc(b"mp4v"),
CodecTag::fourcc(b"MP4V"),
CodecTag::fourcc(b"M4S2"),
CodecTag::fourcc(b"m4s2"),
CodecTag::fourcc(b"DIVX"),
CodecTag::fourcc(b"divx"),
CodecTag::fourcc(b"DX50"),
CodecTag::fourcc(b"XVID"),
CodecTag::fourcc(b"xvid"),
CodecTag::fourcc(b"FMP4"),
CodecTag::fourcc(b"fmp4"),
CodecTag::matroska("V_MPEG4/ISO/ASP"),
]),
);
let av1_caps = CodecCapabilities::video("av1_videotoolbox")
.with_lossy(true)
.with_intra_only(false)
.with_hardware(true)
.with_priority(10);
ctx.codecs.register(
CodecInfo::new(CodecId::new("av1"))
.capabilities(av1_caps.clone().with_decode())
.decoder(blob::make_av1_decoder)
.tags([
CodecTag::fourcc(b"av01"),
CodecTag::fourcc(b"AV01"),
CodecTag::matroska("V_AV1"),
]),
);
let _ = (
h264_caps,
hevc_caps,
jpeg_caps,
prores_caps,
mpeg2_caps,
vp9_caps,
mpeg4_caps,
av1_caps,
); }
#[cfg(feature = "registry")]
oxideav_core::register!("videotoolbox", register);