From 41e41352fa239e4cbaf355b91a685fc99bef573f Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Mon, 5 Apr 2021 18:11:46 +0200 Subject: [PATCH] sndplay: use custom decoder crates configuration --- sndplay/Cargo.toml | 13 ++++++++++- sndplay/src/allreg.rs | 51 +++++++++++++++++++++++++++++++++++++++++++ sndplay/src/main.rs | 7 +++--- 3 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 sndplay/src/allreg.rs diff --git a/sndplay/Cargo.toml b/sndplay/Cargo.toml index 3412441..1661282 100644 --- a/sndplay/Cargo.toml +++ b/sndplay/Cargo.toml @@ -7,6 +7,17 @@ edition = "2018" [dependencies] nihav_core = { path="../../nihav-core" } nihav_registry = { path="../../nihav-registry" } -nihav_allstuff = { path="../../nihav-allstuff" } +nihav_commonfmt = { path="../../nihav-commonfmt", default-features=false, features = ["all_demuxers", "all_audio_decoders"] } +nihav_duck = { path = "../../nihav-duck", default-features=false, features = ["all_audio_decoders"] } +nihav_game = { path = "../../nihav-game", default-features=false, features = ["all_demuxers", "all_audio_decoders"] } +nihav_indeo = { path = "../../nihav-indeo", default-features=false, features = ["all_audio_decoders"] } +#nihav_itu = { path = "../../nihav-itu" } +nihav_llaudio = { path = "../../nihav-llaudio" } +nihav_ms = { path = "../../nihav-ms", default-features=false, features = ["all_audio_decoders"] } +nihav_qt = { path = "../../nihav-qt", default-features=false, features = ["all_audio_decoders"] } +nihav_rad = { path = "../../nihav-rad", default-features=false, features = ["all_demuxers", "all_audio_decoders"] } +nihav_realmedia = { path = "../../nihav-realmedia", default-features=false, features = ["all_demuxers", "all_audio_decoders"] } +nihav_vivo = { path = "../../nihav-vivo", default-features=false, features = ["all_demuxers", "all_audio_decoders"] } + libc = "^0.2" sdl2-sys = "^0.34" diff --git a/sndplay/src/allreg.rs b/sndplay/src/allreg.rs new file mode 100644 index 0000000..d0c6b39 --- /dev/null +++ b/sndplay/src/allreg.rs @@ -0,0 +1,51 @@ +use nihav_core::codecs::RegisteredDecoders; +use nihav_core::demuxers::RegisteredDemuxers; + +use nihav_commonfmt::generic_register_all_decoders; +use nihav_commonfmt::generic_register_all_demuxers; + +use nihav_duck::duck_register_all_decoders; + +use nihav_game::game_register_all_decoders; +use nihav_game::game_register_all_demuxers; + +use nihav_indeo::indeo_register_all_decoders; + +use nihav_llaudio::llaudio_register_all_decoders; +use nihav_llaudio::llaudio_register_all_demuxers; + +use nihav_ms::ms_register_all_decoders; + +use nihav_qt::qt_register_all_decoders; + +use nihav_rad::rad_register_all_decoders; +use nihav_rad::rad_register_all_demuxers; + +use nihav_realmedia::realmedia_register_all_decoders; +use nihav_realmedia::realmedia_register_all_demuxers; + +use nihav_vivo::vivo_register_all_decoders; +use nihav_vivo::vivo_register_all_demuxers; + +pub fn register_all_decoders(rd: &mut RegisteredDecoders) { + generic_register_all_decoders(rd); + duck_register_all_decoders(rd); + game_register_all_decoders(rd); + indeo_register_all_decoders(rd); + llaudio_register_all_decoders(rd); + ms_register_all_decoders(rd); + qt_register_all_decoders(rd); + rad_register_all_decoders(rd); + realmedia_register_all_decoders(rd); + vivo_register_all_decoders(rd); +} + +pub fn register_all_demuxers(rd: &mut RegisteredDemuxers) { + generic_register_all_demuxers(rd); + game_register_all_demuxers(rd); + llaudio_register_all_demuxers(rd); + rad_register_all_demuxers(rd); + realmedia_register_all_demuxers(rd); + vivo_register_all_demuxers(rd); +} + diff --git a/sndplay/src/main.rs b/sndplay/src/main.rs index e1b8472..bdd64dc 100644 --- a/sndplay/src/main.rs +++ b/sndplay/src/main.rs @@ -2,7 +2,6 @@ extern crate libc; extern crate sdl2_sys; extern crate nihav_core; extern crate nihav_registry; -extern crate nihav_allstuff; use std::fs::File; use std::io::prelude::*; @@ -17,8 +16,8 @@ use nihav_core::codecs::*; use nihav_core::demuxers::*; use nihav_core::soundcvt::*; use nihav_registry::detect; -use nihav_allstuff::*; +mod allreg; mod command; use command::*; @@ -214,9 +213,9 @@ fn format_time(ms: u64) -> String { impl Player { fn new() -> Self { let mut dmx_reg = RegisteredDemuxers::new(); - nihav_register_all_demuxers(&mut dmx_reg); + allreg::register_all_demuxers(&mut dmx_reg); let mut dec_reg = RegisteredDecoders::new(); - nihav_register_all_decoders(&mut dec_reg); + allreg::register_all_decoders(&mut dec_reg); unsafe { if sdl2_sys::SDL_Init(sdl2_sys::SDL_INIT_AUDIO) != 0 { -- 2.39.5