]> git.nihav.org Git - nihav.git/commitdiff
split remaining decoders and demuxer from core
authorKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 17 Jan 2019 14:14:02 +0000 (15:14 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 17 Jan 2019 15:17:26 +0000 (16:17 +0100)
16 files changed:
nihav-allstuff/Cargo.toml
nihav-allstuff/src/lib.rs
nihav-commonfmt/Cargo.toml [copied from nihav-core/Cargo.toml with 66% similarity]
nihav-commonfmt/src/codecs/aac.rs [moved from nihav-core/src/codecs/aac.rs with 99% similarity]
nihav-commonfmt/src/codecs/atrac3.rs [moved from nihav-core/src/codecs/atrac3.rs with 99% similarity]
nihav-commonfmt/src/codecs/clearvideo.rs [moved from nihav-core/src/codecs/clearvideo.rs with 99% similarity]
nihav-commonfmt/src/codecs/mod.rs [new file with mode: 0644]
nihav-commonfmt/src/codecs/pcm.rs [moved from nihav-core/src/codecs/pcm.rs with 94% similarity]
nihav-commonfmt/src/codecs/sipro.rs [moved from nihav-core/src/codecs/sipro.rs with 99% similarity]
nihav-commonfmt/src/codecs/ts102366.rs [moved from nihav-core/src/codecs/ts102366.rs with 99% similarity]
nihav-commonfmt/src/demuxers/avi.rs [moved from nihav-core/src/demuxers/avi.rs with 98% similarity]
nihav-commonfmt/src/demuxers/mod.rs [new file with mode: 0644]
nihav-commonfmt/src/lib.rs [new file with mode: 0644]
nihav-core/Cargo.toml
nihav-core/src/codecs/mod.rs
nihav-core/src/demuxers/mod.rs

index e366f4ed492037a5f0afc76d239fd55c217bb73c..5003f752ddec2f6608c326ab192905d275f316cf 100644 (file)
@@ -6,6 +6,7 @@ edition = "2018"
 
 [dependencies]
 nihav_core = { path = "../nihav-core" }
+nihav_commonfmt = { path = "../nihav-commonfmt" }
 nihav_game = { path = "../nihav-game" }
 nihav_indeo = { path = "../nihav-indeo" }
 nihav_realmedia = { path = "../nihav-realmedia" }
\ No newline at end of file
index cb1e7138ac4dc43abe448446017acdfed6b1fe67..667bcd0946730c5f70d8abb940098da646b1cdd6 100644 (file)
@@ -1,10 +1,14 @@
 extern crate nihav_core;
+extern crate nihav_commonfmt;
 extern crate nihav_game;
 extern crate nihav_indeo;
 extern crate nihav_realmedia;
 
-use nihav_core::codecs::{RegisteredDecoders, core_register_all_codecs};
-use nihav_core::demuxers::{RegisteredDemuxers, core_register_all_demuxers};
+use nihav_core::codecs::RegisteredDecoders;
+use nihav_core::demuxers::RegisteredDemuxers;
+
+use nihav_commonfmt::codecs::generic_register_all_codecs;
+use nihav_commonfmt::demuxers::generic_register_all_demuxers;
 
 use nihav_game::codecs::game_register_all_codecs;
 use nihav_game::demuxers::game_register_all_demuxers;
@@ -15,14 +19,14 @@ use nihav_realmedia::codecs::realmedia_register_all_codecs;
 use nihav_realmedia::demuxers::realmedia_register_all_demuxers;
 
 pub fn nihav_register_all_codecs(rd: &mut RegisteredDecoders) {
-    core_register_all_codecs(rd);
+    generic_register_all_codecs(rd);
     game_register_all_codecs(rd);
     indeo_register_all_codecs(rd);
     realmedia_register_all_codecs(rd);
 }
 
 pub fn nihav_register_all_demuxers(rd: &mut RegisteredDemuxers) {
-    core_register_all_demuxers(rd);
+    generic_register_all_demuxers(rd);
     game_register_all_demuxers(rd);
     realmedia_register_all_demuxers(rd);
 }
similarity index 66%
copy from nihav-core/Cargo.toml
copy to nihav-commonfmt/Cargo.toml
index 35657bc4ad196143b3d9b06744ade50facf953ac..1ab9d0ca57780779de76b4c12ac36076399fcca1 100644 (file)
@@ -1,23 +1,23 @@
 [package]
-name = "nihav_core"
+name = "nihav_commonfmt"
 version = "0.1.0"
 authors = ["Kostya Shishkov <kostya.shishkov@gmail.com>"]
 edition = "2018"
 
+[dependencies.nihav_core]
+path = "../nihav-core"
+features = ["h263", "mdct", "fft", "dsp_window"]
+
+[dev-dependencies]
+nihav_realmedia = { path = "../nihav-realmedia" }
+
 [features]
 default = ["all_decoders", "all_demuxers"]
+decoders = []
 demuxers = []
 all_demuxers = ["demuxer_avi"]
 demuxer_avi = ["demuxers"]
 
-decoders = []
-h263 = []
-
-dsp = []
-fft = ["dsp"]
-mdct = ["fft", "dsp"]
-dsp_window = ["dsp"]
-
 all_decoders = ["all_video_decoders", "all_audio_decoders"]
 
 all_video_decoders = ["decoder_clearvideo"]
@@ -25,7 +25,7 @@ decoder_clearvideo = ["decoders"]
 
 all_audio_decoders = ["decoder_pcm", "decoder_ts102366", "decoder_sipro", "decoder_atrac3", "decoder_aac"]
 decoder_pcm = ["decoders"]
-decoder_ts102366 = ["decoders", "fft"]
+decoder_ts102366 = ["decoders"]
 decoder_sipro = ["decoders"]
-decoder_atrac3 = ["decoders", "mdct"]
-decoder_aac = ["decoders", "mdct", "dsp_window"]
+decoder_atrac3 = ["decoders"]
+decoder_aac = ["decoders"]
similarity index 99%
rename from nihav-core/src/codecs/aac.rs
rename to nihav-commonfmt/src/codecs/aac.rs
index 23d66898fd46c286c42c56f61e792aa2fd77bd8a..b81bdeefda194e39f50836a126e77ac81be71aca 100644 (file)
@@ -1,13 +1,15 @@
-use crate::formats::*;
-use crate::frame::*;
-use crate::codecs::*;
-use crate::dsp::fft::FFTMode;
-use crate::dsp::mdct::IMDCT;
-use crate::dsp::window::*;
-use crate::io::bitreader::*;
-use crate::io::codebook::*;
+use std::rc::Rc;
+use std::cell::RefCell;
+use nihav_core::formats::*;
+use nihav_core::frame::*;
+use nihav_core::codecs::*;
+use nihav_core::dsp::fft::FFTMode;
+use nihav_core::dsp::mdct::IMDCT;
+use nihav_core::dsp::window::*;
+use nihav_core::io::bitreader::*;
+use nihav_core::io::codebook::*;
 use std::fmt;
-use crate::io::intcode::*;
+use nihav_core::io::intcode::*;
 use std::mem;
 use std::ptr;
 use std::str::FromStr;
similarity index 99%
rename from nihav-core/src/codecs/atrac3.rs
rename to nihav-commonfmt/src/codecs/atrac3.rs
index 5281892a28cae9457e26edc60b44dfa729d0c645..59e690bf3002ef7df26383b000dde3eaff4ef237 100644 (file)
@@ -1,11 +1,13 @@
-use crate::formats::*;
-use crate::frame::*;
-use super::*;
-use crate::io::bitreader::*;
-use crate::io::byteio::*;
-use crate::io::codebook::*;
-use crate::dsp::fft::FFTMode;
-use crate::dsp::mdct::IMDCT;
+use std::rc::Rc;
+use std::cell::RefCell;
+use nihav_core::formats::*;
+use nihav_core::frame::*;
+use nihav_core::codecs::*;
+use nihav_core::io::bitreader::*;
+use nihav_core::io::byteio::*;
+use nihav_core::io::codebook::*;
+use nihav_core::dsp::fft::FFTMode;
+use nihav_core::dsp::mdct::IMDCT;
 use std::f32::consts;
 
 #[derive(Clone,Copy,PartialEq)]
similarity index 99%
rename from nihav-core/src/codecs/clearvideo.rs
rename to nihav-commonfmt/src/codecs/clearvideo.rs
index 8a27006d0378fbd4402d50147ac9fa78e55f4167..85431784dee3ef3ad039c7541346538497367e36 100644 (file)
@@ -1,8 +1,11 @@
-use crate::io::byteio::{ByteReader,MemoryReader};
-use crate::io::bitreader::*;
-use crate::io::codebook::*;
-use crate::formats;
-use super::*;
+use std::rc::Rc;
+use std::cell::RefCell;
+use nihav_core::io::byteio::{ByteReader,MemoryReader};
+use nihav_core::io::bitreader::*;
+use nihav_core::io::codebook::*;
+use nihav_core::formats;
+use nihav_core::codecs::*;
+use nihav_core::frame::*;
 use std::fmt;
 use std::ops::{Add, Sub};
 
diff --git a/nihav-commonfmt/src/codecs/mod.rs b/nihav-commonfmt/src/codecs/mod.rs
new file mode 100644 (file)
index 0000000..886b807
--- /dev/null
@@ -0,0 +1,43 @@
+use nihav_core::codecs::*;
+
+macro_rules! validate {
+    ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
+}
+
+#[cfg(feature="decoder_clearvideo")]
+mod clearvideo;
+
+#[cfg(feature="decoder_aac")]
+mod aac;
+#[cfg(feature="decoder_atrac3")]
+mod atrac3;
+#[cfg(feature="decoder_pcm")]
+mod pcm;
+#[cfg(feature="decoder_sipro")]
+mod sipro;
+#[cfg(feature="decoder_ts102366")]
+mod ts102366;
+
+const DECODERS: &[DecoderInfo] = &[
+#[cfg(feature="decoder_clearvideo")]
+    DecoderInfo { name: "clearvideo", get_decoder: clearvideo::get_decoder },
+#[cfg(feature="decoder_clearvideo")]
+    DecoderInfo { name: "clearvideo_rm", get_decoder: clearvideo::get_decoder_rm },
+
+#[cfg(feature="decoder_pcm")]
+    DecoderInfo { name: "pcm", get_decoder: pcm::get_decoder },
+#[cfg(feature="decoder_sipro")]
+    DecoderInfo { name: "sipro", get_decoder: sipro::get_decoder },
+#[cfg(feature="decoder_ts102366")]
+    DecoderInfo { name: "ac3", get_decoder: ts102366::get_decoder },
+#[cfg(feature="decoder_atrac3")]
+    DecoderInfo { name: "atrac3", get_decoder: atrac3::get_decoder },
+#[cfg(feature="decoder_aac")]
+    DecoderInfo { name: "aac", get_decoder: aac::get_decoder },
+];
+
+pub fn generic_register_all_codecs(rd: &mut RegisteredDecoders) {
+    for decoder in DECODERS.into_iter() {
+        rd.add_decoder(decoder.clone());
+    }
+}
similarity index 94%
rename from nihav-core/src/codecs/pcm.rs
rename to nihav-commonfmt/src/codecs/pcm.rs
index 2a0e510e5b23b764d4b79dec83f50a381bdacf2b..7a7105126ec8a2841ef0a1049768b0b4ea57f783 100644 (file)
@@ -1,5 +1,8 @@
-use crate::formats::*;
-use super::*;
+use std::rc::Rc;
+use std::cell::RefCell;
+use nihav_core::formats::*;
+use nihav_core::codecs::*;
+use nihav_core::frame::*;
 
 struct PCMDecoder { chmap: NAChannelMap }
 
similarity index 99%
rename from nihav-core/src/codecs/sipro.rs
rename to nihav-commonfmt/src/codecs/sipro.rs
index 882d90c59ee5f1839463cba9fb64dfd0c2a39fe0..4f6a86618b604a8ba7078a359ef09ac8752ad451 100644 (file)
@@ -1,7 +1,9 @@
-use crate::formats::*;
-use crate::frame::*;
-use super::*;
-use crate::io::bitreader::*;
+use std::rc::Rc;
+use std::cell::RefCell;
+use nihav_core::formats::*;
+use nihav_core::frame::*;
+use nihav_core::codecs::*;
+use nihav_core::io::bitreader::*;
 
 use std::f32::consts::PI;
 
similarity index 99%
rename from nihav-core/src/codecs/ts102366.rs
rename to nihav-commonfmt/src/codecs/ts102366.rs
index fb452c58ccc87969dd0db5a9448f8dd77ea012f1..9c2a0940b9b915ed78c4d3aafbeec701a0a23b53 100644 (file)
@@ -1,8 +1,10 @@
-use crate::formats::*;
-use crate::frame::*;
-use super::*;
-use crate::io::bitreader::*;
-use crate::dsp::fft::*;
+use std::rc::Rc;
+use std::cell::RefCell;
+use nihav_core::formats::*;
+use nihav_core::frame::*;
+use nihav_core::codecs::*;
+use nihav_core::io::bitreader::*;
+use nihav_core::dsp::fft::*;
 use std::str::FromStr;
 use std::f32::consts;
 
similarity index 98%
rename from nihav-core/src/demuxers/avi.rs
rename to nihav-commonfmt/src/demuxers/avi.rs
index a326561af4c57cdebf2e031ca98a8f501346bd8f..d690dd63172733c8da67e31073a6bbb42f4c5539 100644 (file)
@@ -1,9 +1,9 @@
-use super::*;
-use crate::register;
-use super::DemuxerError::*;
-//use io::byteio::*;
-//use frame::*;
-use crate::formats::*;
+use nihav_core::demuxers::*;
+use nihav_core::register;
+use nihav_core::demuxers::DemuxerError::*;
+use nihav_core::io::byteio::*;
+use nihav_core::frame::*;
+use nihav_core::formats::*;
 
 macro_rules! mktag {
     ($a:expr, $b:expr, $c:expr, $d:expr) => ({
diff --git a/nihav-commonfmt/src/demuxers/mod.rs b/nihav-commonfmt/src/demuxers/mod.rs
new file mode 100644 (file)
index 0000000..fa388e3
--- /dev/null
@@ -0,0 +1,20 @@
+use nihav_core::demuxers::*;
+
+
+macro_rules! validate {
+    ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DemuxerError::InvalidData); } };
+}
+
+#[cfg(feature="demuxer_avi")]
+mod avi;
+
+const DEMUXERS: &[&'static DemuxerCreator] = &[
+#[cfg(feature="demuxer_avi")]
+    &avi::AVIDemuxerCreator {},
+];
+
+pub fn generic_register_all_demuxers(rd: &mut RegisteredDemuxers) {
+    for demuxer in DEMUXERS.into_iter() {
+        rd.add_demuxer(*demuxer);
+    }
+}
diff --git a/nihav-commonfmt/src/lib.rs b/nihav-commonfmt/src/lib.rs
new file mode 100644 (file)
index 0000000..01db994
--- /dev/null
@@ -0,0 +1,10 @@
+extern crate nihav_core;
+
+#[cfg(feature="decoders")]
+pub mod codecs;
+
+#[cfg(feature="demuxers")]
+pub mod demuxers;
+
+#[cfg(test)]
+extern crate nihav_realmedia;
dissimilarity index 68%
index 35657bc4ad196143b3d9b06744ade50facf953ac..e46349df9d41e5cc489085a900bfa4899d0bf372 100644 (file)
@@ -1,31 +1,18 @@
-[package]
-name = "nihav_core"
-version = "0.1.0"
-authors = ["Kostya Shishkov <kostya.shishkov@gmail.com>"]
-edition = "2018"
-
-[features]
-default = ["all_decoders", "all_demuxers"]
-demuxers = []
-all_demuxers = ["demuxer_avi"]
-demuxer_avi = ["demuxers"]
-
-decoders = []
-h263 = []
-
-dsp = []
-fft = ["dsp"]
-mdct = ["fft", "dsp"]
-dsp_window = ["dsp"]
-
-all_decoders = ["all_video_decoders", "all_audio_decoders"]
-
-all_video_decoders = ["decoder_clearvideo"]
-decoder_clearvideo = ["decoders"]
-
-all_audio_decoders = ["decoder_pcm", "decoder_ts102366", "decoder_sipro", "decoder_atrac3", "decoder_aac"]
-decoder_pcm = ["decoders"]
-decoder_ts102366 = ["decoders", "fft"]
-decoder_sipro = ["decoders"]
-decoder_atrac3 = ["decoders", "mdct"]
-decoder_aac = ["decoders", "mdct", "dsp_window"]
+[package]
+name = "nihav_core"
+version = "0.1.0"
+authors = ["Kostya Shishkov <kostya.shishkov@gmail.com>"]
+edition = "2018"
+
+[features]
+default = ["decoders", "demuxers"]
+
+decoders = []
+demuxers = []
+
+h263 = []
+
+dsp = []
+fft = ["dsp"]
+mdct = ["fft", "dsp"]
+dsp_window = ["dsp"]
index f3fabf3a642dad3c249c7c08a9f9fe16ed652aff..76c683d0a9adae6cb7d0fd97fe9a2e37b7e42961 100644 (file)
@@ -238,48 +238,9 @@ pub struct DecoderInfo {
 #[cfg(any(feature="h263"))]
 pub mod blockdsp;
 
-#[cfg(feature="decoder_clearvideo")]
-mod clearvideo;
-#[cfg(feature="decoder_gdvvid")]
-mod gremlinvideo;
 #[cfg(feature="h263")]
 pub mod h263;
 
-#[cfg(feature="decoder_aac")]
-mod aac;
-#[cfg(feature="decoder_atrac3")]
-mod atrac3;
-#[cfg(feature="decoder_pcm")]
-mod pcm;
-#[cfg(feature="decoder_sipro")]
-mod sipro;
-#[cfg(feature="decoder_ts102366")]
-mod ts102366;
-
-const DECODERS: &[DecoderInfo] = &[
-#[cfg(feature="decoder_clearvideo")]
-    DecoderInfo { name: "clearvideo", get_decoder: clearvideo::get_decoder },
-#[cfg(feature="decoder_clearvideo")]
-    DecoderInfo { name: "clearvideo_rm", get_decoder: clearvideo::get_decoder_rm },
-
-#[cfg(feature="decoder_pcm")]
-    DecoderInfo { name: "pcm", get_decoder: pcm::get_decoder },
-#[cfg(feature="decoder_sipro")]
-    DecoderInfo { name: "sipro", get_decoder: sipro::get_decoder },
-#[cfg(feature="decoder_ts102366")]
-    DecoderInfo { name: "ac3", get_decoder: ts102366::get_decoder },
-#[cfg(feature="decoder_atrac3")]
-    DecoderInfo { name: "atrac3", get_decoder: atrac3::get_decoder },
-#[cfg(feature="decoder_aac")]
-    DecoderInfo { name: "aac", get_decoder: aac::get_decoder },
-];
-
-pub fn core_register_all_codecs(rd: &mut RegisteredDecoders) {
-    for decoder in DECODERS.into_iter() {
-        rd.add_decoder(decoder.clone());
-    }
-}
-
 pub struct RegisteredDecoders {
     decs:   Vec<DecoderInfo>,
 }
index 56e670db986575f50bf2e0e52f85955e2833844b..bfd492ae966c763b16df55a37db28d857040b016 100644 (file)
@@ -204,15 +204,6 @@ macro_rules! validate {
     ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DemuxerError::InvalidData); } };
 }
 
-#[cfg(feature="demuxer_avi")]
-mod avi;
-
-
-const DEMUXERS: &[&'static DemuxerCreator] = &[
-#[cfg(feature="demuxer_avi")]
-    &avi::AVIDemuxerCreator {},
-];
-
 pub fn create_demuxer<'a>(dmxcr: &DemuxerCreator, br: &'a mut ByteReader<'a>) -> DemuxerResult<Demuxer<'a>> {
     let mut dmx = dmxcr.new_demuxer(br);
     let mut str = StreamManager::new();
@@ -239,10 +230,4 @@ impl RegisteredDemuxers {
         }
         None
     }
-}
-
-pub fn core_register_all_demuxers(rd: &mut RegisteredDemuxers) {
-    for demuxer in DEMUXERS.into_iter() {
-        rd.add_demuxer(*demuxer);
-    }
-}
+}
\ No newline at end of file