diff --git a/.gitignore b/.gitignore
index 17b9afe..0725822 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,10 @@
# already existing elements were commented out
#/target
+
+
+# Added by cargo
+#
+# already existing elements were commented out
+
+#/target
diff --git a/Cargo.lock b/Cargo.lock
index 5a322e8..bd10e49 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,6 +2,51 @@
# It is not intended for manual editing.
version = 3
+[[package]]
+name = "android-tzdata"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
+
+[[package]]
+name = "android_system_properties"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "anyhow"
+version = "1.0.75"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
+
+[[package]]
+name = "atomic_refcell"
+version = "0.1.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41e67cd8309bbd06cd603a9e693a784ac2e5d1e955f11286e355089fcab3047c"
+
+[[package]]
+name = "autocfg"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+
+[[package]]
+name = "bitflags"
+version = "2.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
+
+[[package]]
+name = "bumpalo"
+version = "3.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
+
[[package]]
name = "cc"
version = "1.0.83"
@@ -11,6 +56,430 @@ dependencies = [
"libc",
]
+[[package]]
+name = "cfg-expr"
+version = "0.15.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3"
+dependencies = [
+ "smallvec",
+ "target-lexicon",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "chrono"
+version = "0.4.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
+dependencies = [
+ "android-tzdata",
+ "iana-time-zone",
+ "num-traits",
+ "windows-targets 0.48.5",
+]
+
+[[package]]
+name = "core-foundation-sys"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
+
+[[package]]
+name = "either"
+version = "1.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
+
+[[package]]
+name = "equivalent"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
+
+[[package]]
+name = "futures-channel"
+version = "0.3.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb"
+dependencies = [
+ "futures-core",
+]
+
+[[package]]
+name = "futures-core"
+version = "0.3.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c"
+
+[[package]]
+name = "futures-executor"
+version = "0.3.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "futures-util",
+]
+
+[[package]]
+name = "futures-macro"
+version = "0.3.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.39",
+]
+
+[[package]]
+name = "futures-task"
+version = "0.3.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2"
+
+[[package]]
+name = "futures-util"
+version = "0.3.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104"
+dependencies = [
+ "futures-core",
+ "futures-macro",
+ "futures-task",
+ "pin-project-lite",
+ "pin-utils",
+ "slab",
+]
+
+[[package]]
+name = "gio-sys"
+version = "0.19.0"
+source = "git+https://github.com/gtk-rs/gtk-rs-core#a0d52347c99a5e1e7186f18e0db9f9e67eae1bb8"
+dependencies = [
+ "glib-sys",
+ "gobject-sys",
+ "libc",
+ "system-deps",
+ "windows-sys",
+]
+
+[[package]]
+name = "glib"
+version = "0.19.0"
+source = "git+https://github.com/gtk-rs/gtk-rs-core#a0d52347c99a5e1e7186f18e0db9f9e67eae1bb8"
+dependencies = [
+ "bitflags",
+ "futures-channel",
+ "futures-core",
+ "futures-executor",
+ "futures-task",
+ "futures-util",
+ "gio-sys",
+ "glib-macros",
+ "glib-sys",
+ "gobject-sys",
+ "libc",
+ "memchr",
+ "once_cell",
+ "smallvec",
+ "thiserror",
+]
+
+[[package]]
+name = "glib-macros"
+version = "0.19.0"
+source = "git+https://github.com/gtk-rs/gtk-rs-core#a0d52347c99a5e1e7186f18e0db9f9e67eae1bb8"
+dependencies = [
+ "heck",
+ "proc-macro-crate",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.39",
+]
+
+[[package]]
+name = "glib-sys"
+version = "0.19.0"
+source = "git+https://github.com/gtk-rs/gtk-rs-core#a0d52347c99a5e1e7186f18e0db9f9e67eae1bb8"
+dependencies = [
+ "libc",
+ "system-deps",
+]
+
+[[package]]
+name = "gobject-sys"
+version = "0.19.0"
+source = "git+https://github.com/gtk-rs/gtk-rs-core#a0d52347c99a5e1e7186f18e0db9f9e67eae1bb8"
+dependencies = [
+ "glib-sys",
+ "libc",
+ "system-deps",
+]
+
+[[package]]
+name = "gst-plugin-fmp4"
+version = "0.12.0-alpha.1"
+source = "git+https://github.com/sdroege/gst-plugin-rs#c7f961cc2216f24e282ed81dbed9be7d29d5ecd0"
+dependencies = [
+ "anyhow",
+ "gst-plugin-version-helper",
+ "gstreamer",
+ "gstreamer-audio",
+ "gstreamer-base",
+ "gstreamer-pbutils",
+ "gstreamer-video",
+]
+
+[[package]]
+name = "gst-plugin-version-helper"
+version = "0.8.0"
+source = "git+https://github.com/sdroege/gst-plugin-rs#c7f961cc2216f24e282ed81dbed9be7d29d5ecd0"
+dependencies = [
+ "chrono",
+ "toml_edit 0.21.0",
+]
+
+[[package]]
+name = "gstreamer"
+version = "0.22.0"
+source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#7f234c88acec5f5233342fa01e0c7ffde51bd049"
+dependencies = [
+ "cfg-if",
+ "futures-channel",
+ "futures-core",
+ "futures-util",
+ "glib",
+ "gstreamer-sys",
+ "itertools",
+ "libc",
+ "muldiv",
+ "num-integer",
+ "num-rational",
+ "option-operations",
+ "paste",
+ "pin-project-lite",
+ "pretty-hex",
+ "smallvec",
+ "thiserror",
+]
+
+[[package]]
+name = "gstreamer-audio"
+version = "0.22.0"
+source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#7f234c88acec5f5233342fa01e0c7ffde51bd049"
+dependencies = [
+ "cfg-if",
+ "glib",
+ "gstreamer",
+ "gstreamer-audio-sys",
+ "gstreamer-base",
+ "libc",
+]
+
+[[package]]
+name = "gstreamer-audio-sys"
+version = "0.22.0"
+source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#7f234c88acec5f5233342fa01e0c7ffde51bd049"
+dependencies = [
+ "glib-sys",
+ "gobject-sys",
+ "gstreamer-base-sys",
+ "gstreamer-sys",
+ "libc",
+ "system-deps",
+]
+
+[[package]]
+name = "gstreamer-base"
+version = "0.22.0"
+source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#7f234c88acec5f5233342fa01e0c7ffde51bd049"
+dependencies = [
+ "atomic_refcell",
+ "cfg-if",
+ "glib",
+ "gstreamer",
+ "gstreamer-base-sys",
+ "libc",
+]
+
+[[package]]
+name = "gstreamer-base-sys"
+version = "0.22.0"
+source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#7f234c88acec5f5233342fa01e0c7ffde51bd049"
+dependencies = [
+ "glib-sys",
+ "gobject-sys",
+ "gstreamer-sys",
+ "libc",
+ "system-deps",
+]
+
+[[package]]
+name = "gstreamer-gl"
+version = "0.22.0"
+source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#7f234c88acec5f5233342fa01e0c7ffde51bd049"
+dependencies = [
+ "glib",
+ "gstreamer",
+ "gstreamer-base",
+ "gstreamer-gl-sys",
+ "gstreamer-video",
+ "libc",
+]
+
+[[package]]
+name = "gstreamer-gl-sys"
+version = "0.22.0"
+source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#7f234c88acec5f5233342fa01e0c7ffde51bd049"
+dependencies = [
+ "glib-sys",
+ "gobject-sys",
+ "gstreamer-base-sys",
+ "gstreamer-sys",
+ "gstreamer-video-sys",
+ "libc",
+ "system-deps",
+]
+
+[[package]]
+name = "gstreamer-pbutils"
+version = "0.22.0"
+source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#7f234c88acec5f5233342fa01e0c7ffde51bd049"
+dependencies = [
+ "glib",
+ "gstreamer",
+ "gstreamer-audio",
+ "gstreamer-pbutils-sys",
+ "gstreamer-video",
+ "libc",
+ "thiserror",
+]
+
+[[package]]
+name = "gstreamer-pbutils-sys"
+version = "0.22.0"
+source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#7f234c88acec5f5233342fa01e0c7ffde51bd049"
+dependencies = [
+ "glib-sys",
+ "gobject-sys",
+ "gstreamer-audio-sys",
+ "gstreamer-sys",
+ "gstreamer-video-sys",
+ "libc",
+ "system-deps",
+]
+
+[[package]]
+name = "gstreamer-sys"
+version = "0.22.0"
+source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#7f234c88acec5f5233342fa01e0c7ffde51bd049"
+dependencies = [
+ "glib-sys",
+ "gobject-sys",
+ "libc",
+ "system-deps",
+]
+
+[[package]]
+name = "gstreamer-video"
+version = "0.22.0"
+source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#7f234c88acec5f5233342fa01e0c7ffde51bd049"
+dependencies = [
+ "cfg-if",
+ "futures-channel",
+ "glib",
+ "gstreamer",
+ "gstreamer-base",
+ "gstreamer-video-sys",
+ "libc",
+ "thiserror",
+]
+
+[[package]]
+name = "gstreamer-video-sys"
+version = "0.22.0"
+source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#7f234c88acec5f5233342fa01e0c7ffde51bd049"
+dependencies = [
+ "glib-sys",
+ "gobject-sys",
+ "gstreamer-base-sys",
+ "gstreamer-sys",
+ "libc",
+ "system-deps",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.14.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
+
+[[package]]
+name = "heck"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
+
+[[package]]
+name = "iana-time-zone"
+version = "0.1.58"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20"
+dependencies = [
+ "android_system_properties",
+ "core-foundation-sys",
+ "iana-time-zone-haiku",
+ "js-sys",
+ "wasm-bindgen",
+ "windows-core",
+]
+
+[[package]]
+name = "iana-time-zone-haiku"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "indexmap"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
+dependencies = [
+ "equivalent",
+ "hashbrown",
+]
+
+[[package]]
+name = "itertools"
+version = "0.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0"
+dependencies = [
+ "either",
+]
+
+[[package]]
+name = "js-sys"
+version = "0.3.66"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca"
+dependencies = [
+ "wasm-bindgen",
+]
+
[[package]]
name = "libc"
version = "0.2.150"
@@ -18,17 +487,98 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
[[package]]
-name = "openssl-sys"
-version = "0.9.96"
+name = "log"
+version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f"
+checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
+
+[[package]]
+name = "me"
+version = "0.1.0"
dependencies = [
- "cc",
- "libc",
- "pkg-config",
- "vcpkg",
+ "anyhow",
+ "gst-plugin-fmp4",
+ "gstreamer",
+ "gstreamer-base",
+ "gstreamer-gl",
+ "gstreamer-video",
]
+[[package]]
+name = "memchr"
+version = "2.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
+
+[[package]]
+name = "muldiv"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "956787520e75e9bd233246045d19f42fb73242759cc57fba9611d940ae96d4b0"
+
+[[package]]
+name = "num-integer"
+version = "0.1.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
+dependencies = [
+ "autocfg",
+ "num-traits",
+]
+
+[[package]]
+name = "num-rational"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
+dependencies = [
+ "autocfg",
+ "num-integer",
+ "num-traits",
+]
+
+[[package]]
+name = "num-traits"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
+
+[[package]]
+name = "option-operations"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c26d27bb1aeab65138e4bf7666045169d1717febcc9ff870166be8348b223d0"
+dependencies = [
+ "paste",
+]
+
+[[package]]
+name = "paste"
+version = "1.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
+
+[[package]]
+name = "pin-utils"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+
[[package]]
name = "pkg-config"
version = "0.3.27"
@@ -36,14 +586,420 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
[[package]]
-name = "vcpkg"
-version = "0.2.15"
+name = "pretty-hex"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
+checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5"
[[package]]
-name = "warp"
-version = "0.1.0"
+name = "proc-macro-crate"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8"
dependencies = [
- "openssl-sys",
+ "toml_edit 0.20.7",
+]
+
+[[package]]
+name = "proc-macro-error"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
+dependencies = [
+ "proc-macro-error-attr",
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+ "version_check",
+]
+
+[[package]]
+name = "proc-macro-error-attr"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "version_check",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.70"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "serde"
+version = "1.0.193"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.193"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.39",
+]
+
+[[package]]
+name = "serde_spanned"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "slab"
+version = "0.4.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "smallvec"
+version = "1.11.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
+
+[[package]]
+name = "syn"
+version = "1.0.109"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
+dependencies = [
+ "proc-macro2",
+ "unicode-ident",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.39"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "system-deps"
+version = "6.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2a2d580ff6a20c55dfb86be5f9c238f67835d0e81cbdea8bf5680e0897320331"
+dependencies = [
+ "cfg-expr",
+ "heck",
+ "pkg-config",
+ "toml",
+ "version-compare",
+]
+
+[[package]]
+name = "target-lexicon"
+version = "0.12.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a"
+
+[[package]]
+name = "thiserror"
+version = "1.0.50"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
+dependencies = [
+ "thiserror-impl",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "1.0.50"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.39",
+]
+
+[[package]]
+name = "toml"
+version = "0.8.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35"
+dependencies = [
+ "serde",
+ "serde_spanned",
+ "toml_datetime",
+ "toml_edit 0.21.0",
+]
+
+[[package]]
+name = "toml_datetime"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.20.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81"
+dependencies = [
+ "indexmap",
+ "toml_datetime",
+ "winnow",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03"
+dependencies = [
+ "indexmap",
+ "serde",
+ "serde_spanned",
+ "toml_datetime",
+ "winnow",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
+
+[[package]]
+name = "version-compare"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
+
+[[package]]
+name = "version_check"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
+
+[[package]]
+name = "wasm-bindgen"
+version = "0.2.89"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e"
+dependencies = [
+ "cfg-if",
+ "wasm-bindgen-macro",
+]
+
+[[package]]
+name = "wasm-bindgen-backend"
+version = "0.2.89"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826"
+dependencies = [
+ "bumpalo",
+ "log",
+ "once_cell",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.39",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-macro"
+version = "0.2.89"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2"
+dependencies = [
+ "quote",
+ "wasm-bindgen-macro-support",
+]
+
+[[package]]
+name = "wasm-bindgen-macro-support"
+version = "0.2.89"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.39",
+ "wasm-bindgen-backend",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-shared"
+version = "0.2.89"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f"
+
+[[package]]
+name = "windows-core"
+version = "0.51.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64"
+dependencies = [
+ "windows-targets 0.48.5",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets 0.52.0",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
+dependencies = [
+ "windows_aarch64_gnullvm 0.48.5",
+ "windows_aarch64_msvc 0.48.5",
+ "windows_i686_gnu 0.48.5",
+ "windows_i686_msvc 0.48.5",
+ "windows_x86_64_gnu 0.48.5",
+ "windows_x86_64_gnullvm 0.48.5",
+ "windows_x86_64_msvc 0.48.5",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
+dependencies = [
+ "windows_aarch64_gnullvm 0.52.0",
+ "windows_aarch64_msvc 0.52.0",
+ "windows_i686_gnu 0.52.0",
+ "windows_i686_msvc 0.52.0",
+ "windows_x86_64_gnu 0.52.0",
+ "windows_x86_64_gnullvm 0.52.0",
+ "windows_x86_64_msvc 0.52.0",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
+
+[[package]]
+name = "winnow"
+version = "0.5.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b"
+dependencies = [
+ "memchr",
]
diff --git a/Cargo.toml b/Cargo.toml
index f5232c6..32ccd09 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,21 +1,15 @@
[package]
-name = "warp"
+name = "me"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-url = "2"
-gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_18"] }
-gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_18"] }
-gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_18"] }
-wayland-display-core = { path = "../wayland-display-core" }
-moq-transport = { path = "../moq-transport" }
-tracing = "0.1.37"
-once_cell = "1.17.0"
-tracing-subscriber = "0.3.16"
+anyhow = "1"
-[[bin]]
-name = "warp"
-path = "main.rs"
+gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
+gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
+gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
+gst-gl = { package = "gstreamer-gl", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
+gst-plugin-fmp4 = { git = "https://github.com/sdroege/gst-plugin-rs", version = "0.12.0-alpha.1" }
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 29ebfa5..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,661 +0,0 @@
- GNU AFFERO GENERAL PUBLIC LICENSE
- Version 3, 19 November 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU Affero General Public License is a free, copyleft license for
-software and other kinds of works, specifically designed to ensure
-cooperation with the community in the case of network server software.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-our General Public Licenses are intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- Developers that use our General Public Licenses protect your rights
-with two steps: (1) assert copyright on the software, and (2) offer
-you this License which gives you legal permission to copy, distribute
-and/or modify the software.
-
- A secondary benefit of defending all users' freedom is that
-improvements made in alternate versions of the program, if they
-receive widespread use, become available for other developers to
-incorporate. Many developers of free software are heartened and
-encouraged by the resulting cooperation. However, in the case of
-software used on network servers, this result may fail to come about.
-The GNU General Public License permits making a modified version and
-letting the public access it on a server without ever releasing its
-source code to the public.
-
- The GNU Affero General Public License is designed specifically to
-ensure that, in such cases, the modified source code becomes available
-to the community. It requires the operator of a network server to
-provide the source code of the modified version running there to the
-users of that server. Therefore, public use of a modified version, on
-a publicly accessible server, gives the public access to the source
-code of the modified version.
-
- An older license, called the Affero General Public License and
-published by Affero, was designed to accomplish similar goals. This is
-a different license, not a version of the Affero GPL, but Affero has
-released a new version of the Affero GPL which permits relicensing under
-this license.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU Affero General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Remote Network Interaction; Use with the GNU General Public License.
-
- Notwithstanding any other provision of this License, if you modify the
-Program, your modified version must prominently offer all users
-interacting with it remotely through a computer network (if your version
-supports such interaction) an opportunity to receive the Corresponding
-Source of your version by providing access to the Corresponding Source
-from a network server at no charge, through some standard or customary
-means of facilitating copying of software. This Corresponding Source
-shall include the Corresponding Source for any work covered by version 3
-of the GNU General Public License that is incorporated pursuant to the
-following paragraph.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the work with which it is combined will remain governed by version
-3 of the GNU General Public License.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU Affero General Public License from time to time. Such new versions
-will be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU Affero General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU Affero General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU Affero General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If your software can interact with users remotely through a computer
-network, you should also make sure that it provides a way for users to
-get its source. For example, if your program is a web application, its
-interface could display a "Source" link that leads users to an archive
-of the code. There are many ways you could offer source, and different
-solutions will be better for different programs; see section 13 for the
-specific requirements.
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU AGPL, see
-.
\ No newline at end of file
diff --git a/devbox.json b/devbox.json
deleted file mode 100644
index 55398e6..0000000
--- a/devbox.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "packages": ["rustup"],
- "shell": {
- "init_hook": [
- "echo 'Welcome to devbox!' > /dev/null"
- ],
- "scripts": {
- "test": [
- "echo \"Error: no test specified\" && exit 1"
- ]
- }
- }
-}
diff --git a/devbox.lock b/devbox.lock
deleted file mode 100644
index 57955bd..0000000
--- a/devbox.lock
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "lockfile_version": "1",
- "packages": {
- "rustup": {
- "resolved": "github:NixOS/nixpkgs/75a52265bda7fd25e06e3a67dee3f0354e73243c#rustup",
- "source": "nixpkg"
- }
- }
-}
diff --git a/gstreamer/Cargo.lock b/gstreamer/Cargo.lock
deleted file mode 100644
index 4f5a0f0..0000000
--- a/gstreamer/Cargo.lock
+++ /dev/null
@@ -1,724 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 3
-
-[[package]]
-name = "atomic_refcell"
-version = "0.1.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41e67cd8309bbd06cd603a9e693a784ac2e5d1e955f11286e355089fcab3047c"
-
-[[package]]
-name = "autocfg"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
-
-[[package]]
-name = "bitflags"
-version = "2.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
-
-[[package]]
-name = "cfg-expr"
-version = "0.15.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3"
-dependencies = [
- "smallvec",
- "target-lexicon",
-]
-
-[[package]]
-name = "cfg-if"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
-
-[[package]]
-name = "either"
-version = "1.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
-
-[[package]]
-name = "equivalent"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
-
-[[package]]
-name = "form_urlencoded"
-version = "1.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
-dependencies = [
- "percent-encoding",
-]
-
-[[package]]
-name = "futures-channel"
-version = "0.3.29"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb"
-dependencies = [
- "futures-core",
-]
-
-[[package]]
-name = "futures-core"
-version = "0.3.29"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c"
-
-[[package]]
-name = "futures-executor"
-version = "0.3.29"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc"
-dependencies = [
- "futures-core",
- "futures-task",
- "futures-util",
-]
-
-[[package]]
-name = "futures-macro"
-version = "0.3.29"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.39",
-]
-
-[[package]]
-name = "futures-task"
-version = "0.3.29"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2"
-
-[[package]]
-name = "futures-util"
-version = "0.3.29"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104"
-dependencies = [
- "futures-core",
- "futures-macro",
- "futures-task",
- "pin-project-lite",
- "pin-utils",
- "slab",
-]
-
-[[package]]
-name = "gio-sys"
-version = "0.19.0"
-source = "git+https://github.com/gtk-rs/gtk-rs-core#a07ec7484ab68bbac04d3f2d2d393a1beda6a48e"
-dependencies = [
- "glib-sys",
- "gobject-sys",
- "libc",
- "system-deps",
- "windows-sys",
-]
-
-[[package]]
-name = "glib"
-version = "0.19.0"
-source = "git+https://github.com/gtk-rs/gtk-rs-core#a07ec7484ab68bbac04d3f2d2d393a1beda6a48e"
-dependencies = [
- "bitflags",
- "futures-channel",
- "futures-core",
- "futures-executor",
- "futures-task",
- "futures-util",
- "gio-sys",
- "glib-macros",
- "glib-sys",
- "gobject-sys",
- "libc",
- "memchr",
- "once_cell",
- "smallvec",
- "thiserror",
-]
-
-[[package]]
-name = "glib-macros"
-version = "0.19.0"
-source = "git+https://github.com/gtk-rs/gtk-rs-core#a07ec7484ab68bbac04d3f2d2d393a1beda6a48e"
-dependencies = [
- "heck",
- "proc-macro-crate",
- "proc-macro-error",
- "proc-macro2",
- "quote",
- "syn 2.0.39",
-]
-
-[[package]]
-name = "glib-sys"
-version = "0.19.0"
-source = "git+https://github.com/gtk-rs/gtk-rs-core#a07ec7484ab68bbac04d3f2d2d393a1beda6a48e"
-dependencies = [
- "libc",
- "system-deps",
-]
-
-[[package]]
-name = "gobject-sys"
-version = "0.19.0"
-source = "git+https://github.com/gtk-rs/gtk-rs-core#a07ec7484ab68bbac04d3f2d2d393a1beda6a48e"
-dependencies = [
- "glib-sys",
- "libc",
- "system-deps",
-]
-
-[[package]]
-name = "gstreamer"
-version = "0.22.0"
-source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#897c7dfd391e6228ea11a6efa0737c0e3ca87cd6"
-dependencies = [
- "cfg-if",
- "futures-channel",
- "futures-core",
- "futures-util",
- "glib",
- "gstreamer-sys",
- "itertools",
- "libc",
- "muldiv",
- "num-integer",
- "num-rational",
- "option-operations",
- "paste",
- "pin-project-lite",
- "pretty-hex",
- "smallvec",
- "thiserror",
-]
-
-[[package]]
-name = "gstreamer-base"
-version = "0.22.0"
-source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#897c7dfd391e6228ea11a6efa0737c0e3ca87cd6"
-dependencies = [
- "atomic_refcell",
- "cfg-if",
- "glib",
- "gstreamer",
- "gstreamer-base-sys",
- "libc",
-]
-
-[[package]]
-name = "gstreamer-base-sys"
-version = "0.22.0"
-source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#897c7dfd391e6228ea11a6efa0737c0e3ca87cd6"
-dependencies = [
- "glib-sys",
- "gobject-sys",
- "gstreamer-sys",
- "libc",
- "system-deps",
-]
-
-[[package]]
-name = "gstreamer-sys"
-version = "0.22.0"
-source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#897c7dfd391e6228ea11a6efa0737c0e3ca87cd6"
-dependencies = [
- "glib-sys",
- "gobject-sys",
- "libc",
- "system-deps",
-]
-
-[[package]]
-name = "hashbrown"
-version = "0.14.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
-
-[[package]]
-name = "heck"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
-
-[[package]]
-name = "idna"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
-dependencies = [
- "unicode-bidi",
- "unicode-normalization",
-]
-
-[[package]]
-name = "indexmap"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
-dependencies = [
- "equivalent",
- "hashbrown",
-]
-
-[[package]]
-name = "itertools"
-version = "0.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0"
-dependencies = [
- "either",
-]
-
-[[package]]
-name = "libc"
-version = "0.2.150"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
-
-[[package]]
-name = "memchr"
-version = "2.6.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
-
-[[package]]
-name = "muldiv"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "956787520e75e9bd233246045d19f42fb73242759cc57fba9611d940ae96d4b0"
-
-[[package]]
-name = "num-integer"
-version = "0.1.45"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
-dependencies = [
- "autocfg",
- "num-traits",
-]
-
-[[package]]
-name = "num-rational"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
-dependencies = [
- "autocfg",
- "num-integer",
- "num-traits",
-]
-
-[[package]]
-name = "num-traits"
-version = "0.2.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
-dependencies = [
- "autocfg",
-]
-
-[[package]]
-name = "once_cell"
-version = "1.18.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
-
-[[package]]
-name = "option-operations"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c26d27bb1aeab65138e4bf7666045169d1717febcc9ff870166be8348b223d0"
-dependencies = [
- "paste",
-]
-
-[[package]]
-name = "paste"
-version = "1.0.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
-
-[[package]]
-name = "percent-encoding"
-version = "2.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
-
-[[package]]
-name = "pin-project-lite"
-version = "0.2.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
-
-[[package]]
-name = "pin-utils"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
-
-[[package]]
-name = "pkg-config"
-version = "0.3.27"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
-
-[[package]]
-name = "pretty-hex"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5"
-
-[[package]]
-name = "proc-macro-crate"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8"
-dependencies = [
- "toml_edit 0.20.7",
-]
-
-[[package]]
-name = "proc-macro-error"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
-dependencies = [
- "proc-macro-error-attr",
- "proc-macro2",
- "quote",
- "syn 1.0.109",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro-error-attr"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
-dependencies = [
- "proc-macro2",
- "quote",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro2"
-version = "1.0.69"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
-dependencies = [
- "unicode-ident",
-]
-
-[[package]]
-name = "quote"
-version = "1.0.33"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
-name = "serde"
-version = "1.0.193"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
-dependencies = [
- "serde_derive",
-]
-
-[[package]]
-name = "serde_derive"
-version = "1.0.193"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.39",
-]
-
-[[package]]
-name = "serde_spanned"
-version = "0.6.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80"
-dependencies = [
- "serde",
-]
-
-[[package]]
-name = "slab"
-version = "0.4.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
-dependencies = [
- "autocfg",
-]
-
-[[package]]
-name = "smallvec"
-version = "1.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
-
-[[package]]
-name = "syn"
-version = "1.0.109"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
-dependencies = [
- "proc-macro2",
- "unicode-ident",
-]
-
-[[package]]
-name = "syn"
-version = "2.0.39"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-ident",
-]
-
-[[package]]
-name = "system-deps"
-version = "6.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a2d580ff6a20c55dfb86be5f9c238f67835d0e81cbdea8bf5680e0897320331"
-dependencies = [
- "cfg-expr",
- "heck",
- "pkg-config",
- "toml",
- "version-compare",
-]
-
-[[package]]
-name = "target-lexicon"
-version = "0.12.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a"
-
-[[package]]
-name = "thiserror"
-version = "1.0.50"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
-dependencies = [
- "thiserror-impl",
-]
-
-[[package]]
-name = "thiserror-impl"
-version = "1.0.50"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.39",
-]
-
-[[package]]
-name = "tinyvec"
-version = "1.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
-dependencies = [
- "tinyvec_macros",
-]
-
-[[package]]
-name = "tinyvec_macros"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
-
-[[package]]
-name = "toml"
-version = "0.8.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35"
-dependencies = [
- "serde",
- "serde_spanned",
- "toml_datetime",
- "toml_edit 0.21.0",
-]
-
-[[package]]
-name = "toml_datetime"
-version = "0.6.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
-dependencies = [
- "serde",
-]
-
-[[package]]
-name = "toml_edit"
-version = "0.20.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81"
-dependencies = [
- "indexmap",
- "toml_datetime",
- "winnow",
-]
-
-[[package]]
-name = "toml_edit"
-version = "0.21.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03"
-dependencies = [
- "indexmap",
- "serde",
- "serde_spanned",
- "toml_datetime",
- "winnow",
-]
-
-[[package]]
-name = "unicode-bidi"
-version = "0.3.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
-
-[[package]]
-name = "unicode-ident"
-version = "1.0.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
-
-[[package]]
-name = "unicode-normalization"
-version = "0.1.22"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
-dependencies = [
- "tinyvec",
-]
-
-[[package]]
-name = "url"
-version = "2.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
-dependencies = [
- "form_urlencoded",
- "idna",
- "percent-encoding",
-]
-
-[[package]]
-name = "version-compare"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
-
-[[package]]
-name = "version_check"
-version = "0.9.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
-
-[[package]]
-name = "warp"
-version = "0.1.0-alpha.1"
-dependencies = [
- "gstreamer",
- "gstreamer-base",
- "url",
-]
-
-[[package]]
-name = "windows-sys"
-version = "0.52.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
-dependencies = [
- "windows-targets",
-]
-
-[[package]]
-name = "windows-targets"
-version = "0.52.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
-dependencies = [
- "windows_aarch64_gnullvm",
- "windows_aarch64_msvc",
- "windows_i686_gnu",
- "windows_i686_msvc",
- "windows_x86_64_gnu",
- "windows_x86_64_gnullvm",
- "windows_x86_64_msvc",
-]
-
-[[package]]
-name = "windows_aarch64_gnullvm"
-version = "0.52.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
-
-[[package]]
-name = "windows_aarch64_msvc"
-version = "0.52.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
-
-[[package]]
-name = "windows_i686_gnu"
-version = "0.52.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
-
-[[package]]
-name = "windows_i686_msvc"
-version = "0.52.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
-
-[[package]]
-name = "windows_x86_64_gnu"
-version = "0.52.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
-
-[[package]]
-name = "windows_x86_64_gnullvm"
-version = "0.52.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
-
-[[package]]
-name = "windows_x86_64_msvc"
-version = "0.52.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
-
-[[package]]
-name = "winnow"
-version = "0.5.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b"
-dependencies = [
- "memchr",
-]
diff --git a/gstreamer/Cargo.toml b/gstreamer/Cargo.toml
deleted file mode 100644
index f135348..0000000
--- a/gstreamer/Cargo.toml
+++ /dev/null
@@ -1,52 +0,0 @@
-[package]
-name = "warp"
-version = "0.1.0-alpha.1"
-authors = ["Wanjohi Ryan"]
-repository = "https://github.com/netrisme/warp"
-license = "MIT OR Apache-2.0"
-description = "GStreamer MoQ Sink Plugin"
-edition = "2021"
-rust-version = "1.70"
-
-[dependencies]
-gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs",features = ["v1_18"]}
-gst-audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs",features = ["v1_18"]}
-gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs",features = ["v1_18"]}
-wayland-display-core = { path = "../wayland-display-core" }
-moq-transport = { path = "../moq-transport" }
-
-# QUIC
-quinn = "0.10"
-webtransport-quinn = "0.6.1"
-url = "2"
-
-# Crypto
-rustls = { version = "0.21", features = ["dangerous_configuration"] }
-rustls-native-certs = "0.6"
-rustls-pemfile = "1"
-
-[lib]
-name = "gstwarp"
-crate-type = ["cdylib", "rlib"]
-path = "src/lib.rs"
-
-[features]
-static = []
-capi = []
-doc = []
-default = []
-
-[package.metadata.capi]
-min_version = "0.9.21"
-
-[package.metadata.capi.header]
-enabled = false
-
-[package.metadata.capi.library]
-install_subdir = "gstreamer-1.0"
-versioning = false
-import_library = false
-
-[package.metadata.capi.pkg_config]
-requires_private = "gstreamer-1.0, gstreamer-base-1.0, gstreamer-audio-1.0, gstreamer-video-1.0, gobject-2.0, glib-2.0, gmodule-2.0"
-
diff --git a/gstreamer/build.rs b/gstreamer/build.rs
deleted file mode 100644
index cda12e5..0000000
--- a/gstreamer/build.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-fn main() {
- gst_plugin_version_helper::info()
-}
diff --git a/gstreamer/src/README.md b/gstreamer/src/README.md
deleted file mode 100644
index 5be79e1..0000000
--- a/gstreamer/src/README.md
+++ /dev/null
@@ -1,51 +0,0 @@
-To be used as follows:
-
-```rust
-use gst::prelude::*;
-
-fn main() {
- // Initialize GStreamer
- gst::init().unwrap();
-
- // Create the elements
- let source = gst::ElementFactory::make("videotestsrc", Some("source")).unwrap();
- let encoder = gst::ElementFactory::make("x264enc", Some("encoder")).unwrap();
- let muxer = gst::ElementFactory::make("fmp4mux", Some("muxer")).unwrap();
- let sink = gst::ElementFactory::make("warpsink", Some("sink")).unwrap();
-
- // Create an empty pipeline
- let pipeline = gst::Pipeline::new(Some("pipeline"));
-
- // Build the pipeline
- pipeline.add_many(&[&source, &encoder, &muxer, &sink]).unwrap();
- gst::Element::link_many(&[&source, &encoder, &muxer, &sink]).unwrap();
-
- // Start playing
- pipeline.set_state(gst::State::Playing).unwrap();
-
- // Wait until error or EOS
- let bus = pipeline.bus().unwrap();
- for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) {
- use gst::MessageView;
-
- match msg.view() {
- MessageView::Error(err) => {
- eprintln!(
- "Error from {:?}: {} ({:?})",
- err.src().map(|s| s.path_string()),
- err.error(),
- err.debug()
- );
- break;
- }
- MessageView::Eos(..) => break,
- _ => (),
- }
- }
-
- // Clean up
- pipeline.set_state(gst::State::Null).unwrap();
-}
-```
-
-
diff --git a/gstreamer/src/fmp4mux/LICENSE.md b/gstreamer/src/fmp4mux/LICENSE.md
deleted file mode 100644
index f4bbcd2..0000000
--- a/gstreamer/src/fmp4mux/LICENSE.md
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
\ No newline at end of file
diff --git a/gstreamer/src/fmp4mux/README.md b/gstreamer/src/fmp4mux/README.md
deleted file mode 100644
index 6e68fce..0000000
--- a/gstreamer/src/fmp4mux/README.md
+++ /dev/null
@@ -1 +0,0 @@
-https://github.com/sdroege/gst-plugin-rs/tree/main/mux/fmp4
\ No newline at end of file
diff --git a/gstreamer/src/fmp4mux/boxes.rs b/gstreamer/src/fmp4mux/boxes.rs
deleted file mode 100644
index a6165ff..0000000
--- a/gstreamer/src/fmp4mux/boxes.rs
+++ /dev/null
@@ -1,2258 +0,0 @@
-// Copyright (C) 2021 Sebastian Dröge
-//
-// This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
-// If a copy of the MPL was not distributed with this file, You can obtain one at
-// .
-//
-// SPDX-License-Identifier: MPL-2.0
-
-use gst::prelude::*;
-
-use anyhow::{anyhow, bail, Context, Error};
-
-use super::Buffer;
-
-fn write_box) -> Result>(
- vec: &mut Vec,
- fourcc: impl std::borrow::Borrow<[u8; 4]>,
- content_func: F,
-) -> Result {
- // Write zero size ...
- let size_pos = vec.len();
- vec.extend([0u8; 4]);
- vec.extend(fourcc.borrow());
-
- let res = content_func(vec)?;
-
- // ... and update it here later.
- let size: u32 = vec
- .len()
- .checked_sub(size_pos)
- .expect("vector shrunk")
- .try_into()
- .context("too big box content")?;
- vec[size_pos..][..4].copy_from_slice(&size.to_be_bytes());
-
- Ok(res)
-}
-
-const FULL_BOX_VERSION_0: u8 = 0;
-const FULL_BOX_VERSION_1: u8 = 1;
-
-const FULL_BOX_FLAGS_NONE: u32 = 0;
-
-fn write_full_box) -> Result>(
- vec: &mut Vec,
- fourcc: impl std::borrow::Borrow<[u8; 4]>,
- version: u8,
- flags: u32,
- content_func: F,
-) -> Result {
- write_box(vec, fourcc, move |vec| {
- assert_eq!(flags >> 24, 0);
- vec.extend(((u32::from(version) << 24) | flags).to_be_bytes());
- content_func(vec)
- })
-}
-
-fn cmaf_brands_from_caps(caps: &gst::CapsRef, compatible_brands: &mut Vec<&'static [u8; 4]>) {
- let s = caps.structure(0).unwrap();
- match s.name().as_str() {
- "video/x-h264" => {
- let width = s.get::("width").ok();
- let height = s.get::("height").ok();
- let fps = s.get::("framerate").ok();
- let profile = s.get::<&str>("profile").ok();
- let level = s
- .get::<&str>("level")
- .ok()
- .map(|l| l.split_once('.').unwrap_or((l, "0")));
- let colorimetry = s.get::<&str>("colorimetry").ok();
-
- if let (Some(width), Some(height), Some(profile), Some(level), Some(fps)) =
- (width, height, profile, level, fps)
- {
- if profile == "high"
- || profile == "main"
- || profile == "baseline"
- || profile == "constrained-baseline"
- {
- if width <= 864
- && height <= 576
- && level <= ("3", "1")
- && fps <= gst::Fraction::new(60, 1)
- {
- if let Some(colorimetry) =
- colorimetry.and_then(|c| c.parse::().ok())
- {
- if matches!(
- colorimetry.primaries(),
- gst_video::VideoColorPrimaries::Bt709
- | gst_video::VideoColorPrimaries::Bt470bg
- | gst_video::VideoColorPrimaries::Smpte170m
- ) && matches!(
- colorimetry.transfer(),
- gst_video::VideoTransferFunction::Bt709
- | gst_video::VideoTransferFunction::Bt601
- ) && matches!(
- colorimetry.matrix(),
- gst_video::VideoColorMatrix::Bt709
- | gst_video::VideoColorMatrix::Bt601
- ) {
- compatible_brands.push(b"cfsd");
- }
- } else {
- // Assume it's OK
- compatible_brands.push(b"cfsd");
- }
- } else if width <= 1920
- && height <= 1080
- && level <= ("4", "0")
- && fps <= gst::Fraction::new(60, 1)
- {
- if let Some(colorimetry) =
- colorimetry.and_then(|c| c.parse::().ok())
- {
- if matches!(
- colorimetry.primaries(),
- gst_video::VideoColorPrimaries::Bt709
- ) && matches!(
- colorimetry.transfer(),
- gst_video::VideoTransferFunction::Bt709
- ) && matches!(
- colorimetry.matrix(),
- gst_video::VideoColorMatrix::Bt709
- ) {
- compatible_brands.push(b"cfhd");
- }
- } else {
- // Assume it's OK
- compatible_brands.push(b"cfhd");
- }
- } else if width <= 1920
- && height <= 1080
- && level <= ("4", "2")
- && fps <= gst::Fraction::new(60, 1)
- {
- if let Some(colorimetry) =
- colorimetry.and_then(|c| c.parse::().ok())
- {
- if matches!(
- colorimetry.primaries(),
- gst_video::VideoColorPrimaries::Bt709
- ) && matches!(
- colorimetry.transfer(),
- gst_video::VideoTransferFunction::Bt709
- ) && matches!(
- colorimetry.matrix(),
- gst_video::VideoColorMatrix::Bt709
- ) {
- compatible_brands.push(b"chdf");
- }
- } else {
- // Assume it's OK
- compatible_brands.push(b"chdf");
- }
- }
- }
- }
- }
- "audio/mpeg" => {
- compatible_brands.push(b"caac");
- }
- "video/x-h265" => {
- let width = s.get::("width").ok();
- let height = s.get::("height").ok();
- let fps = s.get::("framerate").ok();
- let profile = s.get::<&str>("profile").ok();
- let tier = s.get::<&str>("tier").ok();
- let level = s
- .get::<&str>("level")
- .ok()
- .map(|l| l.split_once('.').unwrap_or((l, "0")));
- let colorimetry = s.get::<&str>("colorimetry").ok();
-
- if let (Some(width), Some(height), Some(profile), Some(tier), Some(level), Some(fps)) =
- (width, height, profile, tier, level, fps)
- {
- if profile == "main" && tier == "main" {
- if width <= 1920
- && height <= 1080
- && level <= ("4", "1")
- && fps <= gst::Fraction::new(60, 1)
- {
- if let Some(colorimetry) =
- colorimetry.and_then(|c| c.parse::().ok())
- {
- if matches!(
- colorimetry.primaries(),
- gst_video::VideoColorPrimaries::Bt709
- ) && matches!(
- colorimetry.transfer(),
- gst_video::VideoTransferFunction::Bt709
- ) && matches!(
- colorimetry.matrix(),
- gst_video::VideoColorMatrix::Bt709
- ) {
- compatible_brands.push(b"chhd");
- }
- } else {
- // Assume it's OK
- compatible_brands.push(b"chhd");
- }
- } else if width <= 3840
- && height <= 2160
- && level <= ("5", "0")
- && fps <= gst::Fraction::new(60, 1)
- {
- if let Some(colorimetry) =
- colorimetry.and_then(|c| c.parse::().ok())
- {
- if matches!(
- colorimetry.primaries(),
- gst_video::VideoColorPrimaries::Bt709
- ) && matches!(
- colorimetry.transfer(),
- gst_video::VideoTransferFunction::Bt709
- ) && matches!(
- colorimetry.matrix(),
- gst_video::VideoColorMatrix::Bt709
- ) {
- compatible_brands.push(b"cud8");
- }
- } else {
- // Assume it's OK
- compatible_brands.push(b"cud8");
- }
- }
- } else if profile == "main-10" && tier == "main-10" {
- if width <= 1920
- && height <= 1080
- && level <= ("4", "1")
- && fps <= gst::Fraction::new(60, 1)
- {
- if let Some(colorimetry) =
- colorimetry.and_then(|c| c.parse::().ok())
- {
- if matches!(
- colorimetry.primaries(),
- gst_video::VideoColorPrimaries::Bt709
- ) && matches!(
- colorimetry.transfer(),
- gst_video::VideoTransferFunction::Bt709
- ) && matches!(
- colorimetry.matrix(),
- gst_video::VideoColorMatrix::Bt709
- ) {
- compatible_brands.push(b"chh1");
- }
- } else {
- // Assume it's OK
- compatible_brands.push(b"chh1");
- }
- } else if width <= 3840
- && height <= 2160
- && level <= ("5", "1")
- && fps <= gst::Fraction::new(60, 1)
- {
- if let Some(colorimetry) =
- colorimetry.and_then(|c| c.parse::().ok())
- {
- if matches!(
- colorimetry.primaries(),
- gst_video::VideoColorPrimaries::Bt709
- | gst_video::VideoColorPrimaries::Bt2020
- ) && matches!(
- colorimetry.transfer(),
- gst_video::VideoTransferFunction::Bt709
- | gst_video::VideoTransferFunction::Bt202010
- | gst_video::VideoTransferFunction::Bt202012
- ) && matches!(
- colorimetry.matrix(),
- gst_video::VideoColorMatrix::Bt709
- | gst_video::VideoColorMatrix::Bt2020
- ) {
- compatible_brands.push(b"cud1");
- } else if matches!(
- colorimetry.primaries(),
- gst_video::VideoColorPrimaries::Bt2020
- ) && matches!(
- colorimetry.transfer(),
- gst_video::VideoTransferFunction::Smpte2084
- ) && matches!(
- colorimetry.matrix(),
- gst_video::VideoColorMatrix::Bt2020
- ) {
- compatible_brands.push(b"chd1");
- } else if matches!(
- colorimetry.primaries(),
- gst_video::VideoColorPrimaries::Bt2020
- ) && matches!(
- colorimetry.transfer(),
- gst_video::VideoTransferFunction::AribStdB67
- ) && matches!(
- colorimetry.matrix(),
- gst_video::VideoColorMatrix::Bt2020
- ) {
- compatible_brands.push(b"clg1");
- }
- } else {
- // Assume it's OK
- compatible_brands.push(b"cud1");
- }
- }
- }
- }
- }
- _ => (),
- }
-}
-
-fn brands_from_variant_and_caps<'a>(
- variant: super::Variant,
- mut caps: impl Iterator,
-) -> (&'static [u8; 4], Vec<&'static [u8; 4]>) {
- match variant {
- super::Variant::ISO | super::Variant::ONVIF => (b"iso6", vec![b"iso6"]),
- super::Variant::DASH => {
- // FIXME: `dsms` / `dash` brands, `msix`
- (b"msdh", vec![b"dums", b"msdh", b"iso6"])
- }
- super::Variant::CMAF => {
- let mut compatible_brands = vec![b"iso6", b"cmfc"];
-
- cmaf_brands_from_caps(caps.next().unwrap(), &mut compatible_brands);
- assert_eq!(caps.next(), None);
-
- (b"cmf2", compatible_brands)
- }
- }
-}
-
-/// Creates `ftyp` and `moov` boxes
-pub(super) fn create_fmp4_header(cfg: super::HeaderConfiguration) -> Result {
- let mut v = vec![];
-
- let (brand, compatible_brands) =
- brands_from_variant_and_caps(cfg.variant, cfg.streams.iter().map(|s| &s.caps));
-
- write_box(&mut v, b"ftyp", |v| {
- // major brand
- v.extend(brand);
- // minor version
- v.extend(0u32.to_be_bytes());
- // compatible brands
- v.extend(compatible_brands.into_iter().flatten());
-
- Ok(())
- })?;
-
- write_box(&mut v, b"moov", |v| write_moov(v, &cfg))?;
-
- if cfg.variant == super::Variant::ONVIF {
- write_full_box(
- &mut v,
- b"meta",
- FULL_BOX_VERSION_0,
- FULL_BOX_FLAGS_NONE,
- |v| {
- write_full_box(v, b"hdlr", FULL_BOX_VERSION_0, FULL_BOX_FLAGS_NONE, |v| {
- // Handler type
- v.extend(b"null");
-
- // Reserved
- v.extend([0u8; 3 * 4]);
-
- // Name
- v.extend(b"MetadataHandler");
-
- Ok(())
- })?;
-
- write_box(v, b"cstb", |v| {
- // entry count
- v.extend(1u32.to_be_bytes());
-
- // track id
- v.extend(0u32.to_be_bytes());
-
- // start UTC time in 100ns units since Jan 1 1601
- v.extend(cfg.start_utc_time.unwrap().to_be_bytes());
-
- Ok(())
- })
- },
- )?;
- }
-
- Ok(gst::Buffer::from_mut_slice(v))
-}
-
-fn write_moov(v: &mut Vec, cfg: &super::HeaderConfiguration) -> Result<(), Error> {
- use gst::glib;
-
- let base = glib::DateTime::from_utc(1904, 1, 1, 0, 0, 0.0)?;
- let now = glib::DateTime::now_utc()?;
- let creation_time =
- u64::try_from(now.difference(&base).as_seconds()).expect("time before 1904");
-
- write_full_box(v, b"mvhd", FULL_BOX_VERSION_1, FULL_BOX_FLAGS_NONE, |v| {
- write_mvhd(v, cfg, creation_time)
- })?;
- for (idx, stream) in cfg.streams.iter().enumerate() {
- write_box(v, b"trak", |v| {
- let mut references = vec![];
-
- // Reference the video track for ONVIF metadata tracks
- if cfg.variant == super::Variant::ONVIF
- && stream.caps.structure(0).unwrap().name() == "application/x-onvif-metadata"
- {
- // Find the first video track
- for (idx, other_stream) in cfg.streams.iter().enumerate() {
- let s = other_stream.caps.structure(0).unwrap();
-
- if matches!(
- s.name().as_str(),
- "video/x-h264" | "video/x-h265" | "image/jpeg"
- ) {
- references.push(TrackReference {
- reference_type: *b"cdsc",
- track_ids: vec![idx as u32 + 1],
- });
- break;
- }
- }
- }
-
- write_trak(v, cfg, idx, stream, creation_time, &references)
- })?;
- }
- write_box(v, b"mvex", |v| write_mvex(v, cfg))?;
-
- Ok(())
-}
-
-fn caps_to_timescale(caps: &gst::CapsRef) -> u32 {
- let s = caps.structure(0).unwrap();
-
- if let Ok(fps) = s.get::("framerate") {
- if fps.numer() == 0 {
- return 10_000;
- }
-
- if fps.denom() != 1 && fps.denom() != 1001 {
- if let Some(fps) = (fps.denom() as u64)
- .nseconds()
- .mul_div_round(1_000_000_000, fps.numer() as u64)
- .and_then(gst_video::guess_framerate)
- {
- return (fps.numer() as u32)
- .mul_div_round(100, fps.denom() as u32)
- .unwrap_or(10_000);
- }
- }
-
- if fps.denom() == 1001 {
- fps.numer() as u32
- } else {
- (fps.numer() as u32)
- .mul_div_round(100, fps.denom() as u32)
- .unwrap_or(10_000)
- }
- } else if let Ok(rate) = s.get::("rate") {
- rate as u32
- } else {
- 10_000
- }
-}
-
-fn header_stream_to_timescale(stream: &super::HeaderStream) -> u32 {
- if stream.trak_timescale > 0 {
- stream.trak_timescale
- } else {
- caps_to_timescale(&stream.caps)
- }
-}
-
-fn header_configuration_to_timescale(cfg: &super::HeaderConfiguration) -> u32 {
- if cfg.movie_timescale > 0 {
- cfg.movie_timescale
- } else {
- // Use the reference track timescale
- header_stream_to_timescale(&cfg.streams[0])
- }
-}
-
-fn fragment_header_stream_to_timescale(stream: &super::FragmentHeaderStream) -> u32 {
- if stream.trak_timescale > 0 {
- stream.trak_timescale
- } else {
- caps_to_timescale(&stream.caps)
- }
-}
-
-fn write_mvhd(
- v: &mut Vec,
- cfg: &super::HeaderConfiguration,
- creation_time: u64,
-) -> Result<(), Error> {
- // Creation time
- v.extend(creation_time.to_be_bytes());
- // Modification time
- v.extend(creation_time.to_be_bytes());
- // Timescale
- v.extend(header_configuration_to_timescale(cfg).to_be_bytes());
- // Duration
- v.extend(0u64.to_be_bytes());
-
- // Rate 1.0
- v.extend((1u32 << 16).to_be_bytes());
- // Volume 1.0
- v.extend((1u16 << 8).to_be_bytes());
- // Reserved
- v.extend([0u8; 2 + 2 * 4]);
-
- // Matrix
- v.extend(
- [
- (1u32 << 16).to_be_bytes(),
- 0u32.to_be_bytes(),
- 0u32.to_be_bytes(),
- 0u32.to_be_bytes(),
- (1u32 << 16).to_be_bytes(),
- 0u32.to_be_bytes(),
- 0u32.to_be_bytes(),
- 0u32.to_be_bytes(),
- (16384u32 << 16).to_be_bytes(),
- ]
- .into_iter()
- .flatten(),
- );
-
- // Pre defined
- v.extend([0u8; 6 * 4]);
-
- // Next track id
- v.extend((cfg.streams.len() as u32 + 1).to_be_bytes());
-
- Ok(())
-}
-
-const TKHD_FLAGS_TRACK_ENABLED: u32 = 0x1;
-const TKHD_FLAGS_TRACK_IN_MOVIE: u32 = 0x2;
-const TKHD_FLAGS_TRACK_IN_PREVIEW: u32 = 0x4;
-
-struct TrackReference {
- reference_type: [u8; 4],
- track_ids: Vec,
-}
-
-fn write_trak(
- v: &mut Vec,
- cfg: &super::HeaderConfiguration,
- idx: usize,
- stream: &super::HeaderStream,
- creation_time: u64,
- references: &[TrackReference],
-) -> Result<(), Error> {
- write_full_box(
- v,
- b"tkhd",
- FULL_BOX_VERSION_1,
- TKHD_FLAGS_TRACK_ENABLED | TKHD_FLAGS_TRACK_IN_MOVIE | TKHD_FLAGS_TRACK_IN_PREVIEW,
- |v| write_tkhd(v, cfg, idx, stream, creation_time),
- )?;
-
- // TODO: write edts if necessary: for audio tracks to remove initialization samples
- // TODO: write edts optionally for negative DTS instead of offsetting the DTS
-
- write_box(v, b"mdia", |v| write_mdia(v, cfg, stream, creation_time))?;
-
- if !references.is_empty() {
- write_box(v, b"tref", |v| write_tref(v, cfg, references))?;
- }
-
- Ok(())
-}
-
-fn write_tkhd(
- v: &mut Vec,
- _cfg: &super::HeaderConfiguration,
- idx: usize,
- stream: &super::HeaderStream,
- creation_time: u64,
-) -> Result<(), Error> {
- // Creation time
- v.extend(creation_time.to_be_bytes());
- // Modification time
- v.extend(creation_time.to_be_bytes());
- // Track ID
- v.extend((idx as u32 + 1).to_be_bytes());
- // Reserved
- v.extend(0u32.to_be_bytes());
- // Duration
- v.extend(0u64.to_be_bytes());
-
- // Reserved
- v.extend([0u8; 2 * 4]);
-
- // Layer
- v.extend(0u16.to_be_bytes());
- // Alternate group
- v.extend(0u16.to_be_bytes());
-
- // Volume
- let s = stream.caps.structure(0).unwrap();
- match s.name().as_str() {
- "audio/mpeg" | "audio/x-opus" | "audio/x-alaw" | "audio/x-mulaw" | "audio/x-adpcm" => {
- v.extend((1u16 << 8).to_be_bytes())
- }
- _ => v.extend(0u16.to_be_bytes()),
- }
-
- // Reserved
- v.extend([0u8; 2]);
-
- // Matrix
- v.extend(
- [
- (1u32 << 16).to_be_bytes(),
- 0u32.to_be_bytes(),
- 0u32.to_be_bytes(),
- 0u32.to_be_bytes(),
- (1u32 << 16).to_be_bytes(),
- 0u32.to_be_bytes(),
- 0u32.to_be_bytes(),
- 0u32.to_be_bytes(),
- (16384u32 << 16).to_be_bytes(),
- ]
- .into_iter()
- .flatten(),
- );
-
- // Width/height
- match s.name().as_str() {
- "video/x-h264" | "video/x-h265" | "video/x-vp8" | "video/x-vp9" | "video/x-av1"
- | "image/jpeg" => {
- let width = s.get::("width").context("video caps without width")? as u32;
- let height = s
- .get::("height")
- .context("video caps without height")? as u32;
- let par = s
- .get::("pixel-aspect-ratio")
- .unwrap_or_else(|_| gst::Fraction::new(1, 1));
-
- let width = std::cmp::min(
- width
- .mul_div_round(par.numer() as u32, par.denom() as u32)
- .unwrap_or(u16::MAX as u32),
- u16::MAX as u32,
- );
- let height = std::cmp::min(height, u16::MAX as u32);
-
- v.extend((width << 16).to_be_bytes());
- v.extend((height << 16).to_be_bytes());
- }
- _ => v.extend([0u8; 2 * 4]),
- }
-
- Ok(())
-}
-
-fn write_mdia(
- v: &mut Vec,
- cfg: &super::HeaderConfiguration,
- stream: &super::HeaderStream,
- creation_time: u64,
-) -> Result<(), Error> {
- write_full_box(v, b"mdhd", FULL_BOX_VERSION_1, FULL_BOX_FLAGS_NONE, |v| {
- write_mdhd(v, cfg, stream, creation_time)
- })?;
- write_full_box(v, b"hdlr", FULL_BOX_VERSION_0, FULL_BOX_FLAGS_NONE, |v| {
- write_hdlr(v, cfg, stream)
- })?;
-
- // TODO: write elng if needed
-
- write_box(v, b"minf", |v| write_minf(v, cfg, stream))?;
-
- Ok(())
-}
-
-fn write_tref(
- v: &mut Vec,
- _cfg: &super::HeaderConfiguration,
- references: &[TrackReference],
-) -> Result<(), Error> {
- for reference in references {
- write_box(v, reference.reference_type, |v| {
- for track_id in &reference.track_ids {
- v.extend(track_id.to_be_bytes());
- }
-
- Ok(())
- })?;
- }
-
- Ok(())
-}
-
-fn language_code(lang: impl std::borrow::Borrow<[u8; 3]>) -> u16 {
- let lang = lang.borrow();
-
- // TODO: Need to relax this once we get the language code from tags
- assert!(lang.iter().all(u8::is_ascii_lowercase));
-
- (((lang[0] as u16 - 0x60) & 0x1F) << 10)
- + (((lang[1] as u16 - 0x60) & 0x1F) << 5)
- + ((lang[2] as u16 - 0x60) & 0x1F)
-}
-
-fn write_mdhd(
- v: &mut Vec,
- _cfg: &super::HeaderConfiguration,
- stream: &super::HeaderStream,
- creation_time: u64,
-) -> Result<(), Error> {
- // Creation time
- v.extend(creation_time.to_be_bytes());
- // Modification time
- v.extend(creation_time.to_be_bytes());
- // Timescale
- v.extend(header_stream_to_timescale(stream).to_be_bytes());
- // Duration
- v.extend(0u64.to_be_bytes());
-
- // Language as ISO-639-2/T
- // TODO: get actual language from the tags
- v.extend(language_code(b"und").to_be_bytes());
-
- // Pre-defined
- v.extend([0u8; 2]);
-
- Ok(())
-}
-
-fn write_hdlr(
- v: &mut Vec,
- _cfg: &super::HeaderConfiguration,
- stream: &super::HeaderStream,
-) -> Result<(), Error> {
- // Pre-defined
- v.extend([0u8; 4]);
-
- let s = stream.caps.structure(0).unwrap();
- let (handler_type, name) = match s.name().as_str() {
- "video/x-h264" | "video/x-h265" | "video/x-vp8" | "video/x-vp9" | "video/x-av1"
- | "image/jpeg" => (b"vide", b"VideoHandler\0".as_slice()),
- "audio/mpeg" | "audio/x-opus" | "audio/x-alaw" | "audio/x-mulaw" | "audio/x-adpcm" => {
- (b"soun", b"SoundHandler\0".as_slice())
- }
- "application/x-onvif-metadata" => (b"meta", b"MetadataHandler\0".as_slice()),
- _ => unreachable!(),
- };
-
- // Handler type
- v.extend(handler_type);
-
- // Reserved
- v.extend([0u8; 3 * 4]);
-
- // Name
- v.extend(name);
-
- Ok(())
-}
-
-fn write_minf(
- v: &mut Vec,
- cfg: &super::HeaderConfiguration,
- stream: &super::HeaderStream,
-) -> Result<(), Error> {
- let s = stream.caps.structure(0).unwrap();
-
- match s.name().as_str() {
- "video/x-h264" | "video/x-h265" | "video/x-vp8" | "video/x-vp9" | "video/x-av1"
- | "image/jpeg" => {
- // Flags are always 1 for unspecified reasons
- write_full_box(v, b"vmhd", FULL_BOX_VERSION_0, 1, |v| write_vmhd(v, cfg))?
- }
- "audio/mpeg" | "audio/x-opus" | "audio/x-alaw" | "audio/x-mulaw" | "audio/x-adpcm" => {
- write_full_box(v, b"smhd", FULL_BOX_VERSION_0, FULL_BOX_FLAGS_NONE, |v| {
- write_smhd(v, cfg)
- })?
- }
- "application/x-onvif-metadata" => {
- write_full_box(v, b"nmhd", FULL_BOX_VERSION_0, FULL_BOX_FLAGS_NONE, |_v| {
- Ok(())
- })?
- }
- _ => unreachable!(),
- }
-
- write_box(v, b"dinf", |v| write_dinf(v, cfg))?;
-
- write_box(v, b"stbl", |v| write_stbl(v, cfg, stream))?;
-
- Ok(())
-}
-
-fn write_vmhd(v: &mut Vec, _cfg: &super::HeaderConfiguration) -> Result<(), Error> {
- // Graphics mode
- v.extend([0u8; 2]);
-
- // opcolor
- v.extend([0u8; 2 * 3]);
-
- Ok(())
-}
-
-fn write_smhd(v: &mut Vec, _cfg: &super::HeaderConfiguration) -> Result<(), Error> {
- // Balance
- v.extend([0u8; 2]);
-
- // Reserved
- v.extend([0u8; 2]);
-
- Ok(())
-}
-
-fn write_dinf(v: &mut Vec, cfg: &super::HeaderConfiguration) -> Result<(), Error> {
- write_full_box(v, b"dref", FULL_BOX_VERSION_0, FULL_BOX_FLAGS_NONE, |v| {
- write_dref(v, cfg)
- })?;
-
- Ok(())
-}
-
-const DREF_FLAGS_MEDIA_IN_SAME_FILE: u32 = 0x1;
-
-fn write_dref(v: &mut Vec, _cfg: &super::HeaderConfiguration) -> Result<(), Error> {
- // Entry count
- v.extend(1u32.to_be_bytes());
-
- write_full_box(
- v,
- b"url ",
- FULL_BOX_VERSION_0,
- DREF_FLAGS_MEDIA_IN_SAME_FILE,
- |_v| Ok(()),
- )?;
-
- Ok(())
-}
-
-fn write_stbl(
- v: &mut Vec,
- cfg: &super::HeaderConfiguration,
- stream: &super::HeaderStream,
-) -> Result<(), Error> {
- write_full_box(v, b"stsd", FULL_BOX_VERSION_0, FULL_BOX_FLAGS_NONE, |v| {
- write_stsd(v, cfg, stream)
- })?;
- write_full_box(v, b"stts", FULL_BOX_VERSION_0, FULL_BOX_FLAGS_NONE, |v| {
- write_stts(v, cfg)
- })?;
- write_full_box(v, b"stsc", FULL_BOX_VERSION_0, FULL_BOX_FLAGS_NONE, |v| {
- write_stsc(v, cfg)
- })?;
- write_full_box(v, b"stsz", FULL_BOX_VERSION_0, FULL_BOX_FLAGS_NONE, |v| {
- write_stsz(v, cfg)
- })?;
-
- write_full_box(v, b"stco", FULL_BOX_VERSION_0, FULL_BOX_FLAGS_NONE, |v| {
- write_stco(v, cfg)
- })?;
-
- // For video write a sync sample box as indication that not all samples are sync samples
- if !stream.delta_frames.intra_only() {
- write_full_box(v, b"stss", FULL_BOX_VERSION_0, FULL_BOX_FLAGS_NONE, |v| {
- write_stss(v, cfg)
- })?
- }
-
- Ok(())
-}
-
-fn write_stsd(
- v: &mut Vec,
- cfg: &super::HeaderConfiguration,
- stream: &super::HeaderStream,
-) -> Result<(), Error> {
- // Entry count
- v.extend(1u32.to_be_bytes());
-
- let s = stream.caps.structure(0).unwrap();
- match s.name().as_str() {
- "video/x-h264" | "video/x-h265" | "video/x-vp8" | "video/x-vp9" | "video/x-av1"
- | "image/jpeg" => write_visual_sample_entry(v, cfg, stream)?,
- "audio/mpeg" | "audio/x-opus" | "audio/x-alaw" | "audio/x-mulaw" | "audio/x-adpcm" => {
- write_audio_sample_entry(v, cfg, stream)?
- }
- "application/x-onvif-metadata" => write_xml_meta_data_sample_entry(v, cfg, stream)?,
- _ => unreachable!(),
- }
-
- Ok(())
-}
-
-fn write_sample_entry_box) -> Result>(
- v: &mut Vec,
- fourcc: impl std::borrow::Borrow<[u8; 4]>,
- content_func: F,
-) -> Result {
- write_box(v, fourcc, move |v| {
- // Reserved
- v.extend([0u8; 6]);
-
- // Data reference index
- v.extend(1u16.to_be_bytes());
-
- content_func(v)
- })
-}
-
-fn write_visual_sample_entry(
- v: &mut Vec,
- _cfg: &super::HeaderConfiguration,
- stream: &super::HeaderStream,
-) -> Result<(), Error> {
- let s = stream.caps.structure(0).unwrap();
- let fourcc = match s.name().as_str() {
- "video/x-h264" => {
- let stream_format = s.get::<&str>("stream-format").context("no stream-format")?;
- match stream_format {
- "avc" => b"avc1",
- "avc3" => b"avc3",
- _ => unreachable!(),
- }
- }
- "video/x-h265" => {
- let stream_format = s.get::<&str>("stream-format").context("no stream-format")?;
- match stream_format {
- "hvc1" => b"hvc1",
- "hev1" => b"hev1",
- _ => unreachable!(),
- }
- }
- "image/jpeg" => b"jpeg",
- "video/x-vp8" => b"vp08",
- "video/x-vp9" => b"vp09",
- "video/x-av1" => b"av01",
- _ => unreachable!(),
- };
-
- write_sample_entry_box(v, fourcc, move |v| {
- // pre-defined
- v.extend([0u8; 2]);
- // Reserved
- v.extend([0u8; 2]);
- // pre-defined
- v.extend([0u8; 3 * 4]);
-
- // Width
- let width =
- u16::try_from(s.get::("width").context("no width")?).context("too big width")?;
- v.extend(width.to_be_bytes());
-
- // Height
- let height = u16::try_from(s.get::("height").context("no height")?)
- .context("too big height")?;
- v.extend(height.to_be_bytes());
-
- // Horizontal resolution
- v.extend(0x00480000u32.to_be_bytes());
-
- // Vertical resolution
- v.extend(0x00480000u32.to_be_bytes());
-
- // Reserved
- v.extend([0u8; 4]);
-
- // Frame count
- v.extend(1u16.to_be_bytes());
-
- // Compressor name
- v.extend([0u8; 32]);
-
- // Depth
- v.extend(0x0018u16.to_be_bytes());
-
- // Pre-defined
- v.extend((-1i16).to_be_bytes());
-
- // Codec specific boxes
- match s.name().as_str() {
- "video/x-h264" => {
- let codec_data = s
- .get::<&gst::BufferRef>("codec_data")
- .context("no codec_data")?;
- let map = codec_data
- .map_readable()
- .context("codec_data not mappable")?;
- write_box(v, b"avcC", move |v| {
- v.extend_from_slice(&map);
- Ok(())
- })?;
- }
- "video/x-h265" => {
- let codec_data = s
- .get::<&gst::BufferRef>("codec_data")
- .context("no codec_data")?;
- let map = codec_data
- .map_readable()
- .context("codec_data not mappable")?;
- write_box(v, b"hvcC", move |v| {
- v.extend_from_slice(&map);
- Ok(())
- })?;
- }
- "video/x-vp9" => {
- let profile: u8 = match s.get::<&str>("profile").expect("no vp9 profile") {
- "0" => Some(0),
- "1" => Some(1),
- "2" => Some(2),
- "3" => Some(3),
- _ => None,
- }
- .context("unsupported vp9 profile")?;
- let colorimetry = gst_video::VideoColorimetry::from_str(
- s.get::<&str>("colorimetry").expect("no colorimetry"),
- )
- .context("failed to parse colorimetry")?;
- let video_full_range =
- colorimetry.range() == gst_video::VideoColorRange::Range0_255;
- let chroma_format: u8 =
- match s.get::<&str>("chroma-format").expect("no chroma-format") {
- "4:2:0" =>
- // chroma-site is optional
- {
- match s
- .get::<&str>("chroma-site")
- .ok()
- .and_then(|cs| gst_video::VideoChromaSite::from_str(cs).ok())
- {
- Some(gst_video::VideoChromaSite::V_COSITED) => Some(0),
- // COSITED
- _ => Some(1),
- }
- }
- "4:2:2" => Some(2),
- "4:4:4" => Some(3),
- _ => None,
- }
- .context("unsupported chroma-format")?;
- let bit_depth: u8 = {
- let bit_depth_luma = s.get::("bit-depth-luma").expect("no bit-depth-luma");
- let bit_depth_chroma = s
- .get::("bit-depth-chroma")
- .expect("no bit-depth-chroma");
- if bit_depth_luma != bit_depth_chroma {
- return Err(anyhow!("bit-depth-luma and bit-depth-chroma have different values which is an unsupported configuration"));
- }
- bit_depth_luma as u8
- };
- write_full_box(v, b"vpcC", 1, 0, move |v| {
- v.push(profile);
- // XXX: hardcoded level 1
- v.push(10);
- let mut byte: u8 = 0;
- byte |= (bit_depth & 0xF) << 4;
- byte |= (chroma_format & 0x7) << 1;
- byte |= video_full_range as u8;
- v.push(byte);
- v.push(colorimetry.primaries().to_iso() as u8);
- v.push(colorimetry.transfer().to_iso() as u8);
- v.push(colorimetry.matrix().to_iso() as u8);
- // 16-bit length field for codec initialization, unused
- v.push(0);
- v.push(0);
- Ok(())
- })?;
- }
- "video/x-av1" => {
- write_box(v, b"av1C", move |v| {
- if let Ok(codec_data) = s.get::<&gst::BufferRef>("codec_data") {
- let map = codec_data
- .map_readable()
- .context("codec_data not mappable")?;
-
- v.extend_from_slice(&map);
- } else {
- let presentation_delay_minus_one =
- if let Ok(presentation_delay) = s.get::("presentation-delay") {
- Some(
- (1u8 << 5)
- | std::cmp::max(
- 0xF,
- (presentation_delay.saturating_sub(1) & 0xF) as u8,
- ),
- )
- } else {
- None
- };
-
- let profile = match s.get::<&str>("profile").unwrap() {
- "main" => 0,
- "high" => 1,
- "professional" => 2,
- _ => unreachable!(),
- };
-
- let level = 1; // FIXME
- let tier = 0; // FIXME
- let (high_bitdepth, twelve_bit) =
- match s.get::("bit-depth-luma").unwrap() {
- 8 => (false, false),
- 10 => (true, false),
- 12 => (true, true),
- _ => unreachable!(),
- };
- let (monochrome, chroma_sub_x, chroma_sub_y) =
- match s.get::<&str>("chroma-format").unwrap() {
- "4:0:0" => (true, true, true),
- "4:2:0" => (false, true, true),
- "4:2:2" => (false, true, false),
- "4:4:4" => (false, false, false),
- _ => unreachable!(),
- };
-
- let chrome_sample_position = match s.get::<&str>("chroma-site") {
- Ok("v-cosited") => 1,
- Ok("v-cosited+h-cosited") => 2,
- _ => 0,
- };
-
- let codec_data = [
- 0x80 | 0x01, // marker | version
- (profile << 5) | level, // profile | level
- (tier << 7)
- | ((high_bitdepth as u8) << 6)
- | ((twelve_bit as u8) << 5)
- | ((monochrome as u8) << 4)
- | ((chroma_sub_x as u8) << 3)
- | ((chroma_sub_y as u8) << 2)
- | chrome_sample_position, // tier | high bitdepth | twelve bit | monochrome | chroma sub x |
- // chroma sub y | chroma sample position
- if let Some(presentation_delay_minus_one) = presentation_delay_minus_one
- {
- 0x10 | presentation_delay_minus_one // reserved | presentation delay present | presentation delay
- } else {
- 0
- },
- ];
-
- v.extend_from_slice(&codec_data);
- }
-
- Ok(())
- })?;
- }
- "video/x-vp8" | "image/jpeg" => {
- // Nothing to do here
- }
- _ => unreachable!(),
- }
-
- if let Ok(par) = s.get::("pixel-aspect-ratio") {
- write_box(v, b"pasp", move |v| {
- v.extend((par.numer() as u32).to_be_bytes());
- v.extend((par.denom() as u32).to_be_bytes());
- Ok(())
- })?;
- }
-
- if let Some(colorimetry) = s
- .get::<&str>("colorimetry")
- .ok()
- .and_then(|c| c.parse::().ok())
- {
- write_box(v, b"colr", move |v| {
- v.extend(b"nclx");
- let (primaries, transfer, matrix) = {
- (
- (colorimetry.primaries().to_iso() as u16),
- (colorimetry.transfer().to_iso() as u16),
- (colorimetry.matrix().to_iso() as u16),
- )
- };
-
- let full_range = match colorimetry.range() {
- gst_video::VideoColorRange::Range0_255 => 0x80u8,
- gst_video::VideoColorRange::Range16_235 => 0x00u8,
- _ => 0x00,
- };
-
- v.extend(primaries.to_be_bytes());
- v.extend(transfer.to_be_bytes());
- v.extend(matrix.to_be_bytes());
- v.push(full_range);
-
- Ok(())
- })?;
- }
-
- if let Ok(cll) = gst_video::VideoContentLightLevel::from_caps(&stream.caps) {
- write_box(v, b"clli", move |v| {
- v.extend((cll.max_content_light_level()).to_be_bytes());
- v.extend((cll.max_frame_average_light_level()).to_be_bytes());
- Ok(())
- })?;
- }
-
- if let Ok(mastering) = gst_video::VideoMasteringDisplayInfo::from_caps(&stream.caps) {
- write_box(v, b"mdcv", move |v| {
- for primary in mastering.display_primaries() {
- v.extend(primary.x.to_be_bytes());
- v.extend(primary.y.to_be_bytes());
- }
- v.extend(mastering.white_point().x.to_be_bytes());
- v.extend(mastering.white_point().y.to_be_bytes());
- v.extend(mastering.max_display_mastering_luminance().to_be_bytes());
- v.extend(mastering.max_display_mastering_luminance().to_be_bytes());
- Ok(())
- })?;
- }
-
- // Write fiel box for codecs that require it
- if ["image/jpeg"].contains(&s.name().as_str()) {
- let interlace_mode = s
- .get::<&str>("interlace-mode")
- .ok()
- .map(gst_video::VideoInterlaceMode::from_string)
- .unwrap_or(gst_video::VideoInterlaceMode::Progressive);
- let field_order = s
- .get::<&str>("field-order")
- .ok()
- .map(gst_video::VideoFieldOrder::from_string)
- .unwrap_or(gst_video::VideoFieldOrder::Unknown);
-
- write_box(v, b"fiel", move |v| {
- let (interlace, field_order) = match interlace_mode {
- gst_video::VideoInterlaceMode::Progressive => (1, 0),
- gst_video::VideoInterlaceMode::Interleaved
- if field_order == gst_video::VideoFieldOrder::TopFieldFirst =>
- {
- (2, 9)
- }
- gst_video::VideoInterlaceMode::Interleaved => (2, 14),
- _ => (0, 0),
- };
-
- v.push(interlace);
- v.push(field_order);
- Ok(())
- })?;
- }
-
- // TODO: write btrt bitrate box based on tags
-
- Ok(())
- })?;
-
- Ok(())
-}
-
-fn write_audio_sample_entry(
- v: &mut Vec,
- _cfg: &super::HeaderConfiguration,
- stream: &super::HeaderStream,
-) -> Result<(), Error> {
- let s = stream.caps.structure(0).unwrap();
- let fourcc = match s.name().as_str() {
- "audio/mpeg" => b"mp4a",
- "audio/x-opus" => b"Opus",
- "audio/x-alaw" => b"alaw",
- "audio/x-mulaw" => b"ulaw",
- "audio/x-adpcm" => {
- let layout = s.get::<&str>("layout").context("no ADPCM layout field")?;
-
- match layout {
- "g726" => b"ms\x00\x45",
- _ => unreachable!(),
- }
- }
- _ => unreachable!(),
- };
-
- let sample_size = match s.name().as_str() {
- "audio/x-adpcm" => {
- let bitrate = s.get::("bitrate").context("no ADPCM bitrate field")?;
- (bitrate / 8000) as u16
- }
- _ => 16u16,
- };
-
- write_sample_entry_box(v, fourcc, move |v| {
- // Reserved
- v.extend([0u8; 2 * 4]);
-
- // Channel count
- let channels = u16::try_from(s.get::("channels").context("no channels")?)
- .context("too many channels")?;
- v.extend(channels.to_be_bytes());
-
- // Sample size
- v.extend(sample_size.to_be_bytes());
-
- // Pre-defined
- v.extend([0u8; 2]);
-
- // Reserved
- v.extend([0u8; 2]);
-
- // Sample rate
- let rate = u16::try_from(s.get::("rate").context("no rate")?).unwrap_or(0);
- v.extend((u32::from(rate) << 16).to_be_bytes());
-
- // Codec specific boxes
- match s.name().as_str() {
- "audio/mpeg" => {
- let codec_data = s
- .get::<&gst::BufferRef>("codec_data")
- .context("no codec_data")?;
- let map = codec_data
- .map_readable()
- .context("codec_data not mappable")?;
- if map.len() < 2 {
- bail!("too small codec_data");
- }
- write_esds_aac(v, &map)?;
- }
- "audio/x-opus" => {
- write_dops(v, &stream.caps)?;
- }
- "audio/x-alaw" | "audio/x-mulaw" | "audio/x-adpcm" => {
- // Nothing to do here
- }
- _ => unreachable!(),
- }
-
- // If rate did not fit into 16 bits write a full `srat` box
- if rate == 0 {
- let rate = s.get::("rate").context("no rate")?;
- // FIXME: This is defined as full box?
- write_full_box(
- v,
- b"srat",
- FULL_BOX_VERSION_0,
- FULL_BOX_FLAGS_NONE,
- move |v| {
- v.extend((rate as u32).to_be_bytes());
- Ok(())
- },
- )?;
- }
-
- // TODO: write btrt bitrate box based on tags
-
- // TODO: chnl box for channel ordering? probably not needed for AAC
-
- Ok(())
- })?;
-
- Ok(())
-}
-
-fn write_esds_aac(v: &mut Vec, codec_data: &[u8]) -> Result<(), Error> {
- let calculate_len = |mut len| {
- if len > 260144641 {
- bail!("too big descriptor length");
- }
-
- if len == 0 {
- return Ok(([0; 4], 1));
- }
-
- let mut idx = 0;
- let mut lens = [0u8; 4];
- while len > 0 {
- lens[idx] = ((if len > 0x7f { 0x80 } else { 0x00 }) | (len & 0x7f)) as u8;
- idx += 1;
- len >>= 7;
- }
-
- Ok((lens, idx))
- };
-
- write_full_box(
- v,
- b"esds",
- FULL_BOX_VERSION_0,
- FULL_BOX_FLAGS_NONE,
- move |v| {
- // Calculate all lengths bottom up
-
- // Decoder specific info
- let decoder_specific_info_len = calculate_len(codec_data.len())?;
-
- // Decoder config
- let decoder_config_len =
- calculate_len(13 + 1 + decoder_specific_info_len.1 + codec_data.len())?;
-
- // SL config
- let sl_config_len = calculate_len(1)?;
-
- // ES descriptor
- let es_descriptor_len = calculate_len(
- 3 + 1
- + decoder_config_len.1
- + 13
- + 1
- + decoder_specific_info_len.1
- + codec_data.len()
- + 1
- + sl_config_len.1
- + 1,
- )?;
-
- // ES descriptor tag
- v.push(0x03);
-
- // Length
- v.extend_from_slice(&es_descriptor_len.0[..(es_descriptor_len.1)]);
-
- // Track ID
- v.extend(1u16.to_be_bytes());
- // Flags
- v.push(0u8);
-
- // Decoder config descriptor
- v.push(0x04);
-
- // Length
- v.extend_from_slice(&decoder_config_len.0[..(decoder_config_len.1)]);
-
- // Object type ESDS_OBJECT_TYPE_MPEG4_P3
- v.push(0x40);
- // Stream type ESDS_STREAM_TYPE_AUDIO
- v.push((0x05 << 2) | 0x01);
-
- // Buffer size db?
- v.extend([0u8; 3]);
-
- // Max bitrate
- v.extend(0u32.to_be_bytes());
-
- // Avg bitrate
- v.extend(0u32.to_be_bytes());
-
- // Decoder specific info
- v.push(0x05);
-
- // Length
- v.extend_from_slice(&decoder_specific_info_len.0[..(decoder_specific_info_len.1)]);
- v.extend_from_slice(codec_data);
-
- // SL config descriptor
- v.push(0x06);
-
- // Length: 1 (tag) + 1 (length) + 1 (predefined)
- v.extend_from_slice(&sl_config_len.0[..(sl_config_len.1)]);
-
- // Predefined
- v.push(0x02);
- Ok(())
- },
- )
-}
-
-fn write_dops(v: &mut Vec, caps: &gst::Caps) -> Result<(), Error> {
- let rate;
- let channels;
- let channel_mapping_family;
- let stream_count;
- let coupled_count;
- let pre_skip;
- let output_gain;
- let mut channel_mapping = [0; 256];
-
- // TODO: Use audio clipping meta to calculate pre_skip
-
- if let Some(header) = caps
- .structure(0)
- .unwrap()
- .get::("streamheader")
- .ok()
- .and_then(|a| a.get(0).and_then(|v| v.get::().ok()))
- {
- (
- rate,
- channels,
- channel_mapping_family,
- stream_count,
- coupled_count,
- pre_skip,
- output_gain,
- ) = gst_pbutils::codec_utils_opus_parse_header(&header, Some(&mut channel_mapping))
- .unwrap();
- } else {
- (
- rate,
- channels,
- channel_mapping_family,
- stream_count,
- coupled_count,
- ) = gst_pbutils::codec_utils_opus_parse_caps(caps, Some(&mut channel_mapping)).unwrap();
- output_gain = 0;
- pre_skip = 0;
- }
-
- write_box(v, b"dOps", move |v| {
- // Version number
- v.push(0);
- v.push(channels);
- v.extend(pre_skip.to_be_bytes());
- v.extend(rate.to_be_bytes());
- v.extend(output_gain.to_be_bytes());
- v.push(channel_mapping_family);
- if channel_mapping_family > 0 {
- v.push(stream_count);
- v.push(coupled_count);
- v.extend(&channel_mapping[..channels as usize]);
- }
-
- Ok(())
- })
-}
-
-fn write_xml_meta_data_sample_entry(
- v: &mut Vec,
- _cfg: &super::HeaderConfiguration,
- stream: &super::HeaderStream,
-) -> Result<(), Error> {
- let s = stream.caps.structure(0).unwrap();
- let namespace = match s.name().as_str() {
- "application/x-onvif-metadata" => b"http://www.onvif.org/ver10/schema",
- _ => unreachable!(),
- };
-
- write_sample_entry_box(v, b"metx", move |v| {
- // content_encoding, empty string
- v.push(0);
-
- // namespace
- v.extend_from_slice(namespace);
- v.push(0);
-
- // schema_location, empty string list
- v.push(0);
-
- Ok(())
- })?;
-
- Ok(())
-}
-
-fn write_stts(v: &mut Vec, _cfg: &super::HeaderConfiguration) -> Result<(), Error> {
- // Entry count
- v.extend(0u32.to_be_bytes());
-
- Ok(())
-}
-
-fn write_stsc(v: &mut Vec, _cfg: &super::HeaderConfiguration) -> Result<(), Error> {
- // Entry count
- v.extend(0u32.to_be_bytes());
-
- Ok(())
-}
-
-fn write_stsz(v: &mut Vec, _cfg: &super::HeaderConfiguration) -> Result<(), Error> {
- // Sample size
- v.extend(0u32.to_be_bytes());
-
- // Sample count
- v.extend(0u32.to_be_bytes());
-
- Ok(())
-}
-
-fn write_stco(v: &mut Vec, _cfg: &super::HeaderConfiguration) -> Result<(), Error> {
- // Entry count
- v.extend(0u32.to_be_bytes());
-
- Ok(())
-}
-
-fn write_stss(v: &mut Vec, _cfg: &super::HeaderConfiguration) -> Result<(), Error> {
- // Entry count
- v.extend(0u32.to_be_bytes());
-
- Ok(())
-}
-
-fn write_mvex(v: &mut Vec, cfg: &super::HeaderConfiguration) -> Result<(), Error> {
- if cfg.write_mehd {
- if cfg.update && cfg.duration.is_some() {
- write_full_box(v, b"mehd", FULL_BOX_VERSION_1, FULL_BOX_FLAGS_NONE, |v| {
- write_mehd(v, cfg)
- })?;
- } else {
- write_box(v, b"free", |v| {
- // version/flags of full box
- v.extend(0u32.to_be_bytes());
- // mehd duration
- v.extend(0u64.to_be_bytes());
-
- Ok(())
- })?;
- }
- }
-
- for (idx, _stream) in cfg.streams.iter().enumerate() {
- write_full_box(v, b"trex", FULL_BOX_VERSION_0, FULL_BOX_FLAGS_NONE, |v| {
- write_trex(v, cfg, idx)
- })?;
- }
-
- Ok(())
-}
-
-fn write_mehd(v: &mut Vec, cfg: &super::HeaderConfiguration) -> Result<(), Error> {
- // Use the reference track timescale
- let timescale = header_configuration_to_timescale(cfg);
-
- let duration = cfg
- .duration
- .expect("no duration")
- .mul_div_ceil(timescale as u64, gst::ClockTime::SECOND.nseconds())
- .context("too long duration")?;
-
- // Media duration in mvhd.timescale units
- v.extend(duration.to_be_bytes());
-
- Ok(())
-}
-
-fn write_trex(v: &mut Vec, _cfg: &super::HeaderConfiguration, idx: usize) -> Result<(), Error> {
- // Track ID
- v.extend((idx as u32 + 1).to_be_bytes());
-
- // Default sample description index
- v.extend(1u32.to_be_bytes());
-
- // Default sample duration
- v.extend(0u32.to_be_bytes());
-
- // Default sample size
- v.extend(0u32.to_be_bytes());
-
- // Default sample flags
- v.extend(0u32.to_be_bytes());
-
- // Default sample duration/size/etc will be provided in the traf/trun if one can be determined
- // for a whole fragment
-
- Ok(())
-}
-
-/// Creates `styp` and `moof` boxes and `mdat` header
-pub(super) fn create_fmp4_fragment_header(
- cfg: super::FragmentHeaderConfiguration,
-) -> Result<(gst::Buffer, u64), Error> {
- let mut v = vec![];
-
- // Don't write a `styp` if this is only a chunk.
- if !cfg.chunk {
- let (brand, compatible_brands) =
- brands_from_variant_and_caps(cfg.variant, cfg.streams.iter().map(|s| &s.caps));
-
- write_box(&mut v, b"styp", |v| {
- // major brand
- v.extend(brand);
- // minor version
- v.extend(0u32.to_be_bytes());
- // compatible brands
- v.extend(compatible_brands.into_iter().flatten());
-
- Ok(())
- })?;
- }
-
- let styp_len = v.len();
-
- let data_offset_offsets = write_box(&mut v, b"moof", |v| write_moof(v, &cfg))?;
-
- let size = cfg
- .buffers
- .iter()
- .map(|buffer| buffer.buffer.size() as u64)
- .sum::();
- if let Ok(size) = u32::try_from(size + 8) {
- v.extend(size.to_be_bytes());
- v.extend(b"mdat");
- } else {
- v.extend(1u32.to_be_bytes());
- v.extend(b"mdat");
- v.extend((size + 16).to_be_bytes());
- }
-
- let data_offset = v.len() - styp_len;
- for data_offset_offset in data_offset_offsets {
- let val = u32::from_be_bytes(v[data_offset_offset..][..4].try_into()?)
- .checked_add(u32::try_from(data_offset)?)
- .ok_or_else(|| anyhow!("can't calculate track run data offset"))?;
- v[data_offset_offset..][..4].copy_from_slice(&val.to_be_bytes());
- }
-
- Ok((gst::Buffer::from_mut_slice(v), styp_len as u64))
-}
-
-fn write_moof(
- v: &mut Vec,
- cfg: &super::FragmentHeaderConfiguration,
-) -> Result, Error> {
- write_full_box(v, b"mfhd", FULL_BOX_VERSION_0, FULL_BOX_FLAGS_NONE, |v| {
- write_mfhd(v, cfg)
- })?;
-
- let mut data_offset_offsets = vec![];
- for (idx, stream) in cfg.streams.iter().enumerate() {
- // Skip tracks without any buffers for this fragment.
- if stream.start_time.is_none() {
- continue;
- }
-
- write_box(v, b"traf", |v| {
- write_traf(v, cfg, &mut data_offset_offsets, idx, stream)
- })?;
- }
-
- Ok(data_offset_offsets)
-}
-
-fn write_mfhd(v: &mut Vec, cfg: &super::FragmentHeaderConfiguration) -> Result<(), Error> {
- v.extend(cfg.sequence_number.to_be_bytes());
-
- Ok(())
-}
-
-#[allow(clippy::identity_op)]
-#[allow(clippy::bool_to_int_with_if)]
-fn sample_flags_from_buffer(stream: &super::FragmentHeaderStream, buffer: &gst::BufferRef) -> u32 {
- if stream.delta_frames.intra_only() {
- (0b00u32 << (16 + 10)) | // leading: unknown
- (0b10u32 << (16 + 8)) | // depends: no
- (0b10u32 << (16 + 6)) | // depended: no
- (0b00u32 << (16 + 4)) | // redundancy: unknown
- (0b000u32 << (16 + 1)) | // padding: no
- (0b0u32 << 16) | // non-sync-sample: no
- (0u32) // degradation priority
- } else {
- let depends = if buffer.flags().contains(gst::BufferFlags::DELTA_UNIT) {
- 0b01u32
- } else {
- 0b10u32
- };
- let depended = if buffer.flags().contains(gst::BufferFlags::DROPPABLE) {
- 0b10u32
- } else {
- 0b00u32
- };
- let non_sync_sample = if buffer.flags().contains(gst::BufferFlags::DELTA_UNIT) {
- 0b1u32
- } else {
- 0b0u32
- };
-
- (0b00u32 << (16 + 10)) | // leading: unknown
- (depends << (16 + 8)) | // depends
- (depended << (16 + 6)) | // depended
- (0b00u32 << (16 + 4)) | // redundancy: unknown
- (0b000u32 << (16 + 1)) | // padding: no
- (non_sync_sample << 16) | // non-sync-sample
- (0u32) // degradation priority
- }
-}
-
-const DEFAULT_SAMPLE_DURATION_PRESENT: u32 = 0x08;
-const DEFAULT_SAMPLE_SIZE_PRESENT: u32 = 0x10;
-const DEFAULT_SAMPLE_FLAGS_PRESENT: u32 = 0x20;
-const DEFAULT_BASE_IS_MOOF: u32 = 0x2_00_00;
-
-const DATA_OFFSET_PRESENT: u32 = 0x0_01;
-const FIRST_SAMPLE_FLAGS_PRESENT: u32 = 0x0_04;
-const SAMPLE_DURATION_PRESENT: u32 = 0x1_00;
-const SAMPLE_SIZE_PRESENT: u32 = 0x2_00;
-const SAMPLE_FLAGS_PRESENT: u32 = 0x4_00;
-const SAMPLE_COMPOSITION_TIME_OFFSET_PRESENT: u32 = 0x8_00;
-
-#[allow(clippy::type_complexity)]
-fn analyze_buffers(
- cfg: &super::FragmentHeaderConfiguration,
- idx: usize,
- stream: &super::FragmentHeaderStream,
- timescale: u32,
-) -> Result<
- (
- // tf_flags
- u32,
- // tr_flags
- u32,
- // default size
- Option,
- // default duration
- Option,
- // default flags
- Option,
- // negative composition time offsets
- bool,
- ),
- Error,
-> {
- let mut tf_flags = DEFAULT_BASE_IS_MOOF;
- let mut tr_flags = DATA_OFFSET_PRESENT;
-
- let mut duration = None;
- let mut size = None;
- let mut first_buffer_flags = None;
- let mut flags = None;
-
- let mut negative_composition_time_offsets = false;
-
- for Buffer {
- idx: _idx,
- buffer,
- timestamp: _timestamp,
- duration: sample_duration,
- composition_time_offset,
- } in cfg.buffers.iter().filter(|b| b.idx == idx)
- {
- if size.is_none() {
- size = Some(buffer.size() as u32);
- }
- if Some(buffer.size() as u32) != size {
- tr_flags |= SAMPLE_SIZE_PRESENT;
- }
-
- let sample_duration = u32::try_from(
- sample_duration
- .nseconds()
- .mul_div_round(timescale as u64, gst::ClockTime::SECOND.nseconds())
- .context("too big sample duration")?,
- )
- .context("too big sample duration")?;
-
- if duration.is_none() {
- duration = Some(sample_duration);
- }
- if Some(sample_duration) != duration {
- tr_flags |= SAMPLE_DURATION_PRESENT;
- }
-
- let f = sample_flags_from_buffer(stream, buffer);
- if first_buffer_flags.is_none() {
- // First buffer, remember as first buffer flags
- first_buffer_flags = Some(f);
- } else if flags.is_none() {
- // Second buffer, remember as general flags and if they're
- // different from the first buffer's flags then also remember
- // that
- flags = Some(f);
- if Some(f) != first_buffer_flags {
- tr_flags |= FIRST_SAMPLE_FLAGS_PRESENT;
- }
- } else if Some(f) != flags {
- // Third or later buffer, and the flags are different than the second buffer's flags.
- // In that case each sample will have to store its own flags.
- tr_flags &= !FIRST_SAMPLE_FLAGS_PRESENT;
- tr_flags |= SAMPLE_FLAGS_PRESENT;
- }
-
- if let Some(composition_time_offset) = *composition_time_offset {
- assert!(stream.delta_frames.requires_dts());
- if composition_time_offset != 0 {
- tr_flags |= SAMPLE_COMPOSITION_TIME_OFFSET_PRESENT;
- }
- if composition_time_offset < 0 {
- negative_composition_time_offsets = true;
- }
- }
- }
-
- if (tr_flags & SAMPLE_SIZE_PRESENT) == 0 {
- tf_flags |= DEFAULT_SAMPLE_SIZE_PRESENT;
- } else {
- size = None;
- }
-
- if (tr_flags & SAMPLE_DURATION_PRESENT) == 0 {
- tf_flags |= DEFAULT_SAMPLE_DURATION_PRESENT;
- } else {
- duration = None;
- }
-
- // If there is only a single buffer use its flags as default sample flags
- // instead of first sample flags.
- if flags.is_none() && first_buffer_flags.is_some() {
- tr_flags &= !FIRST_SAMPLE_FLAGS_PRESENT;
- flags = first_buffer_flags.take();
- }
-
- // If all but possibly the first buffer had the same flags then only store them once instead of
- // with every single sample.
- if (tr_flags & SAMPLE_FLAGS_PRESENT) == 0 {
- tf_flags |= DEFAULT_SAMPLE_FLAGS_PRESENT;
- } else {
- flags = None;
- }
-
- Ok((
- tf_flags,
- tr_flags,
- size,
- duration,
- flags,
- negative_composition_time_offsets,
- ))
-}
-
-#[allow(clippy::ptr_arg)]
-fn write_traf(
- v: &mut Vec,
- cfg: &super::FragmentHeaderConfiguration,
- data_offset_offsets: &mut Vec,
- idx: usize,
- stream: &super::FragmentHeaderStream,
-) -> Result<(), Error> {
- let timescale = fragment_header_stream_to_timescale(stream);
-
- // Analyze all buffers to know what values can be put into the tfhd for all samples and what
- // has to be stored for every single sample
- let (
- tf_flags,
- mut tr_flags,
- default_size,
- default_duration,
- default_flags,
- negative_composition_time_offsets,
- ) = analyze_buffers(cfg, idx, stream, timescale)?;
-
- assert!((tf_flags & DEFAULT_SAMPLE_SIZE_PRESENT == 0) ^ default_size.is_some());
- assert!((tf_flags & DEFAULT_SAMPLE_DURATION_PRESENT == 0) ^ default_duration.is_some());
- assert!((tf_flags & DEFAULT_SAMPLE_FLAGS_PRESENT == 0) ^ default_flags.is_some());
-
- write_full_box(v, b"tfhd", FULL_BOX_VERSION_0, tf_flags, |v| {
- write_tfhd(v, cfg, idx, default_size, default_duration, default_flags)
- })?;
- write_full_box(v, b"tfdt", FULL_BOX_VERSION_1, FULL_BOX_FLAGS_NONE, |v| {
- write_tfdt(v, cfg, idx, stream, timescale)
- })?;
-
- let mut current_data_offset = 0;
-
- for run in GroupBy::new(cfg.buffers, |a: &Buffer, b: &Buffer| a.idx == b.idx) {
- if run[0].idx != idx {
- // FIXME: What to do with >4GB offsets?
- current_data_offset = (current_data_offset as u64
- + run.iter().map(|b| b.buffer.size() as u64).sum::())
- .try_into()?;
- continue;
- }
-
- let data_offset_offset = write_full_box(
- v,
- b"trun",
- if negative_composition_time_offsets {
- FULL_BOX_VERSION_1
- } else {
- FULL_BOX_VERSION_0
- },
- tr_flags,
- |v| {
- write_trun(
- v,
- cfg,
- current_data_offset,
- tr_flags,
- timescale,
- stream,
- run,
- )
- },
- )?;
- data_offset_offsets.push(data_offset_offset);
-
- // FIXME: What to do with >4GB offsets?
- current_data_offset = (current_data_offset as u64
- + run.iter().map(|b| b.buffer.size() as u64).sum::())
- .try_into()?;
-
- // Don't include first sample flags in any trun boxes except for the first
- tr_flags &= !FIRST_SAMPLE_FLAGS_PRESENT;
- }
-
- // TODO: saio, saiz, sbgp, sgpd, subs?
-
- Ok(())
-}
-
-fn write_tfhd(
- v: &mut Vec,
- _cfg: &super::FragmentHeaderConfiguration,
- idx: usize,
- default_size: Option,
- default_duration: Option,
- default_flags: Option,
-) -> Result<(), Error> {
- // Track ID
- v.extend((idx as u32 + 1).to_be_bytes());
-
- // No base data offset, no sample description index
-
- if let Some(default_duration) = default_duration {
- v.extend(default_duration.to_be_bytes());
- }
-
- if let Some(default_size) = default_size {
- v.extend(default_size.to_be_bytes());
- }
-
- if let Some(default_flags) = default_flags {
- v.extend(default_flags.to_be_bytes());
- }
-
- Ok(())
-}
-
-fn write_tfdt(
- v: &mut Vec,
- _cfg: &super::FragmentHeaderConfiguration,
- _idx: usize,
- stream: &super::FragmentHeaderStream,
- timescale: u32,
-) -> Result<(), Error> {
- let base_time = stream
- .start_time
- .unwrap()
- .mul_div_floor(timescale as u64, gst::ClockTime::SECOND.nseconds())
- .context("base time overflow")?;
-
- v.extend(base_time.to_be_bytes());
-
- Ok(())
-}
-
-#[allow(clippy::too_many_arguments)]
-fn write_trun(
- v: &mut Vec,
- _cfg: &super::FragmentHeaderConfiguration,
- current_data_offset: u32,
- tr_flags: u32,
- timescale: u32,
- stream: &super::FragmentHeaderStream,
- buffers: &[Buffer],
-) -> Result {
- // Sample count
- v.extend((buffers.len() as u32).to_be_bytes());
-
- let data_offset_offset = v.len();
- // Data offset, will be rewritten later
- v.extend(current_data_offset.to_be_bytes());
-
- if (tr_flags & FIRST_SAMPLE_FLAGS_PRESENT) != 0 {
- v.extend(sample_flags_from_buffer(stream, &buffers[0].buffer).to_be_bytes());
- }
-
- for Buffer {
- idx: _idx,
- ref buffer,
- timestamp: _timestamp,
- duration,
- composition_time_offset,
- } in buffers.iter()
- {
- if (tr_flags & SAMPLE_DURATION_PRESENT) != 0 {
- // Sample duration
- let sample_duration = u32::try_from(
- duration
- .nseconds()
- .mul_div_round(timescale as u64, gst::ClockTime::SECOND.nseconds())
- .context("too big sample duration")?,
- )
- .context("too big sample duration")?;
- v.extend(sample_duration.to_be_bytes());
- }
-
- if (tr_flags & SAMPLE_SIZE_PRESENT) != 0 {
- // Sample size
- v.extend((buffer.size() as u32).to_be_bytes());
- }
-
- if (tr_flags & SAMPLE_FLAGS_PRESENT) != 0 {
- assert!((tr_flags & FIRST_SAMPLE_FLAGS_PRESENT) == 0);
-
- // Sample flags
- v.extend(sample_flags_from_buffer(stream, buffer).to_be_bytes());
- }
-
- if (tr_flags & SAMPLE_COMPOSITION_TIME_OFFSET_PRESENT) != 0 {
- // Sample composition time offset
- let composition_time_offset = i32::try_from(
- composition_time_offset
- .unwrap_or(0)
- .mul_div_round(timescale as i64, gst::ClockTime::SECOND.nseconds() as i64)
- .context("too big composition time offset")?,
- )
- .context("too big composition time offset")?;
- v.extend(composition_time_offset.to_be_bytes());
- }
- }
-
- Ok(data_offset_offset)
-}
-
-/// Creates `mfra` box
-pub(crate) fn create_mfra(
- caps: &gst::CapsRef,
- fragment_offsets: &[super::FragmentOffset],
-) -> Result {
- let timescale = caps_to_timescale(caps);
-
- let mut v = vec![];
-
- let offset = write_box(&mut v, b"mfra", |v| {
- write_full_box(v, b"tfra", FULL_BOX_VERSION_1, FULL_BOX_FLAGS_NONE, |v| {
- // Track ID
- v.extend(1u32.to_be_bytes());
-
- // Reserved / length of traf/trun/sample
- v.extend(0u32.to_be_bytes());
-
- // Number of entries
- v.extend(
- u32::try_from(fragment_offsets.len())
- .context("too many fragments")?
- .to_be_bytes(),
- );
-
- for super::FragmentOffset { time, offset } in fragment_offsets {
- // Time
- let time = time
- .nseconds()
- .mul_div_round(timescale as u64, gst::ClockTime::SECOND.nseconds())
- .context("time overflow")?;
- v.extend(time.to_be_bytes());
-
- // moof offset
- v.extend(offset.to_be_bytes());
-
- // traf/trun/sample number
- v.extend_from_slice(&[1u8; 3][..]);
- }
-
- Ok(())
- })?;
-
- let offset = write_full_box(v, b"mfro", FULL_BOX_VERSION_0, FULL_BOX_FLAGS_NONE, |v| {
- let offset = v.len();
- // Parent size
- v.extend(0u32.to_be_bytes());
- Ok(offset)
- })?;
-
- Ok(offset)
- })?;
-
- let len = u32::try_from(v.len() as u64).context("too big mfra")?;
- v[offset..][..4].copy_from_slice(&len.to_be_bytes());
-
- Ok(gst::Buffer::from_mut_slice(v))
-}
-
-// Copy from std while this is still nightly-only
-use std::{fmt, str::FromStr};
-
-/// An iterator over slice in (non-overlapping) chunks separated by a predicate.
-///
-/// This struct is created by the [`group_by`] method on [slices].
-///
-/// [`group_by`]: slice::group_by
-/// [slices]: slice
-struct GroupBy<'a, T: 'a, P> {
- slice: &'a [T],
- predicate: P,
-}
-
-impl<'a, T: 'a, P> GroupBy<'a, T, P> {
- fn new(slice: &'a [T], predicate: P) -> Self {
- GroupBy { slice, predicate }
- }
-}
-
-impl<'a, T: 'a, P> Iterator for GroupBy<'a, T, P>
-where
- P: FnMut(&T, &T) -> bool,
-{
- type Item = &'a [T];
-
- #[inline]
- fn next(&mut self) -> Option {
- if self.slice.is_empty() {
- None
- } else {
- let mut len = 1;
- let mut iter = self.slice.windows(2);
- while let Some([l, r]) = iter.next() {
- if (self.predicate)(l, r) {
- len += 1
- } else {
- break;
- }
- }
- let (head, tail) = self.slice.split_at(len);
- self.slice = tail;
- Some(head)
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (usize, Option) {
- if self.slice.is_empty() {
- (0, Some(0))
- } else {
- (1, Some(self.slice.len()))
- }
- }
-
- #[inline]
- fn last(mut self) -> Option {
- self.next_back()
- }
-}
-
-impl<'a, T: 'a, P> DoubleEndedIterator for GroupBy<'a, T, P>
-where
- P: FnMut(&T, &T) -> bool,
-{
- #[inline]
- fn next_back(&mut self) -> Option {
- if self.slice.is_empty() {
- None
- } else {
- let mut len = 1;
- let mut iter = self.slice.windows(2);
- while let Some([l, r]) = iter.next_back() {
- if (self.predicate)(l, r) {
- len += 1
- } else {
- break;
- }
- }
- let (head, tail) = self.slice.split_at(self.slice.len() - len);
- self.slice = head;
- Some(tail)
- }
- }
-}
-
-impl<'a, T: 'a, P> std::iter::FusedIterator for GroupBy<'a, T, P> where P: FnMut(&T, &T) -> bool {}
-
-impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for GroupBy<'a, T, P> {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- f.debug_struct("GroupBy")
- .field("slice", &self.slice)
- .finish()
- }
-}
\ No newline at end of file
diff --git a/gstreamer/src/fmp4mux/imp.rs b/gstreamer/src/fmp4mux/imp.rs
deleted file mode 100644
index 0c1c8fc..0000000
--- a/gstreamer/src/fmp4mux/imp.rs
+++ /dev/null
@@ -1,3869 +0,0 @@
-// Copyright (C) 2021 Sebastian Dröge
-//
-// This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
-// If a copy of the MPL was not distributed with this file, You can obtain one at
-// .
-//
-// SPDX-License-Identifier: MPL-2.0
-
-use gst::glib;
-use gst::prelude::*;
-use gst::subclass::prelude::*;
-use gst_base::prelude::*;
-use gst_base::subclass::prelude::*;
-
-use std::collections::VecDeque;
-use std::mem;
-use std::sync::Mutex;
-
-use gst::glib::once_cell::sync::Lazy;
-
-use super::boxes;
-use super::Buffer;
-use super::DeltaFrames;
-
-/// Offset for the segment in non-single-stream variants.
-const SEGMENT_OFFSET: gst::ClockTime = gst::ClockTime::from_seconds(60 * 60 * 1000);
-
-/// Offset between UNIX epoch and Jan 1 1601 epoch in seconds.
-/// 1601 = UNIX + UNIX_1601_OFFSET.
-const UNIX_1601_OFFSET: u64 = 11_644_473_600;
-
-/// Offset between NTP and UNIX epoch in seconds.
-/// NTP = UNIX + NTP_UNIX_OFFSET.
-const NTP_UNIX_OFFSET: u64 = 2_208_988_800;
-
-/// Reference timestamp meta caps for NTP timestamps.
-static NTP_CAPS: Lazy = Lazy::new(|| gst::Caps::builder("timestamp/x-ntp").build());
-
-/// Reference timestamp meta caps for UNIX timestamps.
-static UNIX_CAPS: Lazy = Lazy::new(|| gst::Caps::builder("timestamp/x-unix").build());
-
-/// Returns the UTC time of the buffer in the UNIX epoch.
-fn get_utc_time_from_buffer(buffer: &gst::BufferRef) -> Option {
- buffer
- .iter_meta::()
- .find_map(|meta| {
- if meta.reference().can_intersect(&UNIX_CAPS) {
- Some(meta.timestamp())
- } else if meta.reference().can_intersect(&NTP_CAPS) {
- meta.timestamp().checked_sub(NTP_UNIX_OFFSET.seconds())
- } else {
- None
- }
- })
-}
-
-/// Converts a running time to an UTC time.
-fn running_time_to_utc_time(
- running_time: impl Into>,
- running_time_utc_time_mapping: (
- impl Into>,
- impl Into>,
- ),
-) -> Option {
- running_time_utc_time_mapping
- .1
- .into()
- .checked_sub(running_time_utc_time_mapping.0.into())
- .and_then(|res| res.checked_add(running_time.into()))
- .and_then(|res| res.positive())
-}
-
-/// Converts an UTC time to a running time.
-fn utc_time_to_running_time(
- utc_time: gst::ClockTime,
- running_time_utc_time_mapping: (
- impl Into>,
- impl Into>,
- ),
-) -> Option {
- running_time_utc_time_mapping
- .0
- .into()
- .checked_sub(running_time_utc_time_mapping.1.into())
- .and_then(|res| res.checked_add_unsigned(utc_time))
- .and_then(|res| res.positive())
-}
-
-static CAT: Lazy = Lazy::new(|| {
- gst::DebugCategory::new(
- "fmp4mux",
- gst::DebugColorFlags::empty(),
- Some("FMP4Mux Element"),
- )
-});
-
-const DEFAULT_FRAGMENT_DURATION: gst::ClockTime = gst::ClockTime::from_seconds(10);
-const DEFAULT_CHUNK_DURATION: Option = gst::ClockTime::NONE;
-const DEFAULT_HEADER_UPDATE_MODE: super::HeaderUpdateMode = super::HeaderUpdateMode::None;
-const DEFAULT_WRITE_MFRA: bool = false;
-const DEFAULT_WRITE_MEHD: bool = false;
-const DEFAULT_INTERLEAVE_BYTES: Option = None;
-const DEFAULT_INTERLEAVE_TIME: Option = Some(gst::ClockTime::from_mseconds(250));
-
-#[derive(Debug, Clone)]
-struct Settings {
- fragment_duration: gst::ClockTime,
- chunk_duration: Option,
- header_update_mode: super::HeaderUpdateMode,
- write_mfra: bool,
- write_mehd: bool,
- interleave_bytes: Option,
- interleave_time: Option,
- movie_timescale: u32,
- offset_to_zero: bool,
-}
-
-impl Default for Settings {
- fn default() -> Self {
- Settings {
- fragment_duration: DEFAULT_FRAGMENT_DURATION,
- chunk_duration: DEFAULT_CHUNK_DURATION,
- header_update_mode: DEFAULT_HEADER_UPDATE_MODE,
- write_mfra: DEFAULT_WRITE_MFRA,
- write_mehd: DEFAULT_WRITE_MEHD,
- interleave_bytes: DEFAULT_INTERLEAVE_BYTES,
- interleave_time: DEFAULT_INTERLEAVE_TIME,
- movie_timescale: 0,
- offset_to_zero: false,
- }
- }
-}
-
-#[derive(Debug, Clone)]
-struct PreQueuedBuffer {
- /// Buffer
- ///
- /// Buffer PTS/DTS are updated to the output segment in multi-stream configurations.
- buffer: gst::Buffer,
-
- /// PTS
- ///
- /// In ONVIF mode this is the UTC time, otherwise it is the PTS running time.
- pts: gst::ClockTime,
-
- /// End PTS
- ///
- /// In ONVIF mode this is the UTC time, otherwise it is the PTS running time.
- end_pts: gst::ClockTime,
-
- /// DTS
- ///
- /// In ONVIF mode this is the UTC time, otherwise it is the DTS running time.
- dts: Option>,
-
- /// End DTS
- ///
- /// In ONVIF mode this is the UTC time, otherwise it is the DTS running time.
- end_dts: Option>,
-}
-
-#[derive(Debug)]
-struct GopBuffer {
- buffer: gst::Buffer,
- pts: gst::ClockTime,
- pts_position: gst::ClockTime,
- dts: Option,
-}
-
-#[derive(Debug)]
-struct Gop {
- /// Start PTS.
- start_pts: gst::ClockTime,
- /// Start DTS.
- start_dts: Option,
- /// Earliest PTS.
- earliest_pts: gst::ClockTime,
- /// Once this is known to be the final earliest PTS/DTS
- final_earliest_pts: bool,
- /// PTS plus duration of last buffer, or start of next GOP
- end_pts: gst::ClockTime,
- /// Once this is known to be the final end PTS/DTS
- final_end_pts: bool,
- /// DTS plus duration of last buffer, or start of next GOP
- end_dts: Option,
-
- /// Earliest PTS buffer position
- earliest_pts_position: gst::ClockTime,
-
- /// Buffer, PTS running time, DTS running time
- buffers: Vec,
-}
-
-struct Stream {
- /// Sink pad for this stream.
- sinkpad: super::FMP4MuxPad,
-
- /// Pre-queue for ONVIF variant to timestamp all buffers with their UTC time.
- ///
- /// In non-ONVIF mode this just collects the PTS/DTS and the corresponding running
- /// times for later usage.
- pre_queue: VecDeque,
-
- /// Currently configured caps for this stream.
- caps: gst::Caps,
- /// Whether this stream is intra-only and has frame reordering.
- delta_frames: DeltaFrames,
-
- /// Currently queued GOPs, including incomplete ones.
- queued_gops: VecDeque,
- /// Whether the fully queued GOPs are filling a whole fragment.
- fragment_filled: bool,
- /// Whether a whole chunk is queued.
- chunk_filled: bool,
-
- /// Difference between the first DTS and 0 in case of negative DTS
- dts_offset: Option,
-
- /// Current position (DTS, or PTS for intra-only) to prevent
- /// timestamps from going backwards when queueing new buffers
- current_position: gst::ClockTime,
-
- /// Mapping between running time and UTC time in ONVIF mode.
- running_time_utc_time_mapping: Option<(gst::Signed, gst::ClockTime)>,
-}
-
-#[derive(Default)]
-struct State {
- /// Currently configured streams.
- streams: Vec,
-
- /// Stream header with ftyp and moov box.
- ///
- /// Created once we received caps and kept up to date with the caps,
- /// sent as part of the buffer list for the first fragment.
- stream_header: Option,
-
- /// Sequence number of the current fragment.
- sequence_number: u32,
-
- /// Fragment tracking for mfra box
- current_offset: u64,
- fragment_offsets: Vec,
-
- /// Earliest PTS of the whole stream
- earliest_pts: Option,
- /// Current end PTS of the whole stream
- end_pts: Option,
- /// Start DTS of the whole stream
- start_dts: Option,
-
- /// Start PTS of the current fragment
- fragment_start_pts: Option,
- /// Start PTS of the current chunk
- ///
- /// This is equal to `fragment_start_pts` if the current chunk is the first of a fragment,
- /// and always equal to `fragment_start_pts` if no `chunk_duration` is set.
- chunk_start_pts: Option,
- /// Additional timeout delay in case GOPs are bigger than the fragment duration
- timeout_delay: gst::ClockTime,
-
- /// If headers (ftyp / moov box) were sent.
- sent_headers: bool,
-}
-
-#[derive(Default)]
-pub(crate) struct FMP4Mux {
- state: Mutex,
- settings: Mutex,
-}
-
-impl FMP4Mux {
- /// Checks if a buffer is valid according to the stream configuration.
- fn check_buffer(
- buffer: &gst::BufferRef,
- sinkpad: &super::FMP4MuxPad,
- delta_frames: super::DeltaFrames,
- ) -> Result<(), gst::FlowError> {
- if delta_frames.requires_dts() && buffer.dts().is_none() {
- gst::error!(CAT, obj: sinkpad, "Require DTS for video streams");
- return Err(gst::FlowError::Error);
- }
-
- if buffer.pts().is_none() {
- gst::error!(CAT, obj: sinkpad, "Require timestamped buffers");
- return Err(gst::FlowError::Error);
- }
-
- if delta_frames.intra_only() && buffer.flags().contains(gst::BufferFlags::DELTA_UNIT) {
- gst::error!(CAT, obj: sinkpad, "Intra-only stream with delta units");
- return Err(gst::FlowError::Error);
- }
-
- Ok(())
- }
-
- /// Peek the currently queued buffer on this stream.
- ///
- /// This also determines the PTS/DTS that is finally going to be used, including
- /// timestamp conversion to the UTC times in ONVIF mode.
- fn peek_buffer(
- &self,
- stream: &mut Stream,
- fragment_duration: gst::ClockTime,
- ) -> Result