pub mod dvbsub;
pub mod pgs;
pub mod vobsub;
use oxideav_codec::CodecRegistry;
use oxideav_container::ContainerRegistry;
use oxideav_core::{CodecCapabilities, CodecId, MediaType};
pub const PGS_CODEC_ID: &str = "pgs";
pub const DVBSUB_CODEC_ID: &str = "dvbsub";
pub const VOBSUB_CODEC_ID: &str = "vobsub";
pub fn register_codecs(reg: &mut CodecRegistry) {
for (id, impl_name) in [
(PGS_CODEC_ID, "pgs_sw"),
(DVBSUB_CODEC_ID, "dvbsub_sw"),
(VOBSUB_CODEC_ID, "vobsub_sw"),
] {
let caps = CodecCapabilities {
decode: true,
encode: false,
media_type: MediaType::Subtitle,
intra_only: true,
lossy: false,
lossless: true,
hardware_accelerated: false,
implementation: impl_name.into(),
max_width: None,
max_height: None,
max_bitrate: None,
max_sample_rate: None,
max_channels: None,
priority: 100,
accepted_pixel_formats: Vec::new(),
};
let factory = match id {
PGS_CODEC_ID => pgs::make_decoder,
DVBSUB_CODEC_ID => dvbsub::make_decoder,
VOBSUB_CODEC_ID => vobsub::make_decoder,
_ => unreachable!(),
};
reg.register_decoder_impl(CodecId::new(id), caps, factory);
}
let pgs_enc_caps = CodecCapabilities {
decode: false,
encode: true,
media_type: MediaType::Subtitle,
intra_only: true,
lossy: true,
lossless: false,
hardware_accelerated: false,
implementation: "pgs_sw".into(),
max_width: None,
max_height: None,
max_bitrate: None,
max_sample_rate: None,
max_channels: None,
priority: 100,
accepted_pixel_formats: vec![oxideav_core::PixelFormat::Rgba],
};
reg.register_encoder_impl(CodecId::new(PGS_CODEC_ID), pgs_enc_caps, pgs::make_encoder);
}
pub fn register_containers(reg: &mut ContainerRegistry) {
pgs::register_container(reg);
vobsub::register_container(reg);
}
pub fn register(codecs: &mut CodecRegistry, containers: &mut ContainerRegistry) {
register_codecs(codecs);
register_containers(containers);
}