diff options
author | metamuffin <metamuffin@disroot.org> | 2023-01-15 11:18:15 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-01-15 11:18:15 +0100 |
commit | ba6942c04945c2d9b9d4672a68c85d43ade0b5c8 (patch) | |
tree | ae5b03f86a66dde3ad3f9177b7ae057222572cbd | |
parent | 3c77de369e3a6043af63f8e903ef77e990132258 (diff) | |
download | jellything-ba6942c04945c2d9b9d4672a68c85d43ade0b5c8.tar jellything-ba6942c04945c2d9b9d4672a68c85d43ade0b5c8.tar.bz2 jellything-ba6942c04945c2d9b9d4672a68c85d43ade0b5c8.tar.zst |
fixed implicit tag closing
-rw-r--r-- | Cargo.lock | 85 | ||||
-rw-r--r-- | common/src/lib.rs | 21 | ||||
-rw-r--r-- | ebml/Cargo.toml | 2 | ||||
-rw-r--r-- | ebml/src/lib.rs | 1 | ||||
-rw-r--r-- | ebml/src/read.rs | 9 | ||||
-rw-r--r-- | tools/Cargo.toml | 6 |
6 files changed, 36 insertions, 88 deletions
@@ -350,45 +350,6 @@ dependencies = [ ] [[package]] -name = "ebml" -version = "0.1.0" -dependencies = [ - "anyhow", - "ebml_derive", - "env_logger", - "log", -] - -[[package]] -name = "ebml-iterable" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b31d12a9ba3afb88aeef98a2d2547d26d0668b5a53f1f0452fc950a05873c078" -dependencies = [ - "ebml-iterable-specification", - "ebml-iterable-specification-derive", - "futures", -] - -[[package]] -name = "ebml-iterable-specification" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a991c9097272fc3be18a90f467da4d8148e65a9f83f4c61eddc60a6924ce1fc4" - -[[package]] -name = "ebml-iterable-specification-derive" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bc71e6e4c22b398a106956e6b29839a6e9b5e9d0a902f98e90d2c59855316ed" -dependencies = [ - "ebml-iterable-specification", - "proc-macro2", - "quote", - "syn", -] - -[[package]] name = "ebml_derive" version = "0.1.0" dependencies = [ @@ -498,7 +459,6 @@ checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" dependencies = [ "futures-channel", "futures-core", - "futures-executor", "futures-io", "futures-sink", "futures-task", @@ -522,34 +482,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" [[package]] -name = "futures-executor" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] name = "futures-io" version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" [[package]] -name = "futures-macro" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] name = "futures-sink" version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -570,7 +508,6 @@ dependencies = [ "futures-channel", "futures-core", "futures-io", - "futures-macro", "futures-sink", "futures-task", "memchr", @@ -840,6 +777,16 @@ dependencies = [ ] [[package]] +name = "jellyebml" +version = "0.1.0" +dependencies = [ + "anyhow", + "ebml_derive", + "env_logger", + "log", +] + +[[package]] name = "jellyremuxer" version = "0.1.0" dependencies = [ @@ -875,10 +822,11 @@ version = "0.1.0" dependencies = [ "anyhow", "clap", + "env_logger", "jellycommon", + "jellyebml", "log", "serde_json", - "webm-iterable", ] [[package]] @@ -1998,15 +1946,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "webm-iterable" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7896d663d20a8ca015e3ace5dc58d38b2b9924cc34affa6c75be031f3bbf07" -dependencies = [ - "ebml-iterable", -] - -[[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/common/src/lib.rs b/common/src/lib.rs index 0e736b7..e329d2e 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -20,22 +20,25 @@ pub struct Source { } #[derive(Debug, Clone, Deserialize, Serialize)] +pub struct SourceTrack { + pub kind: SourceTrackKind, + pub name: String, + pub codec: String, + pub language: String, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] #[serde(rename_all = "snake_case", tag = "kind")] -pub enum SourceTrack { +pub enum SourceTrackKind { Video { - language: String, - codec: String, width: u64, height: u64, + fps: f64, }, Audio { channels: usize, - codec: String, sample_rate: f64, - language: String, - }, - Subtitles { - codec: String, - language: String, + bit_depth: usize, }, + Subtitles, } diff --git a/ebml/Cargo.toml b/ebml/Cargo.toml index ec58cc4..6dfc8f9 100644 --- a/ebml/Cargo.toml +++ b/ebml/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ebml" +name = "jellyebml" version = "0.1.0" edition = "2021" diff --git a/ebml/src/lib.rs b/ebml/src/lib.rs index 078995e..bcba8fd 100644 --- a/ebml/src/lib.rs +++ b/ebml/src/lib.rs @@ -2,6 +2,7 @@ pub mod matroska; pub mod read; pub mod size; pub mod write; +pub mod unflatten; use matroska::MatroskaTag; pub use read::ReadValue; diff --git a/ebml/src/read.rs b/ebml/src/read.rs index 133f2ae..1b4159d 100644 --- a/ebml/src/read.rs +++ b/ebml/src/read.rs @@ -74,7 +74,7 @@ impl EbmlReader { Ok(EbmlSize::from_vint(self.read_vint_len()?)) } pub fn read_stuff(&mut self) -> Result<()> { - if let Some(e) = self.stack.last().map(|e| *e) { + while let Some(e) = self.stack.last().map(|e| *e) { if let Some(end) = e.end { if self.position >= end { if self.position != end { @@ -83,7 +83,11 @@ impl EbmlReader { self.stack.pop(); self.queue .push_back(MatroskaTag::construct_master(e.id, Master::End)?); + } else { + break; } + } else { + break; } } @@ -101,8 +105,7 @@ impl EbmlReader { // we have slightly different rules for closing tags implicitly // this closes as many tags as needed to make the next tag a valid child while let Some(tag @ StackTag { end: None, .. }) = self.stack.last() { - let valid_child = path.last() == Some(&tag.id); - if valid_child { + if path.last() == Some(&tag.id) { break; } else { self.queue.push_back(MatroskaTag::construct_master( diff --git a/tools/Cargo.toml b/tools/Cargo.toml index ece3140..6a1bcfa 100644 --- a/tools/Cargo.toml +++ b/tools/Cargo.toml @@ -4,11 +4,13 @@ version = "0.1.0" edition = "2021" [dependencies] -clap = { version = "4.0.32", features = ["derive"] } jellycommon = { path = "../common" } +jellyebml = {path = "../ebml"} + +clap = { version = "4.0.32", features = ["derive"] } -webm-iterable = "0.4.2" log = "0.4.17" +env_logger = "0.10.0" anyhow = "1.0.68" serde_json = "1.0.91" |