Skip to main content

media_codec/
codecs.rs

1//! Automatic codec registration
2#[allow(unused_imports)]
3use std::sync::Arc;
4
5use ctor::ctor;
6#[cfg(all(feature = "decoder", feature = "video", feature = "video-toolbox", any(target_os = "macos", target_os = "ios")))]
7use media_codec_video_toolbox::decoder::VTDecoderBuilder;
8
9#[cfg(feature = "decoder")]
10#[allow(unused_imports)]
11use crate::decoder::register_decoder;
12#[cfg(feature = "encoder")]
13#[allow(unused_imports)]
14use crate::encoder::register_encoder;
15
16/// Initializes the codec registry with built-in codecs
17#[ctor]
18pub fn initialize() {
19    // Register decoders
20    #[cfg(all(feature = "decoder", feature = "video", feature = "video-toolbox", any(target_os = "macos", target_os = "ios")))]
21    register_decoder(Arc::new(VTDecoderBuilder), false);
22}