gst-plugin-gif-0.13.0/.cargo_vcs_info.json0000644000000001470000000000100137530ustar { "git": { "sha1": "2566ddaa22d4bf0f1dfab153432d926c17c1ba63" }, "path_in_vcs": "video/gif" }gst-plugin-gif-0.13.0/Cargo.lock0000644000000537130000000000100117350ustar # This file is automatically @generated by Cargo. # 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 = "atomic_refcell" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41e67cd8309bbd06cd603a9e693a784ac2e5d1e955f11286e355089fcab3047c" [[package]] name = "autocfg" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bumpalo" version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "cc" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8" [[package]] name = "cfg-expr" version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" 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.38" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", "windows-targets", ] [[package]] name = "color_quant" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[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.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[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.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", ] [[package]] name = "futures-core" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", "futures-util", ] [[package]] name = "futures-macro" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "futures-task" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", "futures-macro", "futures-task", "pin-project-lite", "pin-utils", "slab", ] [[package]] name = "gif" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2" dependencies = [ "color_quant", "weezl", ] [[package]] name = "gio-sys" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4feb96b31c32730ea3e1e89aecd2e4e37ecb1c473ad8f685e3430a159419f63" dependencies = [ "glib-sys", "gobject-sys", "libc", "system-deps", "windows-sys", ] [[package]] name = "glib" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fee90a615ce05be7a32932cfb8adf2c4bbb4700e80d37713c981fb24c0c56238" dependencies = [ "bitflags", "futures-channel", "futures-core", "futures-executor", "futures-task", "futures-util", "gio-sys", "glib-macros", "glib-sys", "gobject-sys", "libc", "memchr", "smallvec", "thiserror", ] [[package]] name = "glib-macros" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4da558d8177c0c8c54368818b508a4244e1286fce2858cef4e547023f0cfa5ef" dependencies = [ "heck", "proc-macro-crate", "proc-macro2", "quote", "syn", ] [[package]] name = "glib-sys" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4958c26e5a01c9af00dea669a97369eccbec29a8e6d125c24ea2d85ee7467b60" dependencies = [ "libc", "system-deps", ] [[package]] name = "gobject-sys" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6908864f5ffff15b56df7e90346863904f49b949337ed0456b9287af61903b8" dependencies = [ "glib-sys", "libc", "system-deps", ] [[package]] name = "gst-plugin-gif" version = "0.13.0" dependencies = [ "atomic_refcell", "gif", "gst-plugin-version-helper", "gstreamer", "gstreamer-check", "gstreamer-video", "once_cell", ] [[package]] name = "gst-plugin-version-helper" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e5e874f1660252fd2ec81c602066df3633b3a6fcbe2b196f7f93c27cf069b2a" dependencies = [ "chrono", "toml_edit 0.22.15", ] [[package]] name = "gstreamer" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21e95b1d1153239a621ec143501fdcca6c1ad3efb87d268597285f85c4136f73" dependencies = [ "cfg-if", "futures-channel", "futures-core", "futures-util", "glib", "gstreamer-sys", "itertools", "libc", "muldiv", "num-integer", "num-rational", "once_cell", "option-operations", "paste", "pin-project-lite", "smallvec", "thiserror", ] [[package]] name = "gstreamer-base" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3faa0b3cf361bf538dcb25b5cb7f6e73bd872ed031d85f3997b42d3fbd66409" dependencies = [ "atomic_refcell", "cfg-if", "glib", "gstreamer", "gstreamer-base-sys", "libc", ] [[package]] name = "gstreamer-base-sys" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a6643ef963c636b8022adc93aa19eac6f356bd174a187c499339fc5d64c1e05" dependencies = [ "glib-sys", "gobject-sys", "gstreamer-sys", "libc", "system-deps", ] [[package]] name = "gstreamer-check" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ab79cb5e46d8ff194088ea6438de603cf3598843c981bfa0186f7656dad09e1" dependencies = [ "glib", "gstreamer", "gstreamer-check-sys", ] [[package]] name = "gstreamer-check-sys" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40cd30046385250042032f2dea9b93a039411f58ee69e3b608f7c2f23e280abc" dependencies = [ "glib-sys", "gobject-sys", "gstreamer-sys", "libc", "system-deps", ] [[package]] name = "gstreamer-sys" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c9005b55dd2b1784645963c1ec409f9d420a56f6348d0ae69c2eaff584bcc3" dependencies = [ "glib-sys", "gobject-sys", "libc", "system-deps", ] [[package]] name = "gstreamer-video" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57332bca1ae7825a53fe57d993b63389f132d335aed691ac76f0ffe4304548e3" dependencies = [ "cfg-if", "futures-channel", "glib", "gstreamer", "gstreamer-base", "gstreamer-video-sys", "libc", "once_cell", "thiserror", ] [[package]] name = "gstreamer-video-sys" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f5c334d143384e8dc714af948c2e5d7d12cb588fdcfb56f3bf37c24daf350ef" dependencies = [ "glib-sys", "gobject-sys", "gstreamer-base-sys", "gstreamer-sys", "libc", "system-deps", ] [[package]] name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "iana-time-zone" version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" 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.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown", ] [[package]] name = "itertools" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] [[package]] name = "js-sys" version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] [[package]] name = "libc" version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "log" version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[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.46" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ "num-traits", ] [[package]] name = "num-rational" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ "num-integer", "num-traits", ] [[package]] name = "num-traits" version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[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.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pin-project-lite" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[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.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "proc-macro-crate" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ "toml_edit 0.21.1", ] [[package]] name = "proc-macro2" version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] [[package]] name = "serde" version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "serde_spanned" version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" 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.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" version = "2.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "system-deps" version = "7.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c81f13d9a334a6c242465140bd262fae382b752ff2011c4f7419919a9c97922" dependencies = [ "cfg-expr", "heck", "pkg-config", "toml", "version-compare", ] [[package]] name = "target-lexicon" version = "0.12.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4873307b7c257eddcb50c9bedf158eb669578359fb28428bef438fec8e6ba7c2" [[package]] name = "thiserror" version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "toml" version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" dependencies = [ "serde", "serde_spanned", "toml_datetime", "toml_edit 0.22.15", ] [[package]] name = "toml_datetime" version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" dependencies = [ "serde", ] [[package]] name = "toml_edit" version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ "indexmap", "toml_datetime", "winnow 0.5.40", ] [[package]] name = "toml_edit" version = "0.22.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d59a3a72298453f564e2b111fa896f8d07fabb36f51f06d7e875fc5e0b5a3ef1" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", "winnow 0.6.13", ] [[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.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[package]] name = "wasm-bindgen" version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "weezl" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" [[package]] name = "windows-core" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ "windows-targets", ] [[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.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] [[package]] name = "winnow" version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" dependencies = [ "memchr", ] gst-plugin-gif-0.13.0/Cargo.toml0000644000000032310000000000100117460ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" rust-version = "1.71" name = "gst-plugin-gif" version = "0.13.0" authors = ["Markus Ebner "] description = "GStreamer GIF plugin" license = "MIT OR Apache-2.0" repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs" [package.metadata.capi] min_version = "0.9.21" [package.metadata.capi.header] enabled = false [package.metadata.capi.library] import_library = false install_subdir = "gstreamer-1.0" versioning = false [package.metadata.capi.pkg_config] requires_private = "gstreamer-1.0, gstreamer-video-1.0, gobject-2.0, glib-2.0, gmodule-2.0" [lib] name = "gstgif" crate-type = [ "cdylib", "rlib", ] path = "src/lib.rs" [[example]] name = "testvideosrc2gif" path = "examples/testvideosrc2gif.rs" [dependencies.atomic_refcell] version = "0.1" [dependencies.gif] version = "0.13" [dependencies.gst] version = "0.23" package = "gstreamer" [dependencies.gst-video] version = "0.23" package = "gstreamer-video" [dependencies.once_cell] version = "1" [dev-dependencies.gst-check] version = "0.23" package = "gstreamer-check" [build-dependencies.gst-plugin-version-helper] version = "0.8" [features] capi = [] doc = ["gst/v1_18"] static = [] gst-plugin-gif-0.13.0/Cargo.toml.orig000064400000000000000000000020141046102023000154250ustar 00000000000000[package] name = "gst-plugin-gif" version.workspace = true authors = ["Markus Ebner "] repository.workspace = true license = "MIT OR Apache-2.0" edition.workspace = true rust-version.workspace = true description = "GStreamer GIF plugin" [dependencies] gst.workspace = true gst-video.workspace = true gif = "0.13" atomic_refcell = "0.1" once_cell.workspace = true [dev-dependencies] gst-check.workspace = true [lib] name = "gstgif" crate-type = ["cdylib", "rlib"] path = "src/lib.rs" [[example]] name = "testvideosrc2gif" path = "examples/testvideosrc2gif.rs" [build-dependencies] gst-plugin-version-helper.workspace = true [features] static = [] capi = [] doc = ["gst/v1_18"] [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-video-1.0, gobject-2.0, glib-2.0, gmodule-2.0" gst-plugin-gif-0.13.0/LICENSE-APACHE000064400000000000000000000251371046102023000144750ustar 00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. gst-plugin-gif-0.13.0/LICENSE-MIT000064400000000000000000000017771046102023000142110ustar 00000000000000Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. gst-plugin-gif-0.13.0/build.rs000064400000000000000000000000641046102023000142060ustar 00000000000000fn main() { gst_plugin_version_helper::info() } gst-plugin-gif-0.13.0/examples/testvideosrc2gif.rs000064400000000000000000000027261046102023000202220ustar 00000000000000// Copyright (C) 2020 Markus Ebner // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. // // SPDX-License-Identifier: MIT OR Apache-2.0 use gst::prelude::*; const ENCODE_PIPELINE: &str = "videotestsrc is-live=false num-buffers=100 ! videoconvert ! gifenc ! filesink location=test.gif"; fn main() { gst::init().unwrap(); gstgif::plugin_register_static().expect("Failed to register gif plugin"); let pipeline = gst::parse::launch(ENCODE_PIPELINE).unwrap(); let bus = pipeline.bus().unwrap(); pipeline .set_state(gst::State::Playing) .expect("Failed to set pipeline state to playing"); for msg in bus.iter_timed(gst::ClockTime::NONE) { use gst::MessageView; match msg.view() { MessageView::Eos(..) => break, MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", err.src().map(|s| s.path_string()), err.error(), err.debug() ); break; } _ => (), } } pipeline .set_state(gst::State::Null) .expect("Failed to set pipeline state to null"); } gst-plugin-gif-0.13.0/src/gifenc/imp.rs000064400000000000000000000366751046102023000157370ustar 00000000000000// Copyright (C) 2020 Markus Ebner // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. // // SPDX-License-Identifier: MIT OR Apache-2.0 use atomic_refcell::AtomicRefCell; use gst::glib; use gst::subclass::prelude::*; use gst_video::prelude::*; use gst_video::subclass::prelude::*; use gst_video::VideoFormat; use once_cell::sync::Lazy; use std::{ io, io::Write, sync::{Arc, Mutex}, }; const DEFAULT_REPEAT: i32 = 0; const DEFAULT_SPEED: i32 = 10; /// The gif::Encoder requires a std::io::Write implementation, to which it /// can save the generated gif. This struct is used as a temporary cache, into /// which the encoder can write encoded frames, such that we can read them back /// and commit them to the gstreamer pipeline. struct CacheBuffer { buffer: AtomicRefCell>, } impl CacheBuffer { pub fn new() -> Self { Self { buffer: AtomicRefCell::new(Vec::new()), } } pub fn clear(&self) { self.buffer.borrow_mut().clear(); } pub fn write(&self, buf: &[u8]) -> io::Result { let mut buffer = self.buffer.borrow_mut(); buffer.write(buf) } pub fn consume(&self) -> Vec { let mut buffer = self.buffer.borrow_mut(); std::mem::take(&mut *buffer) } } /// Writer for a CacheBuffer instance. This class is passed to the gif::Encoder. /// Everything written to the CacheBufferWriter is stored in the underlying CacheBuffer. struct CacheBufferWriter { cache_buffer: Arc, } impl CacheBufferWriter { pub fn new(cache_buffer: Arc) -> Self { Self { cache_buffer } } } impl Write for CacheBufferWriter { fn write(&mut self, buf: &[u8]) -> io::Result { self.cache_buffer.write(buf) } fn flush(&mut self) -> io::Result<()> { Ok(()) } } #[derive(Debug, Clone, Copy)] struct Settings { repeat: i32, speed: i32, } impl Default for Settings { fn default() -> Self { Settings { repeat: DEFAULT_REPEAT, speed: DEFAULT_SPEED, } } } struct State { video_info: gst_video::VideoInfo, cache: Arc, gif_pts: Option, last_actual_pts: Option, context: Option>, } impl State { pub fn new(video_info: gst_video::VideoInfo) -> Self { Self { video_info, cache: Arc::new(CacheBuffer::new()), gif_pts: None, last_actual_pts: None, context: None, } } pub fn reset(&mut self, settings: Settings) { self.cache.clear(); self.gif_pts = None; self.last_actual_pts = None; // initialize and configure encoder with a CacheBufferWriter pointing // to our CacheBuffer instance let mut encoder = gif::Encoder::new( CacheBufferWriter::new(self.cache.clone()), self.video_info.width() as u16, self.video_info.height() as u16, &[], ) .expect("Failed to initialize GIF encoder"); match settings.repeat { -1 => encoder.set_repeat(gif::Repeat::Infinite), _ => encoder.set_repeat(gif::Repeat::Finite(settings.repeat as u16)), } .expect("Failed to configure encoder"); self.context = Some(encoder); } } #[derive(Default)] pub struct GifEnc { state: AtomicRefCell>, settings: Mutex, } static CAT: Lazy = Lazy::new(|| { gst::DebugCategory::new("gifenc", gst::DebugColorFlags::empty(), Some("GIF encoder")) }); #[glib::object_subclass] impl ObjectSubclass for GifEnc { const NAME: &'static str = "GstGifEnc"; type Type = super::GifEnc; type ParentType = gst_video::VideoEncoder; } impl ObjectImpl for GifEnc { fn properties() -> &'static [glib::ParamSpec] { static PROPERTIES: Lazy> = Lazy::new(|| { vec![ glib::ParamSpecInt::builder("repeat") .nick("Repeat") .blurb("Repeat (-1 to loop forever, 0 .. n finite repetitions)") .minimum(-1) .maximum(u16::MAX as i32) .default_value(DEFAULT_REPEAT) .mutable_ready() .build(), glib::ParamSpecInt::builder("speed") .nick("Speed") .blurb("Speed (1 .. 30; higher value yields faster encoding)") .minimum(1) .maximum(30) .default_value(DEFAULT_SPEED) .mutable_ready() .build(), ] }); PROPERTIES.as_ref() } fn set_property(&self, _id: usize, value: &glib::Value, pspec: &glib::ParamSpec) { match pspec.name() { "repeat" => { let mut settings = self.settings.lock().unwrap(); settings.repeat = value.get().expect("type checked upstream"); } "speed" => { let mut settings = self.settings.lock().unwrap(); settings.speed = value.get().expect("type checked upstream"); } _ => unimplemented!(), } } fn property(&self, _id: usize, pspec: &glib::ParamSpec) -> glib::Value { match pspec.name() { "repeat" => { let settings = self.settings.lock().unwrap(); settings.repeat.to_value() } "speed" => { let settings = self.settings.lock().unwrap(); settings.speed.to_value() } _ => unimplemented!(), } } } impl GstObjectImpl for GifEnc {} impl ElementImpl for GifEnc { fn metadata() -> Option<&'static gst::subclass::ElementMetadata> { static ELEMENT_METADATA: Lazy = Lazy::new(|| { gst::subclass::ElementMetadata::new( "GIF encoder", "Encoder/Video", "GIF encoder", "Markus Ebner ", ) }); Some(&*ELEMENT_METADATA) } fn pad_templates() -> &'static [gst::PadTemplate] { static PAD_TEMPLATES: Lazy> = Lazy::new(|| { let sink_caps = gst_video::VideoCapsBuilder::new() .format_list([VideoFormat::Rgb, VideoFormat::Rgba]) // frame-delay timing in gif is a multiple of 10ms -> max 100fps .framerate_range(gst::Fraction::from(1)..gst::Fraction::from(100)) .build(); let sink_pad_template = gst::PadTemplate::new( "sink", gst::PadDirection::Sink, gst::PadPresence::Always, &sink_caps, ) .unwrap(); let src_caps = gst::Caps::builder("image/gif").build(); let src_pad_template = gst::PadTemplate::new( "src", gst::PadDirection::Src, gst::PadPresence::Always, &src_caps, ) .unwrap(); vec![src_pad_template, sink_pad_template] }); PAD_TEMPLATES.as_ref() } } impl VideoEncoderImpl for GifEnc { fn stop(&self) -> Result<(), gst::ErrorMessage> { *self.state.borrow_mut() = None; Ok(()) } fn propose_allocation( &self, query: &mut gst::query::Allocation, ) -> Result<(), gst::LoggableError> { query.add_allocation_meta::(None); self.parent_propose_allocation(query) } fn set_format( &self, state: &gst_video::VideoCodecState<'static, gst_video::video_codec_state::Readable>, ) -> Result<(), gst::LoggableError> { self.flush_encoder() .map_err(|_| gst::loggable_error!(CAT, "Failed to drain"))?; let video_info = state.info(); gst::debug!(CAT, imp = self, "Setting format {:?}", video_info); { let mut state = State::new(video_info); let settings = self.settings.lock().unwrap(); state.reset(*settings); *self.state.borrow_mut() = Some(state); } let instance = self.obj(); let output_state = instance .set_output_state(gst::Caps::builder("image/gif").build(), Some(state)) .map_err(|_| gst::loggable_error!(CAT, "Failed to set output state"))?; instance .negotiate(output_state) .map_err(|_| gst::loggable_error!(CAT, "Failed to negotiate"))?; self.parent_set_format(state) } fn finish(&self) -> Result { self.flush_encoder() } fn handle_frame( &self, mut frame: gst_video::VideoCodecFrame, ) -> Result { let mut state_guard = self.state.borrow_mut(); let state = state_guard.as_mut().ok_or(gst::FlowError::NotNegotiated)?; gst::debug!( CAT, imp = self, "Sending frame {}", frame.system_frame_number() ); let input_buffer = frame.input_buffer().expect("frame without input buffer"); { let in_frame = gst_video::VideoFrameRef::from_buffer_ref_readable(input_buffer, &state.video_info) .map_err(|_| { gst::element_imp_error!( self, gst::CoreError::Failed, ["Failed to map output buffer readable"] ); gst::FlowError::Error })?; let frame_width = in_frame.info().width(); let frame_height = in_frame.info().height(); // Calculate delay to new frame by calculating the difference between the current actual // presentation timestamp of the last frame within the gif, and the pts of the new frame. // This results in variable frame delays in the gif - but an overall constant fps. let pts = in_frame.buffer().pts(); state.last_actual_pts = pts; if state.gif_pts.is_none() { // First frame: use pts of first input frame as origin state.gif_pts = pts; } let pts = pts.ok_or_else(|| { gst::element_imp_error!( self, gst::CoreError::Failed, ["No PTS set on input frame. Unable to calculate proper frame timing."] ); gst::FlowError::Error })?; let frame_delay = pts .checked_sub(state.gif_pts.expect("checked above")) .ok_or_else(|| { gst::element_imp_error!( self, gst::CoreError::Failed, ["Input frame PTS is greater than gif_pts. Unable to calculate proper frame timing."] ); gst::FlowError::Error })?; let settings = self.settings.lock().unwrap(); let mut raw_frame = tightly_packed_framebuffer(&in_frame); let mut gif_frame = match in_frame.info().format() { gst_video::VideoFormat::Rgb => gif::Frame::from_rgb_speed( frame_width as u16, frame_height as u16, &raw_frame, settings.speed, ), gst_video::VideoFormat::Rgba => gif::Frame::from_rgba_speed( frame_width as u16, frame_height as u16, &mut raw_frame, settings.speed, ), _ => unreachable!(), }; // apply encoding settings to frame (gif uses multiples of 10ms as frame_delay) // use float arithmetic with rounding for this calculation, since small stuttering // is probably less visible than the large stuttering when a complete 10ms have to // "catch up". gif_frame.delay = (frame_delay.mseconds() as f32 / 10.0).round() as u16; state.gif_pts = state .gif_pts .opt_add((gif_frame.delay as u64 * 10).mseconds()); // encode new frame let context = state.context.as_mut().unwrap(); if let Err(e) = context.write_frame(&gif_frame) { gst::element_imp_error!(self, gst::CoreError::Failed, ["{e}"]); return Err(gst::FlowError::Error); } } // The encoder directly outputs one frame for each input frame // Since the output is directly available, we can re-use the input frame // to push results to the pipeline let buffer = state.cache.consume(); // Avoid keeping the state locked while calling finish_frame() drop(state_guard); let output_buffer = gst::Buffer::from_mut_slice(buffer); // Currently not using incremental frames -> every frame is a keyframe frame.set_flags(gst_video::VideoCodecFrameFlags::SYNC_POINT); frame.set_output_buffer(output_buffer); self.obj().finish_frame(frame) } } impl GifEnc { fn flush_encoder(&self) -> Result { gst::debug!(CAT, imp = self, "Flushing"); let trailer_buffer = self.state.borrow_mut().as_mut().map(|state| { // Drop encoder to flush and take flushed data (gif trailer) state.context = None; let buffer = state.cache.consume(); // reset internal state let settings = self.settings.lock().unwrap(); // manually produce a let mut trailer_buffer = gst::Buffer::from_mut_slice(buffer); { let trailer_buffer = trailer_buffer.get_mut().unwrap(); trailer_buffer.set_pts(state.last_actual_pts); } // Initialize the encoder again, to be ready for a new round without format change state.reset(*settings); // return the constructed buffer containing the gif trailer trailer_buffer }); if let Some(trailer_buffer) = trailer_buffer { // manually push GIF trailer to the encoder's src pad self.obj().src_pad().push(trailer_buffer)?; } Ok(gst::FlowSuccess::Ok) } } /// Helper method that takes a gstreamer video-frame and copies it into a /// tightly packed rgb(a) buffer, ready for consumption by the gif encoder. fn tightly_packed_framebuffer(frame: &gst_video::VideoFrameRef<&gst::BufferRef>) -> Vec { assert_eq!(frame.n_planes(), 1); // RGB and RGBA are tightly packed let line_size = (frame.width() * frame.n_components()) as usize; let line_stride = frame.plane_stride()[0] as usize; let mut raw_frame: Vec = Vec::with_capacity(line_size * frame.info().height() as usize); // copy gstreamer frame to tightly packed rgb(a) frame. frame .plane_data(0) .unwrap() .chunks_exact(line_stride) .map(|padded_line| &padded_line[..line_size]) .for_each(|line| raw_frame.extend_from_slice(line)); raw_frame } gst-plugin-gif-0.13.0/src/gifenc/mod.rs000064400000000000000000000014341046102023000157120ustar 00000000000000// Copyright (C) 2020 Markus Ebner // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. // // SPDX-License-Identifier: MIT OR Apache-2.0 use gst::glib; use gst::prelude::*; mod imp; glib::wrapper! { pub struct GifEnc(ObjectSubclass) @extends gst_video::VideoEncoder, gst::Element, gst::Object; } pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), "gifenc", gst::Rank::PRIMARY, GifEnc::static_type(), ) } gst-plugin-gif-0.13.0/src/lib.rs000064400000000000000000000016571046102023000144550ustar 00000000000000// Copyright (C) 2020 Markus Ebner // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. // // SPDX-License-Identifier: MIT OR Apache-2.0 #![allow(clippy::non_send_fields_in_send_ty, unused_doc_comments)] /** * plugin-gif: * * Since: plugins-rs-0.6.0 */ use gst::glib; mod gifenc; fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gifenc::register(plugin) } gst::plugin_define!( gif, env!("CARGO_PKG_DESCRIPTION"), plugin_init, concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")), "MIT/X11", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_NAME"), env!("CARGO_PKG_REPOSITORY"), env!("BUILD_REL_DATE") ); gst-plugin-gif-0.13.0/tests/gifenc.rs000064400000000000000000000040451046102023000155070ustar 00000000000000// Copyright (C) 2020 Markus Ebner // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. // // SPDX-License-Identifier: MIT OR Apache-2.0 use gst::prelude::*; fn init() { use std::sync::Once; static INIT: Once = Once::new(); INIT.call_once(|| { gst::init().unwrap(); gstgif::plugin_register_static().expect("gif test"); }); } #[test] fn test_encode_rgba() { init(); let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::Rgba, 160, 120) .fps((30, 1)) .build() .unwrap(); test_encode(&video_info); } #[test] fn test_encode_rgb() { init(); let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::Rgb, 160, 120) .fps((30, 1)) .build() .unwrap(); test_encode(&video_info); } fn test_encode(video_info: &gst_video::VideoInfo) { let mut h = gst_check::Harness::new("gifenc"); h.set_src_caps(video_info.to_caps().unwrap()); for pts in 0..5 { let buffer = { let mut buffer = gst::Buffer::with_size(video_info.size()).unwrap(); { let buffer = buffer.get_mut().unwrap(); buffer.set_pts(pts.seconds()); } let mut vframe = gst_video::VideoFrame::from_buffer_writable(buffer, video_info).unwrap(); for v in vframe.plane_data_mut(0).unwrap() { *v = 128; } vframe.into_buffer() }; h.push(buffer.clone()).unwrap(); } h.push_event(gst::event::Eos::new()); for _ in 0..6 { // last frame is the GIF trailer let buffer = h.pull().unwrap(); // Currently, every frame should be a full frame assert!(!buffer.flags().contains(gst::BufferFlags::DELTA_UNIT)) } }