gstreamer-play-0.24.0/.cargo_vcs_info.json0000644000000001540000000000100140530ustar { "git": { "sha1": "ef17224f7a88b01d788c7ebc81a85d10df5f09a1" }, "path_in_vcs": "gstreamer-play" }gstreamer-play-0.24.0/CHANGELOG.md000064400000000000000000000000311046102023000144460ustar 00000000000000../gstreamer/CHANGELOG.mdgstreamer-play-0.24.0/COPYRIGHT000064400000000000000000000000141046102023000141310ustar 00000000000000../COPYRIGHTgstreamer-play-0.24.0/Cargo.lock0000644000000417000000000000100120300ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 4 [[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.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "bitflags" version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "cfg-expr" version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a2b34126159980f92da2a08bdec0694fd80fb5eb9e48aff25d20a0d8dfa710d" dependencies = [ "smallvec", "target-lexicon", ] [[package]] name = "cfg-if" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "futures-channel" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", ] [[package]] name = "futures-core" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", "futures-util", ] [[package]] name = "futures-macro" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "futures-task" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-core", "futures-macro", "futures-task", "pin-project-lite", "pin-utils", "slab", ] [[package]] name = "gio-sys" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c8130f5810a839d74afc3a929c34a700bf194972bb034f2ecfe639682dd13cc" dependencies = [ "glib-sys", "gobject-sys", "libc", "system-deps", "windows-sys", ] [[package]] name = "gir-format-check" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a5da913a8586ce748f1164c890e1ebe75a7bbc472668f57b7f9fb893d7ac416" [[package]] name = "glib" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "690e8bcf8a819b5911d6ae79879226191d01253a4f602748072603defd5b9553" dependencies = [ "bitflags", "futures-channel", "futures-core", "futures-executor", "futures-task", "futures-util", "gio-sys", "glib-macros", "glib-sys", "gobject-sys", "libc", "memchr", "smallvec", ] [[package]] name = "glib-macros" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e772291ebea14c28eb11bb75741f62f4a4894f25e60ce80100797b6b010ef0f9" dependencies = [ "heck", "proc-macro-crate", "proc-macro2", "quote", "syn", ] [[package]] name = "glib-sys" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b2be4c74454fb4a6bd3328320737d0fa3d6939e2d570f5d846da00cb222f6a0" dependencies = [ "libc", "system-deps", ] [[package]] name = "gobject-sys" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab318a786f9abd49d388013b9161fa0ef8218ea6118ee7111c95e62186f7d31f" dependencies = [ "glib-sys", "libc", "system-deps", ] [[package]] name = "gstreamer" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1394d2bb79b4e7a662329c0afbb0f4be528f9a2289d094a31b4bd308e8c0972a" dependencies = [ "cfg-if", "futures-channel", "futures-core", "futures-util", "glib", "gstreamer-sys", "itertools", "kstring", "libc", "muldiv", "num-integer", "num-rational", "option-operations", "paste", "pin-project-lite", "smallvec", "thiserror", ] [[package]] name = "gstreamer-base" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34745d3726a080e0d57e402a314e37073d0b341f3a5754258550311ca45e4754" dependencies = [ "atomic_refcell", "cfg-if", "glib", "gstreamer", "gstreamer-base-sys", "libc", ] [[package]] name = "gstreamer-base-sys" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfad00fa63ddd8132306feef9d5095a3636192f09d925adfd0a9be0d82b9ea91" dependencies = [ "glib-sys", "gobject-sys", "gstreamer-sys", "libc", "system-deps", ] [[package]] name = "gstreamer-play" version = "0.24.0" dependencies = [ "gir-format-check", "glib", "gstreamer", "gstreamer-play-sys", "gstreamer-video", "libc", ] [[package]] name = "gstreamer-play-sys" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c7d544269864b671235410387b851ba6ca63c91b2ed616188df8f7f1233377c" dependencies = [ "glib-sys", "gobject-sys", "gstreamer-sys", "gstreamer-video-sys", "libc", "system-deps", ] [[package]] name = "gstreamer-sys" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36f46b35f9dc4b5a0dca3f19d2118bb5355c3112f228a99a84ed555f48ce5cf9" dependencies = [ "cfg-if", "glib-sys", "gobject-sys", "libc", "system-deps", ] [[package]] name = "gstreamer-video" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7f312d41e9b1d830fb60bcfb68234ff00f8933cbb27a1179bde81e0241cb863" dependencies = [ "cfg-if", "futures-channel", "glib", "gstreamer", "gstreamer-base", "gstreamer-video-sys", "libc", "thiserror", ] [[package]] name = "gstreamer-video-sys" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14e259906ee2ad72201a1977815be4493a66a64f19c6f2efa3e7f93c27add4a5" dependencies = [ "glib-sys", "gobject-sys", "gstreamer-base-sys", "gstreamer-sys", "libc", "system-deps", ] [[package]] name = "hashbrown" version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "indexmap" version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" dependencies = [ "equivalent", "hashbrown", ] [[package]] name = "itertools" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" dependencies = [ "either", ] [[package]] name = "kstring" version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "558bf9508a558512042d3095138b1f7b8fe90c5467d94f9f1da28b3731c5dbd1" dependencies = [ "static_assertions", ] [[package]] name = "libc" version = "0.2.174" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" [[package]] name = "memchr" version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[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 = "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.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[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.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "proc-macro-crate" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" dependencies = [ "toml_edit", ] [[package]] name = "proc-macro2" version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] [[package]] name = "serde" version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "serde_spanned" version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" dependencies = [ "serde", ] [[package]] name = "slab" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" [[package]] name = "smallvec" version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "syn" version = "2.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "system-deps" version = "7.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4be53aa0cba896d2dc615bd42bbc130acdcffa239e0a2d965ea5b3b2a86ffdb" dependencies = [ "cfg-expr", "heck", "pkg-config", "toml", "version-compare", ] [[package]] name = "target-lexicon" version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a" [[package]] name = "thiserror" version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "toml" version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" dependencies = [ "serde", "serde_spanned", "toml_datetime", "toml_edit", ] [[package]] name = "toml_datetime" version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" dependencies = [ "serde", ] [[package]] name = "toml_edit" version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", "winnow", ] [[package]] name = "unicode-ident" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "version-compare" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[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.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95" dependencies = [ "memchr", ] gstreamer-play-0.24.0/Cargo.toml0000644000000042540000000000100120560ustar # 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.83" name = "gstreamer-play" version = "0.24.0" authors = ["Sebastian Dröge "] build = false autolib = false autobins = false autoexamples = false autotests = false autobenches = false description = "Rust bindings for GStreamer Play library" homepage = "https://gstreamer.freedesktop.org" documentation = "https://gstreamer.freedesktop.org/documentation/rust/stable/latest/docs/gstreamer_play/" readme = "README.md" keywords = [ "gstreamer", "multimedia", "audio", "video", "gnome", ] categories = [ "api-bindings", "multimedia", ] license = "MIT OR Apache-2.0" repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" [package.metadata.docs.rs] all-features = true rustc-args = [ "--cfg", "docsrs", ] rustdoc-args = [ "--cfg", "docsrs", "--generate-link-to-definition", ] [features] v1_22 = [ "gst/v1_22", "gst-video/v1_22", "gstreamer-play-sys/v1_22", ] v1_24 = [ "gst/v1_24", "gst-video/v1_24", "gstreamer-play-sys/v1_24", "v1_22", ] v1_26 = [ "gst/v1_26", "gst-video/v1_26", "gstreamer-play-sys/v1_26", "v1_24", ] v1_28 = [ "gst/v1_28", "gst-video/v1_28", "gstreamer-play-sys/v1_28", "v1_26", ] [lib] name = "gstreamer_play" path = "src/lib.rs" [[test]] name = "check_gir" path = "tests/check_gir.rs" [dependencies.glib] version = "0.21" [dependencies.gst] version = "0.24" features = ["v1_20"] package = "gstreamer" [dependencies.gst-video] version = "0.24" features = ["v1_20"] package = "gstreamer-video" [dependencies.gstreamer-play-sys] version = "0.24" [dependencies.libc] version = "0.2" [dev-dependencies.gir-format-check] version = "0.1" gstreamer-play-0.24.0/Cargo.toml.orig000064400000000000000000000023271046102023000155360ustar 00000000000000[package] name = "gstreamer-play" authors = ["Sebastian Dröge "] description = "Rust bindings for GStreamer Play library" license = "MIT OR Apache-2.0" readme = "README.md" documentation = "https://gstreamer.freedesktop.org/documentation/rust/stable/latest/docs/gstreamer_play/" keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"] version.workspace = true categories.workspace = true repository.workspace = true homepage.workspace = true edition.workspace = true rust-version.workspace = true [dependencies] libc = "0.2" gstreamer-play-sys.workspace = true glib.workspace = true gst = { workspace = true, features = ["v1_20"] } gst-video = { workspace = true, features = ["v1_20"] } [dev-dependencies] gir-format-check = "0.1" [features] v1_22 = ["gst/v1_22", "gst-video/v1_22", "gstreamer-play-sys/v1_22"] v1_24 = ["gst/v1_24", "gst-video/v1_24", "gstreamer-play-sys/v1_24", "v1_22"] v1_26 = ["gst/v1_26", "gst-video/v1_26", "gstreamer-play-sys/v1_26", "v1_24"] v1_28 = ["gst/v1_28", "gst-video/v1_28", "gstreamer-play-sys/v1_28", "v1_26"] [package.metadata.docs.rs] all-features = true rustc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] gstreamer-play-0.24.0/Gir.toml000064400000000000000000000130061046102023000142610ustar 00000000000000[options] girs_directories = ["../gir-files", "../gst-gir-files"] library = "GstPlay" version = "1.0" min_cfg_version = "1.20" work_mode = "normal" concurrency = "send+sync" generate_safety_asserts = true single_version_file = true generate_display_trait = false trust_return_value_nullability = true external_libraries = [ "GLib", "GObject", "Gst", ] generate = [ "GstPlay.PlayColorBalanceType", "GstPlay.PlayError", "GstPlay.PlayMediaInfo", "GstPlay.PlaySnapshotFormat", "GstPlay.PlayState", "GstPlay.PlayStreamInfo", "GstPlay.PlayVideoRenderer", "GstPlay.PlayVisualization", ] manual = [ "GLib.Error", "GLib.MainContext", "GObject.Object", "Gst.Element", "Gst.Object", "GstVideo.VideoMultiviewFlags", "GstVideo.VideoMultiviewFramePacking", ] [[object]] name = "Gst.Bus" status = "manual" ref_mode = "ref" [[object]] name = "Gst.Caps" status = "manual" ref_mode = "ref" [[object]] name = "Gst.ClockTime" status = "manual" conversion_type = "Option" [[object]] name = "Gst.Message" status = "manual" ref_mode = "ref" [[object]] name = "Gst.Sample" status = "manual" ref_mode = "ref" [[object]] name = "Gst.Structure" status = "manual" ref_mode = "ref" [[object]] name = "Gst.TagList" status = "manual" ref_mode = "ref" [[object]] name = "GstPlay.Play" status = "generate" final_type = true [[object.function]] name = "visualizations_free" # correct mutability ignore = true [[object.function]] name = "set_config" # Custom type manual = true [[object.function]] name = "get_config" # Custom type manual = true [[object.function]] pattern = "config_.*" # Custom type ignore = true [[object.function]] name = "seek" [[object.function.parameter]] name = "position" mandatory = true [[object.function]] name = "set_audio_track" [object.function.return] bool_return_is_error = "Failed to set audio track" [[object.function]] name = "set_subtitle_track" [object.function.return] bool_return_is_error = "Failed to set subtitle track" [[object.function]] name = "set_video_track" [object.function.return] bool_return_is_error = "Failed to set video track" [[object.function]] name = "set_visualization" [object.function.return] bool_return_is_error = "Failed to set visualization" [[object.function]] name = "get_video_snapshot" # &StructureRef manual = true [[object.function]] name = "set_audio_track_id" [object.function.return] bool_return_is_error = "Failed to set audio track" [[object.function]] name = "set_video_track_id" [object.function.return] bool_return_is_error = "Failed to set video track" [[object.function]] name = "set_subtitle_track_id" [object.function.return] bool_return_is_error = "Failed to set subtitle track" [[object.function]] name = "set_track_ids" [object.function.return] bool_return_is_error = "Failed to set tracks" [[object]] name = "GstPlay.PlayAudioInfo" status = "generate" final_type = true [[object]] name = "GstPlay.PlayMessage" status = "generate" final_type = true visibility = "crate" [[object.function]] name = "parse_error_missing_plugin" manual = true [[object.function]] name = "parse_warning_missing_plugin" manual = true [[object.function]] name = "get_uri" manual = true [[object.function]] name = "get_stream_id" manual = true [[object]] name = "GstPlay.PlaySignalAdapter" status = "generate" final_type = true [[object.signal]] name = "buffering" concurrency = "send" [[object.signal]] name = "duration-changed" concurrency = "send" # Pass ClockTime instead of u64 manual = true [[object.signal]] name = "end-of-stream" concurrency = "send" [[object.signal]] name = "error" concurrency = "send" [[object.signal]] name = "media-info-updated" concurrency = "send" [[object.signal]] name = "mute-changed" concurrency = "send" [[object.signal]] name = "position-updated" concurrency = "send" # Pass ClockTime instead of u64 manual = true [[object.signal]] name = "seek-done" concurrency = "send" # Pass ClockTime instead of u64 manual = true [[object.signal]] name = "state-changed" concurrency = "send" [[object.signal]] name = "uri-loaded" concurrency = "send" [[object.signal]] name = "video-dimensions-changed" concurrency = "send" [[object.signal]] name = "volume-changed" concurrency = "send" [[object.signal]] name = "warning" concurrency = "send" [[object]] name = "GstPlay.PlaySubtitleInfo" status = "generate" final_type = true [[object]] name = "GstPlay.PlayVideoInfo" status = "generate" final_type = true [[object.function]] name = "get_framerate" # Fraction manual = true [[object.function]] name = "get_pixel_aspect_ratio" # Fraction manual = true [[object]] name = "GstPlay.PlayVideoOverlayVideoRenderer" status = "generate" final_type = true [[object.function]] name = "new" manual = true [[object.function]] name = "new_with_sink" # with_handle_and_sink() also calls this. rename = "with_sink" manual = true [[object.function]] name = "get_window_handle" manual = true [[object.function]] name = "set_window_handle" manual = true gstreamer-play-0.24.0/LICENSE-APACHE000064400000000000000000000000211046102023000145600ustar 00000000000000../LICENSE-APACHEgstreamer-play-0.24.0/LICENSE-MIT000064400000000000000000000000161046102023000142740ustar 00000000000000../LICENSE-MITgstreamer-play-0.24.0/README.md000064400000000000000000000176621046102023000141360ustar 00000000000000# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-play.svg)](https://crates.io/crates/gstreamer-play) [![pipeline status](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/badges/main/pipeline.svg)](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/commits/main) [GStreamer](https://gstreamer.freedesktop.org/) (Play library) bindings for Rust. Documentation can be found [here](https://gstreamer.freedesktop.org/documentation/rust/stable/latest/docs/gstreamer_play/). These bindings are providing a safe API that can be used to interface with GStreamer, e.g. for writing GStreamer-based applications and GStreamer plugins. The bindings are mostly autogenerated with [gir](https://github.com/gtk-rs/gir/) based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/) API metadata provided by the GStreamer project. ## Table of Contents 1. [Installation](#installation) 1. [Linux/BSDs](#installation-linux) 1. [macOS](#installation-macos) 1. [Windows](#installation-windows) 1. [Getting Started](#getting-started) 1. [License](#license) 1. [Contribution](#contribution) ## Installation To build the GStreamer bindings or anything depending on them, you need to have at least GStreamer 1.14 and gst-plugins-base 1.14 installed. In addition, some of the examples/tutorials require various GStreamer plugins to be available, which can be found in gst-plugins-base, gst-plugins-good, gst-plugins-bad, gst-plugins-ugly and/or gst-libav. ### Linux/BSDs You need to install the above mentioned packages with your distributions package manager, or build them from source. On Debian/Ubuntu they can be installed with ```console $ apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \ gstreamer1.0-plugins-base gstreamer1.0-plugins-good \ gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \ gstreamer1.0-libav libgstrtspserver-1.0-dev libges-1.0-dev ``` The minimum required version of the above libraries is >= 1.14. If you build the gstreamer-play sub-crate, or any of the examples that depend on gstreamer-play, you must ensure that in addition to the above packages, `libgstreamer-plugins-bad1.0-dev` is installed. See the `Cargo.toml` files for the full details, ```console $ apt-get install libgstreamer-plugins-bad1.0-dev ``` Package names on other distributions should be similar. Please submit a pull request with instructions for yours. ### macOS You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/) provided by the GStreamer project. We recommend using the official GStreamer binaries over Homebrew, especially as GStreamer in Homebrew is [currently broken](https://github.com/orgs/Homebrew/discussions/3740#discussioncomment-3804964). #### GStreamer Binaries You need to download the *two* `.pkg` files from the GStreamer website and install them, e.g. `gstreamer-1.0-1.20.4-universal.pkg` and `gstreamer-1.0-devel-1.20.4-universal.pkg`. After installation, you also need to set the `PATH` environment variable as follows ```console $ export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}" ``` Also note that the `pkg-config` from GStreamer should be the first one in the `PATH` as other versions have all kinds of quirks that will cause problems. #### Homebrew Homebrew only installs various plugins if explicitly enabled, so some extra `--with-*` flags may be required. ```console $ brew install gstreamer gst-plugins-base gst-plugins-good \ gst-plugins-bad gst-plugins-ugly gst-libav gst-rtsp-server \ gst-editing-services --with-orc --with-libogg --with-opus \ --with-pango --with-theora --with-libvorbis --with-libvpx \ --enable-gtk3 ``` Make sure the version of these libraries is >= 1.14. ### Windows You can install GStreamer and the plugins via [MSYS2](http://www.msys2.org/) with `pacman` or by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by the GStreamer project. We recommend using the official GStreamer binaries over MSYS2. #### GStreamer Binaries You need to download the *two* `.msi` files for your platform from the GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.20.4.msi` and `gstreamer-1.0-devel-x86_64-1.20.4.msi`. Make sure to select the version that matches your Rust toolchain, i.e. MinGW or MSVC. After installation set the ``PATH` environment variable as follows: ```console # For a UNIX-style shell: $ export PATH="c:/gstreamer/1.0/msvc_x86_64/bin${PATH:+:$PATH}" # For cmd.exe: $ set PATH=C:\gstreamer\1.0\msvc_x86_64\bin;%PATH% ``` Make sure to update the path to where you have actually installed GStreamer and for the corresponding toolchain. Also note that the `pkg-config.exe` from GStreamer should be the first one in the `PATH` as other versions have all kinds of quirks that will cause problems. #### MSYS2 / pacman ```console $ pacman -S glib2-devel pkg-config \ mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \ mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \ mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav \ mingw-w64-x86_64-gst-rtsp-server ``` Make sure the version of these libraries is >= 1.14. Note that the version of `pkg-config` included in `MSYS2` is [known to have problems](https://github.com/rust-lang/pkg-config-rs/issues/51#issuecomment-346300858) compiling GStreamer, so you may need to install another version. One option would be [`pkg-config-lite`](https://sourceforge.net/projects/pkgconfiglite/). ## Getting Started The API reference can be found [here](https://gstreamer.freedesktop.org/documentation/rust/stable/latest/docs/gstreamer/), however it is only the Rust API reference and does not explain any of the concepts. For getting started with GStreamer development, the best would be to follow the [documentation](https://gstreamer.freedesktop.org/documentation/) on the GStreamer website, especially the [Application Development Manual](https://gstreamer.freedesktop.org/documentation/application-development/). While being C-centric, it explains all the fundamental concepts of GStreamer and the code examples should be relatively easily translatable to Rust. The API is basically the same, function/struct names are the same and everything is only more convenient (hopefully) and safer. In addition there are [tutorials](https://gstreamer.freedesktop.org/documentation/tutorials/) on the GStreamer website. Many of them were ported to Rust already and the code can be found in the [tutorials](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/tutorials) directory. Some further examples for various aspects of GStreamer and how to use it from Rust can be found in the [examples](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/examples) directory. Various GStreamer plugins written in Rust can be found in the [gst-plugins-rs](https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs) repository. ## LICENSE gstreamer-rs and all crates contained in here are licensed under either of * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) at your option. GStreamer itself is licensed under the Lesser General Public License version 2.1 or (at your option) any later version: https://www.gnu.org/licenses/lgpl-2.1.html ## Contribution Any kinds of contributions are welcome as a pull request. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in gstreamer-rs by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. gstreamer-play-0.24.0/src/auto/enums.rs000064400000000000000000000576171046102023000161170ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::{ffi, PlayMediaInfo}; use glib::{prelude::*, translate::*, GStr}; #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GstPlayColorBalanceType")] pub enum PlayColorBalanceType { #[doc(alias = "GST_PLAY_COLOR_BALANCE_HUE")] Hue, #[doc(alias = "GST_PLAY_COLOR_BALANCE_BRIGHTNESS")] Brightness, #[doc(alias = "GST_PLAY_COLOR_BALANCE_SATURATION")] Saturation, #[doc(alias = "GST_PLAY_COLOR_BALANCE_CONTRAST")] Contrast, #[doc(hidden)] __Unknown(i32), } impl PlayColorBalanceType { pub fn name<'a>(self) -> &'a GStr { unsafe { GStr::from_ptr( ffi::gst_play_color_balance_type_get_name(self.into_glib()) .as_ref() .expect("gst_play_color_balance_type_get_name returned NULL"), ) } } } impl std::fmt::Display for PlayColorBalanceType { #[inline] fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(&self.name()) } } #[doc(hidden)] impl IntoGlib for PlayColorBalanceType { type GlibType = ffi::GstPlayColorBalanceType; #[inline] fn into_glib(self) -> ffi::GstPlayColorBalanceType { match self { Self::Hue => ffi::GST_PLAY_COLOR_BALANCE_HUE, Self::Brightness => ffi::GST_PLAY_COLOR_BALANCE_BRIGHTNESS, Self::Saturation => ffi::GST_PLAY_COLOR_BALANCE_SATURATION, Self::Contrast => ffi::GST_PLAY_COLOR_BALANCE_CONTRAST, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for PlayColorBalanceType { #[inline] unsafe fn from_glib(value: ffi::GstPlayColorBalanceType) -> Self { skip_assert_initialized!(); match value { ffi::GST_PLAY_COLOR_BALANCE_HUE => Self::Hue, ffi::GST_PLAY_COLOR_BALANCE_BRIGHTNESS => Self::Brightness, ffi::GST_PLAY_COLOR_BALANCE_SATURATION => Self::Saturation, ffi::GST_PLAY_COLOR_BALANCE_CONTRAST => Self::Contrast, value => Self::__Unknown(value), } } } impl StaticType for PlayColorBalanceType { #[inline] #[doc(alias = "gst_play_color_balance_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gst_play_color_balance_type_get_type()) } } } impl glib::HasParamSpec for PlayColorBalanceType { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for PlayColorBalanceType { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for PlayColorBalanceType { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for PlayColorBalanceType { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: PlayColorBalanceType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GstPlayError")] pub enum PlayError { #[doc(alias = "GST_PLAY_ERROR_FAILED")] Failed, #[doc(hidden)] __Unknown(i32), } impl PlayError { pub fn name<'a>(self) -> &'a GStr { unsafe { GStr::from_ptr( ffi::gst_play_error_get_name(self.into_glib()) .as_ref() .expect("gst_play_error_get_name returned NULL"), ) } } } impl std::fmt::Display for PlayError { #[inline] fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(&self.name()) } } #[doc(hidden)] impl IntoGlib for PlayError { type GlibType = ffi::GstPlayError; #[inline] fn into_glib(self) -> ffi::GstPlayError { match self { Self::Failed => ffi::GST_PLAY_ERROR_FAILED, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for PlayError { #[inline] unsafe fn from_glib(value: ffi::GstPlayError) -> Self { skip_assert_initialized!(); match value { ffi::GST_PLAY_ERROR_FAILED => Self::Failed, value => Self::__Unknown(value), } } } impl glib::error::ErrorDomain for PlayError { #[inline] fn domain() -> glib::Quark { skip_assert_initialized!(); unsafe { from_glib(ffi::gst_play_error_quark()) } } #[inline] fn code(self) -> i32 { self.into_glib() } #[inline] #[allow(clippy::match_single_binding)] fn from(code: i32) -> Option { skip_assert_initialized!(); match unsafe { from_glib(code) } { Self::__Unknown(_) => Some(Self::Failed), value => Some(value), } } } impl StaticType for PlayError { #[inline] #[doc(alias = "gst_play_error_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gst_play_error_get_type()) } } } impl glib::HasParamSpec for PlayError { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for PlayError { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for PlayError { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for PlayError { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: PlayError) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GstPlayMessage")] pub(crate) enum PlayMessage { #[doc(alias = "GST_PLAY_MESSAGE_URI_LOADED")] UriLoaded, #[doc(alias = "GST_PLAY_MESSAGE_POSITION_UPDATED")] PositionUpdated, #[doc(alias = "GST_PLAY_MESSAGE_DURATION_CHANGED")] DurationChanged, #[doc(alias = "GST_PLAY_MESSAGE_STATE_CHANGED")] StateChanged, #[doc(alias = "GST_PLAY_MESSAGE_BUFFERING")] Buffering, #[doc(alias = "GST_PLAY_MESSAGE_END_OF_STREAM")] EndOfStream, #[doc(alias = "GST_PLAY_MESSAGE_ERROR")] Error, #[doc(alias = "GST_PLAY_MESSAGE_WARNING")] Warning, #[doc(alias = "GST_PLAY_MESSAGE_VIDEO_DIMENSIONS_CHANGED")] VideoDimensionsChanged, #[doc(alias = "GST_PLAY_MESSAGE_MEDIA_INFO_UPDATED")] MediaInfoUpdated, #[doc(alias = "GST_PLAY_MESSAGE_VOLUME_CHANGED")] VolumeChanged, #[doc(alias = "GST_PLAY_MESSAGE_MUTE_CHANGED")] MuteChanged, #[doc(alias = "GST_PLAY_MESSAGE_SEEK_DONE")] SeekDone, #[doc(hidden)] __Unknown(i32), } impl PlayMessage { pub fn name<'a>(self) -> &'a GStr { unsafe { GStr::from_ptr( ffi::gst_play_message_get_name(self.into_glib()) .as_ref() .expect("gst_play_message_get_name returned NULL"), ) } } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_parse_buffering")] pub fn parse_buffering(msg: &gst::Message) -> u32 { assert_initialized_main_thread!(); unsafe { let mut percent = std::mem::MaybeUninit::uninit(); ffi::gst_play_message_parse_buffering(msg.to_glib_none().0, percent.as_mut_ptr()); percent.assume_init() } } #[cfg_attr(feature = "v1_26", deprecated = "Since 1.26")] #[allow(deprecated)] #[doc(alias = "gst_play_message_parse_buffering_percent")] pub fn parse_buffering_percent(msg: &gst::Message) -> u32 { assert_initialized_main_thread!(); unsafe { let mut percent = std::mem::MaybeUninit::uninit(); ffi::gst_play_message_parse_buffering_percent( msg.to_glib_none().0, percent.as_mut_ptr(), ); percent.assume_init() } } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_parse_duration_changed")] pub fn parse_duration_changed(msg: &gst::Message) -> Option { assert_initialized_main_thread!(); unsafe { let mut duration = std::mem::MaybeUninit::uninit(); ffi::gst_play_message_parse_duration_changed( msg.to_glib_none().0, duration.as_mut_ptr(), ); from_glib(duration.assume_init()) } } #[cfg_attr(feature = "v1_26", deprecated = "Since 1.26")] #[allow(deprecated)] #[doc(alias = "gst_play_message_parse_duration_updated")] pub fn parse_duration_updated(msg: &gst::Message) -> Option { assert_initialized_main_thread!(); unsafe { let mut duration = std::mem::MaybeUninit::uninit(); ffi::gst_play_message_parse_duration_updated( msg.to_glib_none().0, duration.as_mut_ptr(), ); from_glib(duration.assume_init()) } } #[doc(alias = "gst_play_message_parse_error")] pub fn parse_error(msg: &gst::Message) -> (glib::Error, Option) { assert_initialized_main_thread!(); unsafe { let mut error = std::ptr::null_mut(); let mut details = std::ptr::null_mut(); ffi::gst_play_message_parse_error(msg.to_glib_none().0, &mut error, &mut details); (from_glib_full(error), from_glib_full(details)) } } #[doc(alias = "gst_play_message_parse_media_info_updated")] pub fn parse_media_info_updated(msg: &gst::Message) -> PlayMediaInfo { assert_initialized_main_thread!(); unsafe { let mut info = std::ptr::null_mut(); ffi::gst_play_message_parse_media_info_updated(msg.to_glib_none().0, &mut info); from_glib_full(info) } } #[doc(alias = "gst_play_message_parse_muted_changed")] pub fn parse_muted_changed(msg: &gst::Message) -> bool { assert_initialized_main_thread!(); unsafe { let mut muted = std::mem::MaybeUninit::uninit(); ffi::gst_play_message_parse_muted_changed(msg.to_glib_none().0, muted.as_mut_ptr()); from_glib(muted.assume_init()) } } #[doc(alias = "gst_play_message_parse_position_updated")] pub fn parse_position_updated(msg: &gst::Message) -> Option { assert_initialized_main_thread!(); unsafe { let mut position = std::mem::MaybeUninit::uninit(); ffi::gst_play_message_parse_position_updated( msg.to_glib_none().0, position.as_mut_ptr(), ); from_glib(position.assume_init()) } } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_parse_seek_done")] pub fn parse_seek_done(msg: &gst::Message) -> Option { assert_initialized_main_thread!(); unsafe { let mut position = std::mem::MaybeUninit::uninit(); ffi::gst_play_message_parse_seek_done(msg.to_glib_none().0, position.as_mut_ptr()); from_glib(position.assume_init()) } } #[doc(alias = "gst_play_message_parse_state_changed")] pub fn parse_state_changed(msg: &gst::Message) -> PlayState { assert_initialized_main_thread!(); unsafe { let mut state = std::mem::MaybeUninit::uninit(); ffi::gst_play_message_parse_state_changed(msg.to_glib_none().0, state.as_mut_ptr()); from_glib(state.assume_init()) } } #[doc(alias = "gst_play_message_parse_type")] pub fn parse_type(msg: &gst::Message) -> PlayMessage { assert_initialized_main_thread!(); unsafe { let mut type_ = std::mem::MaybeUninit::uninit(); ffi::gst_play_message_parse_type(msg.to_glib_none().0, type_.as_mut_ptr()); from_glib(type_.assume_init()) } } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_parse_uri_loaded")] pub fn parse_uri_loaded(msg: &gst::Message) -> glib::GString { assert_initialized_main_thread!(); unsafe { let mut uri = std::ptr::null_mut(); ffi::gst_play_message_parse_uri_loaded(msg.to_glib_none().0, &mut uri); from_glib_full(uri) } } #[doc(alias = "gst_play_message_parse_video_dimensions_changed")] pub fn parse_video_dimensions_changed(msg: &gst::Message) -> (u32, u32) { assert_initialized_main_thread!(); unsafe { let mut width = std::mem::MaybeUninit::uninit(); let mut height = std::mem::MaybeUninit::uninit(); ffi::gst_play_message_parse_video_dimensions_changed( msg.to_glib_none().0, width.as_mut_ptr(), height.as_mut_ptr(), ); (width.assume_init(), height.assume_init()) } } #[doc(alias = "gst_play_message_parse_volume_changed")] pub fn parse_volume_changed(msg: &gst::Message) -> f64 { assert_initialized_main_thread!(); unsafe { let mut volume = std::mem::MaybeUninit::uninit(); ffi::gst_play_message_parse_volume_changed(msg.to_glib_none().0, volume.as_mut_ptr()); volume.assume_init() } } #[doc(alias = "gst_play_message_parse_warning")] pub fn parse_warning(msg: &gst::Message) -> (glib::Error, Option) { assert_initialized_main_thread!(); unsafe { let mut error = std::ptr::null_mut(); let mut details = std::ptr::null_mut(); ffi::gst_play_message_parse_warning(msg.to_glib_none().0, &mut error, &mut details); (from_glib_full(error), from_glib_full(details)) } } } impl std::fmt::Display for PlayMessage { #[inline] fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(&self.name()) } } #[doc(hidden)] impl IntoGlib for PlayMessage { type GlibType = ffi::GstPlayMessage; fn into_glib(self) -> ffi::GstPlayMessage { match self { Self::UriLoaded => ffi::GST_PLAY_MESSAGE_URI_LOADED, Self::PositionUpdated => ffi::GST_PLAY_MESSAGE_POSITION_UPDATED, Self::DurationChanged => ffi::GST_PLAY_MESSAGE_DURATION_CHANGED, Self::StateChanged => ffi::GST_PLAY_MESSAGE_STATE_CHANGED, Self::Buffering => ffi::GST_PLAY_MESSAGE_BUFFERING, Self::EndOfStream => ffi::GST_PLAY_MESSAGE_END_OF_STREAM, Self::Error => ffi::GST_PLAY_MESSAGE_ERROR, Self::Warning => ffi::GST_PLAY_MESSAGE_WARNING, Self::VideoDimensionsChanged => ffi::GST_PLAY_MESSAGE_VIDEO_DIMENSIONS_CHANGED, Self::MediaInfoUpdated => ffi::GST_PLAY_MESSAGE_MEDIA_INFO_UPDATED, Self::VolumeChanged => ffi::GST_PLAY_MESSAGE_VOLUME_CHANGED, Self::MuteChanged => ffi::GST_PLAY_MESSAGE_MUTE_CHANGED, Self::SeekDone => ffi::GST_PLAY_MESSAGE_SEEK_DONE, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for PlayMessage { unsafe fn from_glib(value: ffi::GstPlayMessage) -> Self { skip_assert_initialized!(); match value { ffi::GST_PLAY_MESSAGE_URI_LOADED => Self::UriLoaded, ffi::GST_PLAY_MESSAGE_POSITION_UPDATED => Self::PositionUpdated, ffi::GST_PLAY_MESSAGE_DURATION_CHANGED => Self::DurationChanged, ffi::GST_PLAY_MESSAGE_STATE_CHANGED => Self::StateChanged, ffi::GST_PLAY_MESSAGE_BUFFERING => Self::Buffering, ffi::GST_PLAY_MESSAGE_END_OF_STREAM => Self::EndOfStream, ffi::GST_PLAY_MESSAGE_ERROR => Self::Error, ffi::GST_PLAY_MESSAGE_WARNING => Self::Warning, ffi::GST_PLAY_MESSAGE_VIDEO_DIMENSIONS_CHANGED => Self::VideoDimensionsChanged, ffi::GST_PLAY_MESSAGE_MEDIA_INFO_UPDATED => Self::MediaInfoUpdated, ffi::GST_PLAY_MESSAGE_VOLUME_CHANGED => Self::VolumeChanged, ffi::GST_PLAY_MESSAGE_MUTE_CHANGED => Self::MuteChanged, ffi::GST_PLAY_MESSAGE_SEEK_DONE => Self::SeekDone, value => Self::__Unknown(value), } } } impl StaticType for PlayMessage { #[inline] #[doc(alias = "gst_play_message_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gst_play_message_get_type()) } } } impl glib::HasParamSpec for PlayMessage { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for PlayMessage { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for PlayMessage { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for PlayMessage { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: PlayMessage) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GstPlaySnapshotFormat")] pub enum PlaySnapshotFormat { #[doc(alias = "GST_PLAY_THUMBNAIL_RAW_NATIVE")] RawNative, #[doc(alias = "GST_PLAY_THUMBNAIL_RAW_xRGB")] RawXrgb, #[doc(alias = "GST_PLAY_THUMBNAIL_RAW_BGRx")] RawBgrx, #[doc(alias = "GST_PLAY_THUMBNAIL_JPG")] Jpg, #[doc(alias = "GST_PLAY_THUMBNAIL_PNG")] Png, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for PlaySnapshotFormat { type GlibType = ffi::GstPlaySnapshotFormat; #[inline] fn into_glib(self) -> ffi::GstPlaySnapshotFormat { match self { Self::RawNative => ffi::GST_PLAY_THUMBNAIL_RAW_NATIVE, Self::RawXrgb => ffi::GST_PLAY_THUMBNAIL_RAW_xRGB, Self::RawBgrx => ffi::GST_PLAY_THUMBNAIL_RAW_BGRx, Self::Jpg => ffi::GST_PLAY_THUMBNAIL_JPG, Self::Png => ffi::GST_PLAY_THUMBNAIL_PNG, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for PlaySnapshotFormat { #[inline] unsafe fn from_glib(value: ffi::GstPlaySnapshotFormat) -> Self { skip_assert_initialized!(); match value { ffi::GST_PLAY_THUMBNAIL_RAW_NATIVE => Self::RawNative, ffi::GST_PLAY_THUMBNAIL_RAW_xRGB => Self::RawXrgb, ffi::GST_PLAY_THUMBNAIL_RAW_BGRx => Self::RawBgrx, ffi::GST_PLAY_THUMBNAIL_JPG => Self::Jpg, ffi::GST_PLAY_THUMBNAIL_PNG => Self::Png, value => Self::__Unknown(value), } } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GstPlayState")] pub enum PlayState { #[doc(alias = "GST_PLAY_STATE_STOPPED")] Stopped, #[doc(alias = "GST_PLAY_STATE_BUFFERING")] Buffering, #[doc(alias = "GST_PLAY_STATE_PAUSED")] Paused, #[doc(alias = "GST_PLAY_STATE_PLAYING")] Playing, #[doc(hidden)] __Unknown(i32), } impl PlayState { pub fn name<'a>(self) -> &'a GStr { unsafe { GStr::from_ptr( ffi::gst_play_state_get_name(self.into_glib()) .as_ref() .expect("gst_play_state_get_name returned NULL"), ) } } } impl std::fmt::Display for PlayState { #[inline] fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(&self.name()) } } #[doc(hidden)] impl IntoGlib for PlayState { type GlibType = ffi::GstPlayState; #[inline] fn into_glib(self) -> ffi::GstPlayState { match self { Self::Stopped => ffi::GST_PLAY_STATE_STOPPED, Self::Buffering => ffi::GST_PLAY_STATE_BUFFERING, Self::Paused => ffi::GST_PLAY_STATE_PAUSED, Self::Playing => ffi::GST_PLAY_STATE_PLAYING, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for PlayState { #[inline] unsafe fn from_glib(value: ffi::GstPlayState) -> Self { skip_assert_initialized!(); match value { ffi::GST_PLAY_STATE_STOPPED => Self::Stopped, ffi::GST_PLAY_STATE_BUFFERING => Self::Buffering, ffi::GST_PLAY_STATE_PAUSED => Self::Paused, ffi::GST_PLAY_STATE_PLAYING => Self::Playing, value => Self::__Unknown(value), } } } impl StaticType for PlayState { #[inline] #[doc(alias = "gst_play_state_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gst_play_state_get_type()) } } } impl glib::HasParamSpec for PlayState { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for PlayState { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for PlayState { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for PlayState { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: PlayState) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } gstreamer-play-0.24.0/src/auto/mod.rs000064400000000000000000000024401046102023000155270ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT mod play; pub use self::play::Play; mod play_audio_info; pub use self::play_audio_info::PlayAudioInfo; mod play_media_info; pub use self::play_media_info::PlayMediaInfo; mod play_signal_adapter; pub use self::play_signal_adapter::PlaySignalAdapter; mod play_stream_info; pub use self::play_stream_info::PlayStreamInfo; mod play_subtitle_info; pub use self::play_subtitle_info::PlaySubtitleInfo; mod play_video_info; pub use self::play_video_info::PlayVideoInfo; mod play_video_overlay_video_renderer; pub use self::play_video_overlay_video_renderer::PlayVideoOverlayVideoRenderer; mod play_video_renderer; pub use self::play_video_renderer::PlayVideoRenderer; mod play_visualization; pub use self::play_visualization::PlayVisualization; mod enums; pub use self::enums::PlayColorBalanceType; pub use self::enums::PlayError; pub(crate) use self::enums::PlayMessage; pub use self::enums::PlaySnapshotFormat; pub use self::enums::PlayState; pub(crate) mod traits { pub use super::play_stream_info::PlayStreamInfoExt; pub use super::play_video_renderer::PlayVideoRendererExt; } gstreamer-play-0.24.0/src/auto/play.rs000064400000000000000000001003341046102023000157160ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT #![allow(deprecated)] use crate::{ ffi, PlayAudioInfo, PlayColorBalanceType, PlayMediaInfo, PlaySubtitleInfo, PlayVideoInfo, PlayVideoRenderer, PlayVisualization, }; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GstPlay")] pub struct Play(Object) @extends gst::Object; match fn { type_ => || ffi::gst_play_get_type(), } } impl Play { #[doc(alias = "gst_play_new")] pub fn new(video_renderer: Option>) -> Play { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gst_play_new( video_renderer.map(|p| p.upcast()).into_glib_ptr(), )) } } #[doc(alias = "gst_play_get_audio_video_offset")] #[doc(alias = "get_audio_video_offset")] #[doc(alias = "audio-video-offset")] pub fn audio_video_offset(&self) -> i64 { unsafe { ffi::gst_play_get_audio_video_offset(self.to_glib_none().0) } } #[doc(alias = "gst_play_get_color_balance")] #[doc(alias = "get_color_balance")] pub fn color_balance(&self, type_: PlayColorBalanceType) -> f64 { unsafe { ffi::gst_play_get_color_balance(self.to_glib_none().0, type_.into_glib()) } } #[doc(alias = "gst_play_get_current_audio_track")] #[doc(alias = "get_current_audio_track")] #[doc(alias = "current-audio-track")] pub fn current_audio_track(&self) -> Option { unsafe { from_glib_full(ffi::gst_play_get_current_audio_track(self.to_glib_none().0)) } } #[doc(alias = "gst_play_get_current_subtitle_track")] #[doc(alias = "get_current_subtitle_track")] #[doc(alias = "current-subtitle-track")] pub fn current_subtitle_track(&self) -> Option { unsafe { from_glib_full(ffi::gst_play_get_current_subtitle_track( self.to_glib_none().0, )) } } #[doc(alias = "gst_play_get_current_video_track")] #[doc(alias = "get_current_video_track")] #[doc(alias = "current-video-track")] pub fn current_video_track(&self) -> Option { unsafe { from_glib_full(ffi::gst_play_get_current_video_track(self.to_glib_none().0)) } } #[doc(alias = "gst_play_get_current_visualization")] #[doc(alias = "get_current_visualization")] pub fn current_visualization(&self) -> Option { unsafe { from_glib_full(ffi::gst_play_get_current_visualization( self.to_glib_none().0, )) } } #[doc(alias = "gst_play_get_duration")] #[doc(alias = "get_duration")] pub fn duration(&self) -> Option { unsafe { from_glib(ffi::gst_play_get_duration(self.to_glib_none().0)) } } #[doc(alias = "gst_play_get_media_info")] #[doc(alias = "get_media_info")] #[doc(alias = "media-info")] pub fn media_info(&self) -> Option { unsafe { from_glib_full(ffi::gst_play_get_media_info(self.to_glib_none().0)) } } #[doc(alias = "gst_play_get_message_bus")] #[doc(alias = "get_message_bus")] pub fn message_bus(&self) -> gst::Bus { unsafe { from_glib_full(ffi::gst_play_get_message_bus(self.to_glib_none().0)) } } #[doc(alias = "gst_play_get_multiview_flags")] #[doc(alias = "get_multiview_flags")] pub fn multiview_flags(&self) -> gst_video::VideoMultiviewFlags { unsafe { from_glib(ffi::gst_play_get_multiview_flags(self.to_glib_none().0)) } } #[doc(alias = "gst_play_get_multiview_mode")] #[doc(alias = "get_multiview_mode")] pub fn multiview_mode(&self) -> gst_video::VideoMultiviewFramePacking { unsafe { from_glib(ffi::gst_play_get_multiview_mode(self.to_glib_none().0)) } } #[doc(alias = "gst_play_get_mute")] #[doc(alias = "get_mute")] #[doc(alias = "mute")] pub fn is_muted(&self) -> bool { unsafe { from_glib(ffi::gst_play_get_mute(self.to_glib_none().0)) } } #[doc(alias = "gst_play_get_pipeline")] #[doc(alias = "get_pipeline")] pub fn pipeline(&self) -> gst::Element { unsafe { from_glib_full(ffi::gst_play_get_pipeline(self.to_glib_none().0)) } } #[doc(alias = "gst_play_get_position")] #[doc(alias = "get_position")] pub fn position(&self) -> Option { unsafe { from_glib(ffi::gst_play_get_position(self.to_glib_none().0)) } } #[doc(alias = "gst_play_get_rate")] #[doc(alias = "get_rate")] pub fn rate(&self) -> f64 { unsafe { ffi::gst_play_get_rate(self.to_glib_none().0) } } #[doc(alias = "gst_play_get_subtitle_uri")] #[doc(alias = "get_subtitle_uri")] pub fn subtitle_uri(&self) -> Option { unsafe { from_glib_full(ffi::gst_play_get_subtitle_uri(self.to_glib_none().0)) } } #[doc(alias = "gst_play_get_subtitle_video_offset")] #[doc(alias = "get_subtitle_video_offset")] #[doc(alias = "subtitle-video-offset")] pub fn subtitle_video_offset(&self) -> i64 { unsafe { ffi::gst_play_get_subtitle_video_offset(self.to_glib_none().0) } } #[doc(alias = "gst_play_get_uri")] #[doc(alias = "get_uri")] pub fn uri(&self) -> Option { unsafe { from_glib_full(ffi::gst_play_get_uri(self.to_glib_none().0)) } } #[doc(alias = "gst_play_get_volume")] #[doc(alias = "get_volume")] pub fn volume(&self) -> f64 { unsafe { ffi::gst_play_get_volume(self.to_glib_none().0) } } #[doc(alias = "gst_play_has_color_balance")] pub fn has_color_balance(&self) -> bool { unsafe { from_glib(ffi::gst_play_has_color_balance(self.to_glib_none().0)) } } #[doc(alias = "gst_play_pause")] pub fn pause(&self) { unsafe { ffi::gst_play_pause(self.to_glib_none().0); } } #[doc(alias = "gst_play_play")] pub fn play(&self) { unsafe { ffi::gst_play_play(self.to_glib_none().0); } } #[doc(alias = "gst_play_seek")] pub fn seek(&self, position: gst::ClockTime) { unsafe { ffi::gst_play_seek(self.to_glib_none().0, position.into_glib()); } } #[cfg_attr(feature = "v1_26", deprecated = "Since 1.26")] #[allow(deprecated)] #[doc(alias = "gst_play_set_audio_track")] pub fn set_audio_track(&self, stream_index: i32) -> Result<(), glib::error::BoolError> { unsafe { glib::result_from_gboolean!( ffi::gst_play_set_audio_track(self.to_glib_none().0, stream_index), "Failed to set audio track" ) } } #[doc(alias = "gst_play_set_audio_track_enabled")] pub fn set_audio_track_enabled(&self, enabled: bool) { unsafe { ffi::gst_play_set_audio_track_enabled(self.to_glib_none().0, enabled.into_glib()); } } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_set_audio_track_id")] pub fn set_audio_track_id( &self, stream_id: Option<&str>, ) -> Result<(), glib::error::BoolError> { unsafe { glib::result_from_gboolean!( ffi::gst_play_set_audio_track_id(self.to_glib_none().0, stream_id.to_glib_none().0), "Failed to set audio track" ) } } #[doc(alias = "gst_play_set_audio_video_offset")] #[doc(alias = "audio-video-offset")] pub fn set_audio_video_offset(&self, offset: i64) { unsafe { ffi::gst_play_set_audio_video_offset(self.to_glib_none().0, offset); } } #[doc(alias = "gst_play_set_color_balance")] pub fn set_color_balance(&self, type_: PlayColorBalanceType, value: f64) { unsafe { ffi::gst_play_set_color_balance(self.to_glib_none().0, type_.into_glib(), value); } } #[doc(alias = "gst_play_set_multiview_flags")] pub fn set_multiview_flags(&self, flags: gst_video::VideoMultiviewFlags) { unsafe { ffi::gst_play_set_multiview_flags(self.to_glib_none().0, flags.into_glib()); } } #[doc(alias = "gst_play_set_multiview_mode")] pub fn set_multiview_mode(&self, mode: gst_video::VideoMultiviewFramePacking) { unsafe { ffi::gst_play_set_multiview_mode(self.to_glib_none().0, mode.into_glib()); } } #[doc(alias = "gst_play_set_mute")] #[doc(alias = "mute")] pub fn set_mute(&self, val: bool) { unsafe { ffi::gst_play_set_mute(self.to_glib_none().0, val.into_glib()); } } #[doc(alias = "gst_play_set_rate")] #[doc(alias = "rate")] pub fn set_rate(&self, rate: f64) { unsafe { ffi::gst_play_set_rate(self.to_glib_none().0, rate); } } #[cfg_attr(feature = "v1_26", deprecated = "Since 1.26")] #[allow(deprecated)] #[doc(alias = "gst_play_set_subtitle_track")] pub fn set_subtitle_track(&self, stream_index: i32) -> Result<(), glib::error::BoolError> { unsafe { glib::result_from_gboolean!( ffi::gst_play_set_subtitle_track(self.to_glib_none().0, stream_index), "Failed to set subtitle track" ) } } #[doc(alias = "gst_play_set_subtitle_track_enabled")] pub fn set_subtitle_track_enabled(&self, enabled: bool) { unsafe { ffi::gst_play_set_subtitle_track_enabled(self.to_glib_none().0, enabled.into_glib()); } } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_set_subtitle_track_id")] pub fn set_subtitle_track_id( &self, stream_id: Option<&str>, ) -> Result<(), glib::error::BoolError> { unsafe { glib::result_from_gboolean!( ffi::gst_play_set_subtitle_track_id( self.to_glib_none().0, stream_id.to_glib_none().0 ), "Failed to set subtitle track" ) } } #[doc(alias = "gst_play_set_subtitle_uri")] pub fn set_subtitle_uri(&self, uri: Option<&str>) { unsafe { ffi::gst_play_set_subtitle_uri(self.to_glib_none().0, uri.to_glib_none().0); } } #[doc(alias = "gst_play_set_subtitle_video_offset")] #[doc(alias = "subtitle-video-offset")] pub fn set_subtitle_video_offset(&self, offset: i64) { unsafe { ffi::gst_play_set_subtitle_video_offset(self.to_glib_none().0, offset); } } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_set_track_ids")] pub fn set_track_ids( &self, audio_stream_id: Option<&str>, video_stream_id: Option<&str>, subtitle_stream_id: Option<&str>, ) -> Result<(), glib::error::BoolError> { unsafe { glib::result_from_gboolean!( ffi::gst_play_set_track_ids( self.to_glib_none().0, audio_stream_id.to_glib_none().0, video_stream_id.to_glib_none().0, subtitle_stream_id.to_glib_none().0 ), "Failed to set tracks" ) } } #[doc(alias = "gst_play_set_uri")] #[doc(alias = "uri")] pub fn set_uri(&self, uri: Option<&str>) { unsafe { ffi::gst_play_set_uri(self.to_glib_none().0, uri.to_glib_none().0); } } #[cfg_attr(feature = "v1_26", deprecated = "Since 1.26")] #[allow(deprecated)] #[doc(alias = "gst_play_set_video_track")] pub fn set_video_track(&self, stream_index: i32) -> Result<(), glib::error::BoolError> { unsafe { glib::result_from_gboolean!( ffi::gst_play_set_video_track(self.to_glib_none().0, stream_index), "Failed to set video track" ) } } #[doc(alias = "gst_play_set_video_track_enabled")] pub fn set_video_track_enabled(&self, enabled: bool) { unsafe { ffi::gst_play_set_video_track_enabled(self.to_glib_none().0, enabled.into_glib()); } } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_set_video_track_id")] pub fn set_video_track_id( &self, stream_id: Option<&str>, ) -> Result<(), glib::error::BoolError> { unsafe { glib::result_from_gboolean!( ffi::gst_play_set_video_track_id(self.to_glib_none().0, stream_id.to_glib_none().0), "Failed to set video track" ) } } #[doc(alias = "gst_play_set_visualization")] pub fn set_visualization(&self, name: Option<&str>) -> Result<(), glib::error::BoolError> { unsafe { glib::result_from_gboolean!( ffi::gst_play_set_visualization(self.to_glib_none().0, name.to_glib_none().0), "Failed to set visualization" ) } } #[doc(alias = "gst_play_set_visualization_enabled")] pub fn set_visualization_enabled(&self, enabled: bool) { unsafe { ffi::gst_play_set_visualization_enabled(self.to_glib_none().0, enabled.into_glib()); } } #[doc(alias = "gst_play_set_volume")] #[doc(alias = "volume")] pub fn set_volume(&self, val: f64) { unsafe { ffi::gst_play_set_volume(self.to_glib_none().0, val); } } #[doc(alias = "gst_play_stop")] pub fn stop(&self) { unsafe { ffi::gst_play_stop(self.to_glib_none().0); } } pub fn suburi(&self) -> Option { ObjectExt::property(self, "suburi") } pub fn set_suburi(&self, suburi: Option<&str>) { ObjectExt::set_property(self, "suburi", suburi) } #[doc(alias = "video-multiview-flags")] pub fn video_multiview_flags(&self) -> gst_video::VideoMultiviewFlags { ObjectExt::property(self, "video-multiview-flags") } #[doc(alias = "video-multiview-flags")] pub fn set_video_multiview_flags(&self, video_multiview_flags: gst_video::VideoMultiviewFlags) { ObjectExt::set_property(self, "video-multiview-flags", video_multiview_flags) } #[doc(alias = "video-multiview-mode")] pub fn video_multiview_mode(&self) -> gst_video::VideoMultiviewFramePacking { ObjectExt::property(self, "video-multiview-mode") } #[doc(alias = "video-multiview-mode")] pub fn set_video_multiview_mode( &self, video_multiview_mode: gst_video::VideoMultiviewFramePacking, ) { ObjectExt::set_property(self, "video-multiview-mode", video_multiview_mode) } #[doc(alias = "video-renderer")] pub fn video_renderer(&self) -> Option { ObjectExt::property(self, "video-renderer") } #[doc(alias = "video-renderer")] pub fn set_video_renderer>(&self, video_renderer: Option<&P>) { ObjectExt::set_property(self, "video-renderer", video_renderer) } #[doc(alias = "gst_play_get_audio_streams")] #[doc(alias = "get_audio_streams")] pub fn audio_streams(info: &PlayMediaInfo) -> Vec { skip_assert_initialized!(); unsafe { FromGlibPtrContainer::from_glib_none(ffi::gst_play_get_audio_streams( info.to_glib_none().0, )) } } #[doc(alias = "gst_play_get_subtitle_streams")] #[doc(alias = "get_subtitle_streams")] pub fn subtitle_streams(info: &PlayMediaInfo) -> Vec { skip_assert_initialized!(); unsafe { FromGlibPtrContainer::from_glib_none(ffi::gst_play_get_subtitle_streams( info.to_glib_none().0, )) } } #[doc(alias = "gst_play_get_video_streams")] #[doc(alias = "get_video_streams")] pub fn video_streams(info: &PlayMediaInfo) -> Vec { skip_assert_initialized!(); unsafe { FromGlibPtrContainer::from_glib_none(ffi::gst_play_get_video_streams( info.to_glib_none().0, )) } } #[doc(alias = "gst_play_is_play_message")] pub fn is_play_message(msg: &gst::Message) -> bool { assert_initialized_main_thread!(); unsafe { from_glib(ffi::gst_play_is_play_message(msg.to_glib_none().0)) } } #[doc(alias = "gst_play_visualizations_get")] pub fn visualizations_get() -> Vec { assert_initialized_main_thread!(); unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_play_visualizations_get()) } } #[doc(alias = "audio-video-offset")] pub fn connect_audio_video_offset_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_audio_video_offset_trampoline< F: Fn(&Play) + Send + Sync + 'static, >( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::audio-video-offset".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_audio_video_offset_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "current-audio-track")] pub fn connect_current_audio_track_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_current_audio_track_trampoline< F: Fn(&Play) + Send + Sync + 'static, >( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::current-audio-track".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_current_audio_track_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "current-subtitle-track")] pub fn connect_current_subtitle_track_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_current_subtitle_track_trampoline< F: Fn(&Play) + Send + Sync + 'static, >( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::current-subtitle-track".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_current_subtitle_track_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "current-video-track")] pub fn connect_current_video_track_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_current_video_track_trampoline< F: Fn(&Play) + Send + Sync + 'static, >( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::current-video-track".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_current_video_track_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "duration")] pub fn connect_duration_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_duration_trampoline( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::duration".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "media-info")] pub fn connect_media_info_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_media_info_trampoline( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::media-info".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_media_info_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "mute")] pub fn connect_mute_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_mute_trampoline( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::mute".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_mute_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "pipeline")] pub fn connect_pipeline_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_pipeline_trampoline( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::pipeline".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_pipeline_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "position")] pub fn connect_position_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_position_trampoline( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::position".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_position_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "rate")] pub fn connect_rate_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_rate_trampoline( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::rate".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_rate_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "subtitle-video-offset")] pub fn connect_subtitle_video_offset_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_subtitle_video_offset_trampoline< F: Fn(&Play) + Send + Sync + 'static, >( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::subtitle-video-offset".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_subtitle_video_offset_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "suburi")] pub fn connect_suburi_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_suburi_trampoline( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::suburi".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_suburi_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "uri")] pub fn connect_uri_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_uri_trampoline( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::uri".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_uri_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "video-multiview-flags")] pub fn connect_video_multiview_flags_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_video_multiview_flags_trampoline< F: Fn(&Play) + Send + Sync + 'static, >( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::video-multiview-flags".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_video_multiview_flags_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "video-multiview-mode")] pub fn connect_video_multiview_mode_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_video_multiview_mode_trampoline< F: Fn(&Play) + Send + Sync + 'static, >( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::video-multiview-mode".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_video_multiview_mode_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "video-renderer")] pub fn connect_video_renderer_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_video_renderer_trampoline< F: Fn(&Play) + Send + Sync + 'static, >( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::video-renderer".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_video_renderer_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "volume")] pub fn connect_volume_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_volume_trampoline( this: *mut ffi::GstPlay, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::volume".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_volume_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } unsafe impl Send for Play {} unsafe impl Sync for Play {} gstreamer-play-0.24.0/src/auto/play_audio_info.rs000064400000000000000000000033241046102023000201130ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::{ffi, PlayStreamInfo}; use glib::translate::*; glib::wrapper! { #[doc(alias = "GstPlayAudioInfo")] pub struct PlayAudioInfo(Object) @extends PlayStreamInfo; match fn { type_ => || ffi::gst_play_audio_info_get_type(), } } impl PlayAudioInfo { #[doc(alias = "gst_play_audio_info_get_bitrate")] #[doc(alias = "get_bitrate")] pub fn bitrate(&self) -> i32 { unsafe { ffi::gst_play_audio_info_get_bitrate(self.to_glib_none().0) } } #[doc(alias = "gst_play_audio_info_get_channels")] #[doc(alias = "get_channels")] pub fn channels(&self) -> i32 { unsafe { ffi::gst_play_audio_info_get_channels(self.to_glib_none().0) } } #[doc(alias = "gst_play_audio_info_get_language")] #[doc(alias = "get_language")] pub fn language(&self) -> Option { unsafe { from_glib_none(ffi::gst_play_audio_info_get_language(self.to_glib_none().0)) } } #[doc(alias = "gst_play_audio_info_get_max_bitrate")] #[doc(alias = "get_max_bitrate")] pub fn max_bitrate(&self) -> i32 { unsafe { ffi::gst_play_audio_info_get_max_bitrate(self.to_glib_none().0) } } #[doc(alias = "gst_play_audio_info_get_sample_rate")] #[doc(alias = "get_sample_rate")] pub fn sample_rate(&self) -> i32 { unsafe { ffi::gst_play_audio_info_get_sample_rate(self.to_glib_none().0) } } } unsafe impl Send for PlayAudioInfo {} unsafe impl Sync for PlayAudioInfo {} gstreamer-play-0.24.0/src/auto/play_media_info.rs000064400000000000000000000116441046102023000200750ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::{ffi, PlayAudioInfo, PlayStreamInfo, PlaySubtitleInfo, PlayVideoInfo}; use glib::translate::*; glib::wrapper! { #[doc(alias = "GstPlayMediaInfo")] pub struct PlayMediaInfo(Object); match fn { type_ => || ffi::gst_play_media_info_get_type(), } } impl PlayMediaInfo { #[doc(alias = "gst_play_media_info_get_audio_streams")] #[doc(alias = "get_audio_streams")] pub fn audio_streams(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gst_play_media_info_get_audio_streams( self.to_glib_none().0, )) } } #[doc(alias = "gst_play_media_info_get_container_format")] #[doc(alias = "get_container_format")] pub fn container_format(&self) -> Option { unsafe { from_glib_none(ffi::gst_play_media_info_get_container_format( self.to_glib_none().0, )) } } #[doc(alias = "gst_play_media_info_get_duration")] #[doc(alias = "get_duration")] pub fn duration(&self) -> Option { unsafe { from_glib(ffi::gst_play_media_info_get_duration(self.to_glib_none().0)) } } #[doc(alias = "gst_play_media_info_get_image_sample")] #[doc(alias = "get_image_sample")] pub fn image_sample(&self) -> Option { unsafe { from_glib_none(ffi::gst_play_media_info_get_image_sample( self.to_glib_none().0, )) } } #[doc(alias = "gst_play_media_info_get_number_of_audio_streams")] #[doc(alias = "get_number_of_audio_streams")] pub fn number_of_audio_streams(&self) -> u32 { unsafe { ffi::gst_play_media_info_get_number_of_audio_streams(self.to_glib_none().0) } } #[doc(alias = "gst_play_media_info_get_number_of_streams")] #[doc(alias = "get_number_of_streams")] pub fn number_of_streams(&self) -> u32 { unsafe { ffi::gst_play_media_info_get_number_of_streams(self.to_glib_none().0) } } #[doc(alias = "gst_play_media_info_get_number_of_subtitle_streams")] #[doc(alias = "get_number_of_subtitle_streams")] pub fn number_of_subtitle_streams(&self) -> u32 { unsafe { ffi::gst_play_media_info_get_number_of_subtitle_streams(self.to_glib_none().0) } } #[doc(alias = "gst_play_media_info_get_number_of_video_streams")] #[doc(alias = "get_number_of_video_streams")] pub fn number_of_video_streams(&self) -> u32 { unsafe { ffi::gst_play_media_info_get_number_of_video_streams(self.to_glib_none().0) } } #[doc(alias = "gst_play_media_info_get_stream_list")] #[doc(alias = "get_stream_list")] pub fn stream_list(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gst_play_media_info_get_stream_list( self.to_glib_none().0, )) } } #[doc(alias = "gst_play_media_info_get_subtitle_streams")] #[doc(alias = "get_subtitle_streams")] pub fn subtitle_streams(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gst_play_media_info_get_subtitle_streams( self.to_glib_none().0, )) } } #[doc(alias = "gst_play_media_info_get_tags")] #[doc(alias = "get_tags")] pub fn tags(&self) -> Option { unsafe { from_glib_none(ffi::gst_play_media_info_get_tags(self.to_glib_none().0)) } } #[doc(alias = "gst_play_media_info_get_title")] #[doc(alias = "get_title")] pub fn title(&self) -> Option { unsafe { from_glib_none(ffi::gst_play_media_info_get_title(self.to_glib_none().0)) } } #[doc(alias = "gst_play_media_info_get_uri")] #[doc(alias = "get_uri")] pub fn uri(&self) -> glib::GString { unsafe { from_glib_none(ffi::gst_play_media_info_get_uri(self.to_glib_none().0)) } } #[doc(alias = "gst_play_media_info_get_video_streams")] #[doc(alias = "get_video_streams")] pub fn video_streams(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gst_play_media_info_get_video_streams( self.to_glib_none().0, )) } } #[doc(alias = "gst_play_media_info_is_live")] pub fn is_live(&self) -> bool { unsafe { from_glib(ffi::gst_play_media_info_is_live(self.to_glib_none().0)) } } #[doc(alias = "gst_play_media_info_is_seekable")] pub fn is_seekable(&self) -> bool { unsafe { from_glib(ffi::gst_play_media_info_is_seekable(self.to_glib_none().0)) } } } unsafe impl Send for PlayMediaInfo {} unsafe impl Sync for PlayMediaInfo {} gstreamer-play-0.24.0/src/auto/play_signal_adapter.rs000064400000000000000000000312751046102023000207620ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::{ffi, Play, PlayMediaInfo, PlayState}; use glib::{ object::ObjectType as _, prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GstPlaySignalAdapter")] pub struct PlaySignalAdapter(Object); match fn { type_ => || ffi::gst_play_signal_adapter_get_type(), } } impl PlaySignalAdapter { #[doc(alias = "gst_play_signal_adapter_new")] pub fn new(play: &Play) -> PlaySignalAdapter { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gst_play_signal_adapter_new(play.to_glib_none().0)) } } #[doc(alias = "gst_play_signal_adapter_new_sync_emit")] pub fn new_sync_emit(play: &Play) -> PlaySignalAdapter { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gst_play_signal_adapter_new_sync_emit( play.to_glib_none().0, )) } } #[doc(alias = "gst_play_signal_adapter_new_with_main_context")] #[doc(alias = "new_with_main_context")] pub fn with_main_context(play: &Play, context: &glib::MainContext) -> PlaySignalAdapter { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gst_play_signal_adapter_new_with_main_context( play.to_glib_none().0, context.to_glib_none().0, )) } } #[doc(alias = "gst_play_signal_adapter_get_play")] #[doc(alias = "get_play")] pub fn play(&self) -> Play { unsafe { from_glib_none(ffi::gst_play_signal_adapter_get_play(self.to_glib_none().0)) } } #[doc(alias = "buffering")] pub fn connect_buffering(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn buffering_trampoline< F: Fn(&PlaySignalAdapter, i32) + Send + 'static, >( this: *mut ffi::GstPlaySignalAdapter, object: std::ffi::c_int, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), object) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"buffering".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( buffering_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "end-of-stream")] pub fn connect_end_of_stream(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn end_of_stream_trampoline< F: Fn(&PlaySignalAdapter) + Send + 'static, >( this: *mut ffi::GstPlaySignalAdapter, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"end-of-stream".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( end_of_stream_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "error")] pub fn connect_error) + Send + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn error_trampoline< F: Fn(&PlaySignalAdapter, &glib::Error, Option<&gst::Structure>) + Send + 'static, >( this: *mut ffi::GstPlaySignalAdapter, error: *mut glib::ffi::GError, details: *mut gst::ffi::GstStructure, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &from_glib_borrow(error), Option::::from_glib_borrow(details) .as_ref() .as_ref(), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"error".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( error_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "media-info-updated")] pub fn connect_media_info_updated( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn media_info_updated_trampoline< F: Fn(&PlaySignalAdapter, &PlayMediaInfo) + Send + 'static, >( this: *mut ffi::GstPlaySignalAdapter, object: *mut ffi::GstPlayMediaInfo, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(object)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"media-info-updated".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( media_info_updated_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "mute-changed")] pub fn connect_mute_changed( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn mute_changed_trampoline< F: Fn(&PlaySignalAdapter, bool) + Send + 'static, >( this: *mut ffi::GstPlaySignalAdapter, object: glib::ffi::gboolean, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), from_glib(object)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"mute-changed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( mute_changed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "state-changed")] pub fn connect_state_changed( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn state_changed_trampoline< F: Fn(&PlaySignalAdapter, PlayState) + Send + 'static, >( this: *mut ffi::GstPlaySignalAdapter, object: ffi::GstPlayState, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), from_glib(object)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"state-changed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( state_changed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "uri-loaded")] pub fn connect_uri_loaded(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn uri_loaded_trampoline< F: Fn(&PlaySignalAdapter, &str) + Send + 'static, >( this: *mut ffi::GstPlaySignalAdapter, object: *mut std::ffi::c_char, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &glib::GString::from_glib_borrow(object), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"uri-loaded".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( uri_loaded_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "video-dimensions-changed")] pub fn connect_video_dimensions_changed( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn video_dimensions_changed_trampoline< F: Fn(&PlaySignalAdapter, u32, u32) + Send + 'static, >( this: *mut ffi::GstPlaySignalAdapter, object: std::ffi::c_uint, p0: std::ffi::c_uint, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), object, p0) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"video-dimensions-changed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( video_dimensions_changed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "volume-changed")] pub fn connect_volume_changed( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn volume_changed_trampoline< F: Fn(&PlaySignalAdapter, f64) + Send + 'static, >( this: *mut ffi::GstPlaySignalAdapter, object: std::ffi::c_double, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), object) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"volume-changed".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( volume_changed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "warning")] pub fn connect_warning) + Send + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn warning_trampoline< F: Fn(&PlaySignalAdapter, &glib::Error, Option<&gst::Structure>) + Send + 'static, >( this: *mut ffi::GstPlaySignalAdapter, error: *mut glib::ffi::GError, details: *mut gst::ffi::GstStructure, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &from_glib_borrow(error), Option::::from_glib_borrow(details) .as_ref() .as_ref(), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"warning".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( warning_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "play")] pub fn connect_play_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_play_trampoline< F: Fn(&PlaySignalAdapter) + Send + Sync + 'static, >( this: *mut ffi::GstPlaySignalAdapter, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::play".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_play_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } unsafe impl Send for PlaySignalAdapter {} unsafe impl Sync for PlaySignalAdapter {} gstreamer-play-0.24.0/src/auto/play_stream_info.rs000064400000000000000000000053361046102023000203120ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT #![allow(deprecated)] use crate::ffi; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "GstPlayStreamInfo")] pub struct PlayStreamInfo(Object); match fn { type_ => || ffi::gst_play_stream_info_get_type(), } } impl PlayStreamInfo { pub const NONE: Option<&'static PlayStreamInfo> = None; } unsafe impl Send for PlayStreamInfo {} unsafe impl Sync for PlayStreamInfo {} pub trait PlayStreamInfoExt: IsA + 'static { #[doc(alias = "gst_play_stream_info_get_caps")] #[doc(alias = "get_caps")] fn caps(&self) -> Option { unsafe { from_glib_none(ffi::gst_play_stream_info_get_caps(const_override( self.as_ref().to_glib_none().0, ))) } } #[doc(alias = "gst_play_stream_info_get_codec")] #[doc(alias = "get_codec")] fn codec(&self) -> Option { unsafe { from_glib_none(ffi::gst_play_stream_info_get_codec(const_override( self.as_ref().to_glib_none().0, ))) } } #[cfg_attr(feature = "v1_26", deprecated = "Since 1.26")] #[allow(deprecated)] #[doc(alias = "gst_play_stream_info_get_index")] #[doc(alias = "get_index")] fn index(&self) -> i32 { unsafe { ffi::gst_play_stream_info_get_index(const_override(self.as_ref().to_glib_none().0)) } } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_stream_info_get_stream_id")] #[doc(alias = "get_stream_id")] fn stream_id(&self) -> glib::GString { unsafe { from_glib_none(ffi::gst_play_stream_info_get_stream_id(const_override( self.as_ref().to_glib_none().0, ))) } } #[doc(alias = "gst_play_stream_info_get_stream_type")] #[doc(alias = "get_stream_type")] fn stream_type(&self) -> glib::GString { unsafe { from_glib_none(ffi::gst_play_stream_info_get_stream_type(const_override( self.as_ref().to_glib_none().0, ))) } } #[doc(alias = "gst_play_stream_info_get_tags")] #[doc(alias = "get_tags")] fn tags(&self) -> Option { unsafe { from_glib_none(ffi::gst_play_stream_info_get_tags(const_override( self.as_ref().to_glib_none().0, ))) } } } impl> PlayStreamInfoExt for O {} gstreamer-play-0.24.0/src/auto/play_subtitle_info.rs000064400000000000000000000016751046102023000206540ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::{ffi, PlayStreamInfo}; use glib::translate::*; glib::wrapper! { #[doc(alias = "GstPlaySubtitleInfo")] pub struct PlaySubtitleInfo(Object) @extends PlayStreamInfo; match fn { type_ => || ffi::gst_play_subtitle_info_get_type(), } } impl PlaySubtitleInfo { #[doc(alias = "gst_play_subtitle_info_get_language")] #[doc(alias = "get_language")] pub fn language(&self) -> Option { unsafe { from_glib_none(ffi::gst_play_subtitle_info_get_language( self.to_glib_none().0, )) } } } unsafe impl Send for PlaySubtitleInfo {} unsafe impl Sync for PlaySubtitleInfo {} gstreamer-play-0.24.0/src/auto/play_video_info.rs000064400000000000000000000026751046102023000201300ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::{ffi, PlayStreamInfo}; use glib::translate::*; glib::wrapper! { #[doc(alias = "GstPlayVideoInfo")] pub struct PlayVideoInfo(Object) @extends PlayStreamInfo; match fn { type_ => || ffi::gst_play_video_info_get_type(), } } impl PlayVideoInfo { #[doc(alias = "gst_play_video_info_get_bitrate")] #[doc(alias = "get_bitrate")] pub fn bitrate(&self) -> i32 { unsafe { ffi::gst_play_video_info_get_bitrate(self.to_glib_none().0) } } #[doc(alias = "gst_play_video_info_get_height")] #[doc(alias = "get_height")] pub fn height(&self) -> i32 { unsafe { ffi::gst_play_video_info_get_height(self.to_glib_none().0) } } #[doc(alias = "gst_play_video_info_get_max_bitrate")] #[doc(alias = "get_max_bitrate")] pub fn max_bitrate(&self) -> i32 { unsafe { ffi::gst_play_video_info_get_max_bitrate(self.to_glib_none().0) } } #[doc(alias = "gst_play_video_info_get_width")] #[doc(alias = "get_width")] pub fn width(&self) -> i32 { unsafe { ffi::gst_play_video_info_get_width(self.to_glib_none().0) } } } unsafe impl Send for PlayVideoInfo {} unsafe impl Sync for PlayVideoInfo {} gstreamer-play-0.24.0/src/auto/play_video_overlay_video_renderer.rs000064400000000000000000000111131046102023000237150ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::{ffi, PlayVideoRenderer}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GstPlayVideoOverlayVideoRenderer")] pub struct PlayVideoOverlayVideoRenderer(Object) @implements PlayVideoRenderer; match fn { type_ => || ffi::gst_play_video_overlay_video_renderer_get_type(), } } impl PlayVideoOverlayVideoRenderer { #[doc(alias = "gst_play_video_overlay_video_renderer_expose")] pub fn expose(&self) { unsafe { ffi::gst_play_video_overlay_video_renderer_expose(self.to_glib_none().0); } } #[doc(alias = "gst_play_video_overlay_video_renderer_get_render_rectangle")] #[doc(alias = "get_render_rectangle")] pub fn render_rectangle(&self) -> (i32, i32, i32, i32) { unsafe { let mut x = std::mem::MaybeUninit::uninit(); let mut y = std::mem::MaybeUninit::uninit(); let mut width = std::mem::MaybeUninit::uninit(); let mut height = std::mem::MaybeUninit::uninit(); ffi::gst_play_video_overlay_video_renderer_get_render_rectangle( self.to_glib_none().0, x.as_mut_ptr(), y.as_mut_ptr(), width.as_mut_ptr(), height.as_mut_ptr(), ); ( x.assume_init(), y.assume_init(), width.assume_init(), height.assume_init(), ) } } #[doc(alias = "gst_play_video_overlay_video_renderer_set_render_rectangle")] pub fn set_render_rectangle(&self, x: i32, y: i32, width: i32, height: i32) { unsafe { ffi::gst_play_video_overlay_video_renderer_set_render_rectangle( self.to_glib_none().0, x, y, width, height, ); } } #[doc(alias = "video-sink")] pub fn video_sink(&self) -> Option { ObjectExt::property(self, "video-sink") } #[doc(alias = "video-sink")] pub fn set_video_sink>(&self, video_sink: Option<&P>) { ObjectExt::set_property(self, "video-sink", video_sink) } #[doc(alias = "video-sink")] pub fn connect_video_sink_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_video_sink_trampoline< F: Fn(&PlayVideoOverlayVideoRenderer) + Send + Sync + 'static, >( this: *mut ffi::GstPlayVideoOverlayVideoRenderer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::video-sink".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_video_sink_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "window-handle")] pub fn connect_window_handle_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_window_handle_trampoline< F: Fn(&PlayVideoOverlayVideoRenderer) + Send + Sync + 'static, >( this: *mut ffi::GstPlayVideoOverlayVideoRenderer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::window-handle".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_window_handle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } unsafe impl Send for PlayVideoOverlayVideoRenderer {} unsafe impl Sync for PlayVideoOverlayVideoRenderer {} gstreamer-play-0.24.0/src/auto/play_video_renderer.rs000064400000000000000000000014641046102023000207760ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::ffi; use glib::prelude::*; glib::wrapper! { #[doc(alias = "GstPlayVideoRenderer")] pub struct PlayVideoRenderer(Interface); match fn { type_ => || ffi::gst_play_video_renderer_get_type(), } } impl PlayVideoRenderer { pub const NONE: Option<&'static PlayVideoRenderer> = None; } unsafe impl Send for PlayVideoRenderer {} unsafe impl Sync for PlayVideoRenderer {} pub trait PlayVideoRendererExt: IsA + 'static {} impl> PlayVideoRendererExt for O {} gstreamer-play-0.24.0/src/auto/play_visualization.rs000064400000000000000000000012401046102023000206730ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::ffi; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct PlayVisualization(Boxed); match fn { copy => |ptr| ffi::gst_play_visualization_copy(ptr), free => |ptr| ffi::gst_play_visualization_free(ptr), type_ => || ffi::gst_play_visualization_get_type(), } } unsafe impl Send for PlayVisualization {} unsafe impl Sync for PlayVisualization {} gstreamer-play-0.24.0/src/auto/versions.txt000064400000000000000000000003421046102023000170120ustar 00000000000000Generated by gir (https://github.com/gtk-rs/gir @ 19ccbbc9a3d1) from gir-files (https://github.com/gtk-rs/gir-files @ 5c1e490fe50a) from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ fddf588f73ea) gstreamer-play-0.24.0/src/config.rs000064400000000000000000000076741046102023000152630ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use std::{mem, ops}; use crate::ffi; use glib::translate::*; #[derive(Debug, Clone, PartialEq, Eq)] pub struct PlayConfig(gst::Structure); impl ops::Deref for PlayConfig { type Target = gst::StructureRef; #[inline] fn deref(&self) -> &gst::StructureRef { self.0.deref() } } impl ops::DerefMut for PlayConfig { #[inline] fn deref_mut(&mut self) -> &mut gst::StructureRef { self.0.deref_mut() } } impl AsRef for PlayConfig { #[inline] fn as_ref(&self) -> &gst::StructureRef { self.0.as_ref() } } impl AsMut for PlayConfig { #[inline] fn as_mut(&mut self) -> &mut gst::StructureRef { self.0.as_mut() } } impl PlayConfig { #[doc(alias = "get_position_update_interval")] #[doc(alias = "gst_play_config_get_position_update_interval")] pub fn position_update_interval(&self) -> u32 { skip_assert_initialized!(); unsafe { ffi::gst_play_config_get_position_update_interval(self.0.to_glib_none().0) } } #[doc(alias = "gst_play_config_set_position_update_interval")] pub fn set_position_update_interval(&mut self, interval: u32) { skip_assert_initialized!(); unsafe { ffi::gst_play_config_set_position_update_interval( self.0.to_glib_none_mut().0, interval, ); } } #[doc(alias = "get_seek_accurate")] pub fn is_seek_accurate(&self) -> bool { skip_assert_initialized!(); unsafe { from_glib(ffi::gst_play_config_get_seek_accurate( self.0.to_glib_none().0, )) } } pub fn set_seek_accurate(&mut self, accurate: bool) { skip_assert_initialized!(); // FIXME: Work-around for // http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=cc58bd6ae071dec4ea7b4be626034accd0372755 self.set("accurate-seek", accurate); } #[doc(alias = "get_user_agent")] #[doc(alias = "gst_play_config_get_user_agent")] pub fn user_agent(&self) -> Option { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gst_play_config_get_user_agent(self.0.to_glib_none().0)) } } #[doc(alias = "gst_play_config_set_user_agent")] pub fn set_user_agent(&mut self, agent: &str) { skip_assert_initialized!(); unsafe { ffi::gst_play_config_set_user_agent( self.0.to_glib_none_mut().0, agent.to_glib_none().0, ); } } #[cfg(feature = "v1_24")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))] #[doc(alias = "gst_play_config_get_pipeline_dump_in_error_details")] pub fn pipeline_dump_in_error_details(&self) -> bool { skip_assert_initialized!(); unsafe { from_glib(ffi::gst_play_config_get_pipeline_dump_in_error_details( self.0.to_glib_none().0, )) } } #[cfg(feature = "v1_24")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))] #[doc(alias = "gst_play_config_set_pipeline_dump_in_error_details")] pub fn set_pipeline_dump_in_error_details(&mut self, pipeline_dump_in_error_details: bool) { skip_assert_initialized!(); unsafe { ffi::gst_play_config_set_pipeline_dump_in_error_details( self.0.to_glib_none_mut().0, pipeline_dump_in_error_details.into_glib(), ); } } } impl IntoGlibPtr<*mut gst::ffi::GstStructure> for PlayConfig { #[inline] fn into_glib_ptr(self) -> *mut gst::ffi::GstStructure { let mut s = mem::ManuallyDrop::new(self); s.0.to_glib_none_mut().0 } } impl FromGlibPtrFull<*mut gst::ffi::GstStructure> for PlayConfig { #[inline] unsafe fn from_glib_full(ptr: *mut gst::ffi::GstStructure) -> Self { PlayConfig(from_glib_full(ptr)) } } gstreamer-play-0.24.0/src/lib.rs000064400000000000000000000023021046102023000145430ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #![cfg_attr(docsrs, feature(doc_cfg))] #![allow(clippy::missing_safety_doc)] #![allow(clippy::manual_c_str_literals)] #![doc = include_str!("../README.md")] pub use gst; pub use gst_video; pub use gstreamer_play_sys as ffi; macro_rules! skip_assert_initialized { () => {}; } macro_rules! assert_initialized_main_thread { () => { if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) { gst::assert_initialized(); } }; } #[allow(clippy::needless_borrow)] #[allow(unused)] #[allow(unused_imports)] mod auto; pub(crate) use crate::auto::PlayMessage as PlayMessageType; pub use crate::auto::*; pub mod subclass; mod config; mod play; pub use crate::config::*; mod play_video_info; mod play_signal_adapter; mod play_video_overlay_video_renderer; mod play_visualization; pub mod play_message; pub use crate::play_message::PlayMessage; // Re-export all the traits in a prelude module, so that applications // can always "use gst_player::prelude::*" without getting conflicts pub mod prelude { #[doc(hidden)] pub use gst_video::prelude::*; pub use crate::auto::traits::*; } gstreamer-play-0.24.0/src/play.rs000064400000000000000000000025031046102023000147450ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use glib::translate::*; use crate::{ffi, Play}; impl Play { #[doc(alias = "get_config")] #[doc(alias = "gst_play_get_config")] pub fn config(&self) -> crate::PlayConfig { unsafe { from_glib_full(ffi::gst_play_get_config(self.to_glib_none().0)) } } #[doc(alias = "gst_play_set_config")] pub fn set_config(&self, config: crate::PlayConfig) -> Result<(), glib::error::BoolError> { unsafe { glib::result_from_gboolean!( ffi::gst_play_set_config(self.to_glib_none().0, config.into_glib_ptr()), "Failed to set config", ) } } #[doc(alias = "gst_play_get_video_snapshot")] #[doc(alias = "get_video_snapshot")] pub fn video_snapshot( &self, format: crate::PlaySnapshotFormat, config: Option<&gst::StructureRef>, ) -> Option { unsafe { from_glib_full(ffi::gst_play_get_video_snapshot( self.to_glib_none().0, format.into_glib(), mut_override(config.map(|c| c.as_ptr()).unwrap_or(std::ptr::null())), )) } } } impl Default for Play { fn default() -> Self { Self::new(None::) } } gstreamer-play-0.24.0/src/play_message.rs000064400000000000000000000523531046102023000164610ustar 00000000000000use crate::{Play, PlayMediaInfo, PlayMessageType, PlayState}; #[derive(Debug)] #[non_exhaustive] #[doc(alias = "GstPlayMessage")] pub enum PlayMessage<'a> { #[doc(alias = "GST_PLAY_MESSAGE_URI_LOADED")] UriLoaded(&'a UriLoaded), #[doc(alias = "GST_PLAY_MESSAGE_POSITION_UPDATED")] PositionUpdated(&'a PositionUpdated), #[doc(alias = "GST_PLAY_MESSAGE_DURATION_CHANGED")] DurationChanged(&'a DurationChanged), #[doc(alias = "GST_PLAY_MESSAGE_STATE_CHANGED")] StateChanged(&'a StateChanged), #[doc(alias = "GST_PLAY_MESSAGE_BUFFERING")] Buffering(&'a Buffering), #[doc(alias = "GST_PLAY_MESSAGE_END_OF_STREAM")] EndOfStream(&'a EndOfStream), #[doc(alias = "GST_PLAY_MESSAGE_ERROR")] Error(&'a Error), #[doc(alias = "GST_PLAY_MESSAGE_WARNING")] Warning(&'a Warning), #[doc(alias = "GST_PLAY_MESSAGE_VIDEO_DIMENSIONS_CHANGED")] VideoDimensionsChanged(&'a VideoDimensionsChanged), #[doc(alias = "GST_PLAY_MESSAGE_MEDIA_INFO_UPDATED")] MediaInfoUpdated(&'a MediaInfoUpdated), #[doc(alias = "GST_PLAY_MESSAGE_VOLUME_CHANGED")] VolumeChanged(&'a VolumeChanged), #[doc(alias = "GST_PLAY_MESSAGE_MUTE_CHANGED")] MuteChanged(&'a MuteChanged), #[doc(alias = "GST_PLAY_MESSAGE_SEEK_DONE")] SeekDone(&'a SeekDone), Other(&'a Other), } macro_rules! declare_concrete_message( ($name:ident) => { #[repr(transparent)] pub struct $name(T); impl $name { #[inline] pub fn message(&self) -> &gst::MessageRef { unsafe { &*(self as *const Self as *const gst::MessageRef) } } #[inline] unsafe fn view(message: &gst::MessageRef) -> PlayMessage<'_> { let message = &*(message as *const gst::MessageRef as *const Self); PlayMessage::$name(message) } } impl std::ops::Deref for $name { type Target = gst::MessageRef; #[inline] fn deref(&self) -> &Self::Target { unsafe { &*(self as *const Self as *const Self::Target) } } } impl ToOwned for $name { type Owned = $name; #[inline] fn to_owned(&self) -> Self::Owned { $name::(self.copy()) } } impl std::ops::Deref for $name { type Target = $name; #[inline] fn deref(&self) -> &Self::Target { unsafe { &*(self.0.as_ptr() as *const Self::Target) } } } impl std::borrow::Borrow<$name> for $name { #[inline] fn borrow(&self) -> &$name { &*self } } impl From<$name> for gst::Message { #[inline] fn from(concrete: $name) -> Self { skip_assert_initialized!(); concrete.0 } } } ); declare_concrete_message!(UriLoaded); impl UriLoaded { pub fn uri(&self) -> &glib::GStr { self.message().structure().unwrap().get("uri").unwrap() } } impl std::fmt::Debug for UriLoaded { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("UriLoaded") .field("structure", &self.message().structure()) .field("uri", &self.uri()) .finish() } } declare_concrete_message!(PositionUpdated); impl PositionUpdated { pub fn position(&self) -> Option { self.message().structure().unwrap().get("position").unwrap() } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_get_uri")] pub fn uri(&self) -> glib::GString { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gst_play_message_get_uri(mut_override( self.message().as_ptr(), ))) } } } impl std::fmt::Debug for PositionUpdated { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("PositionUpdated") .field("structure", &self.message().structure()) .field("position", &self.position()) .finish() } } declare_concrete_message!(DurationChanged); impl DurationChanged { pub fn duration(&self) -> Option { self.message().structure().unwrap().get("duration").unwrap() } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_get_uri")] pub fn uri(&self) -> glib::GString { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gst_play_message_get_uri(mut_override( self.message().as_ptr(), ))) } } } impl std::fmt::Debug for DurationChanged { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("DurationChanged") .field("structure", &self.message().structure()) .field("duration", &self.duration()) .finish() } } declare_concrete_message!(StateChanged); impl StateChanged { pub fn state(&self) -> PlayState { self.message() .structure() .unwrap() .get("play-state") .unwrap() } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_get_uri")] pub fn uri(&self) -> glib::GString { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gst_play_message_get_uri(mut_override( self.message().as_ptr(), ))) } } } impl std::fmt::Debug for StateChanged { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("StateChanged") .field("structure", &self.message().structure()) .field("state", &self.state()) .finish() } } declare_concrete_message!(Buffering); impl Buffering { pub fn percent(&self) -> u32 { self.message() .structure() .unwrap() // Typo in the library .get("bufferring-percent") .unwrap() } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_get_uri")] pub fn uri(&self) -> glib::GString { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gst_play_message_get_uri(mut_override( self.message().as_ptr(), ))) } } } impl std::fmt::Debug for Buffering { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Buffering") .field("structure", &self.message().structure()) .field("percent", &self.percent()) .finish() } } declare_concrete_message!(EndOfStream); impl std::fmt::Debug for EndOfStream { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("EndOfStream") .field("structure", &self.message().structure()) .finish() } } declare_concrete_message!(Error); impl Error { pub fn error(&self) -> &glib::Error { self.message().structure().unwrap().get("error").unwrap() } pub fn details(&self) -> Option<&gst::StructureRef> { self.message() .structure() .unwrap() .get_optional("error-details") .unwrap() } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_get_uri")] pub fn uri(&self) -> glib::GString { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gst_play_message_get_uri(mut_override( self.message().as_ptr(), ))) } } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_get_stream_id")] pub fn stream_id(&self) -> Option { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gst_play_message_get_stream_id(mut_override( self.message().as_ptr(), ))) } } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_parse_error_missing_plugin")] pub fn missing_plugin(&self) -> Option> { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { let mut descriptions = std::ptr::null_mut(); let mut installer_details = std::ptr::null_mut(); let ret = from_glib(ffi::gst_play_message_parse_error_missing_plugin( mut_override(self.message().as_ptr()), &mut descriptions, &mut installer_details, )); if ret { let mut ret = Vec::new(); for idx in 0.. { let description = *descriptions.add(idx); let installer_detail = *installer_details.add(idx); if description.is_null() { assert!(installer_detail.is_null()); break; } ret.push(( glib::GString::from_glib_full(description), glib::GString::from_glib_full(installer_detail), )); } glib::ffi::g_free(descriptions as glib::ffi::gpointer); glib::ffi::g_free(installer_details as glib::ffi::gpointer); Some(ret) } else { None } } } } impl std::fmt::Debug for Error { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Error") .field("structure", &self.message().structure()) .field("error", &self.error()) .field("details", &self.details()) .finish() } } declare_concrete_message!(Warning); impl Warning { pub fn error(&self) -> &glib::Error { self.message().structure().unwrap().get("warning").unwrap() } pub fn details(&self) -> Option<&gst::StructureRef> { self.message() .structure() .unwrap() .get_optional("warning-details") .unwrap() } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_get_uri")] pub fn uri(&self) -> glib::GString { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gst_play_message_get_uri(mut_override( self.message().as_ptr(), ))) } } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_get_stream_id")] pub fn stream_id(&self) -> Option { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gst_play_message_get_stream_id(mut_override( self.message().as_ptr(), ))) } } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_parse_warning_missing_plugin")] pub fn missing_plugin(&self) -> Option> { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { let mut descriptions = std::ptr::null_mut(); let mut installer_details = std::ptr::null_mut(); let ret = from_glib(ffi::gst_play_message_parse_warning_missing_plugin( mut_override(self.message().as_ptr()), &mut descriptions, &mut installer_details, )); if ret { let mut ret = Vec::new(); for idx in 0.. { let description = *descriptions.add(idx); let installer_detail = *installer_details.add(idx); if description.is_null() { assert!(installer_detail.is_null()); break; } ret.push(( glib::GString::from_glib_full(description), glib::GString::from_glib_full(installer_detail), )); } glib::ffi::g_free(descriptions as glib::ffi::gpointer); glib::ffi::g_free(installer_details as glib::ffi::gpointer); Some(ret) } else { None } } } } impl std::fmt::Debug for Warning { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Warning") .field("structure", &self.message().structure()) .field("error", &self.error()) .field("details", &self.details()) .finish() } } declare_concrete_message!(VideoDimensionsChanged); impl VideoDimensionsChanged { pub fn width(&self) -> u32 { self.message() .structure() .unwrap() .get("video-width") .unwrap() } pub fn height(&self) -> u32 { self.message() .structure() .unwrap() .get("video-height") .unwrap() } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_get_uri")] pub fn uri(&self) -> glib::GString { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gst_play_message_get_uri(mut_override( self.message().as_ptr(), ))) } } } impl std::fmt::Debug for VideoDimensionsChanged { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("VideoDimensionsChanged") .field("structure", &self.message().structure()) .field("width", &self.width()) .field("height", &self.height()) .finish() } } declare_concrete_message!(MediaInfoUpdated); impl MediaInfoUpdated { pub fn media_info(&self) -> &PlayMediaInfo { self.message() .structure() .unwrap() .get("media-info") .unwrap() } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_get_uri")] pub fn uri(&self) -> glib::GString { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gst_play_message_get_uri(mut_override( self.message().as_ptr(), ))) } } } impl std::fmt::Debug for MediaInfoUpdated { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("MediaInfoUpdated") .field("structure", &self.message().structure()) .field("media_info", &self.media_info()) .finish() } } declare_concrete_message!(VolumeChanged); impl VolumeChanged { pub fn volume(&self) -> f64 { self.message().structure().unwrap().get("volume").unwrap() } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_get_uri")] pub fn uri(&self) -> glib::GString { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gst_play_message_get_uri(mut_override( self.message().as_ptr(), ))) } } } impl std::fmt::Debug for VolumeChanged { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("VolumeChanged") .field("structure", &self.message().structure()) .field("volume", &self.volume()) .finish() } } declare_concrete_message!(MuteChanged); impl MuteChanged { pub fn is_muted(&self) -> bool { self.message().structure().unwrap().get("is-muted").unwrap() } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_get_uri")] pub fn uri(&self) -> glib::GString { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gst_play_message_get_uri(mut_override( self.message().as_ptr(), ))) } } } impl std::fmt::Debug for MuteChanged { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("MuteChanged") .field("structure", &self.message().structure()) .field("is_muted", &self.is_muted()) .finish() } } declare_concrete_message!(SeekDone); impl SeekDone { pub fn position(&self) -> Option { self.message().structure().unwrap().get("position").unwrap() } #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_get_uri")] pub fn uri(&self) -> glib::GString { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gst_play_message_get_uri(mut_override( self.message().as_ptr(), ))) } } } impl std::fmt::Debug for SeekDone { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("SeekDone") .field("structure", &self.message().structure()) .field("position", &self.position()) .finish() } } declare_concrete_message!(Other); impl Other { #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_get_uri")] pub fn uri(&self) -> glib::GString { use crate::ffi; use glib::translate::*; assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gst_play_message_get_uri(mut_override( self.message().as_ptr(), ))) } } } impl std::fmt::Debug for Other { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Other") .field("structure", &self.message().structure()) .finish() } } impl PlayMessage<'_> { #[doc(alias = "gst_play_message_parse_uri_loaded")] #[doc(alias = "gst_play_message_parse_position_updated")] #[doc(alias = "gst_play_message_parse_duration_updated")] #[doc(alias = "gst_play_message_parse_duration_changed")] #[doc(alias = "gst_play_message_parse_state_changed")] #[doc(alias = "gst_play_message_parse_buffering")] #[doc(alias = "gst_play_message_parse_buffering_percent")] #[doc(alias = "gst_play_message_parse_error")] #[doc(alias = "gst_play_message_parse_warning")] #[doc(alias = "gst_play_message_parse_video_dimensions_changed")] #[doc(alias = "gst_play_message_parse_media_info_updated")] #[doc(alias = "gst_play_message_parse_muted_changed")] #[doc(alias = "gst_play_message_parse_volume_changed")] #[doc(alias = "gst_play_message_parse_seek_done")] pub fn parse(msg: &gst::Message) -> Result, glib::error::BoolError> { skip_assert_initialized!(); if !Play::is_play_message(msg) { return Err(glib::bool_error!("Invalid play message")); } unsafe { match PlayMessageType::parse_type(msg) { PlayMessageType::UriLoaded => Ok(UriLoaded::view(msg)), PlayMessageType::PositionUpdated => Ok(PositionUpdated::view(msg)), PlayMessageType::DurationChanged => Ok(DurationChanged::view(msg)), PlayMessageType::StateChanged => Ok(StateChanged::view(msg)), PlayMessageType::Buffering => Ok(Buffering::view(msg)), PlayMessageType::EndOfStream => Ok(EndOfStream::view(msg)), PlayMessageType::Error => Ok(Error::view(msg)), PlayMessageType::Warning => Ok(Warning::view(msg)), PlayMessageType::VideoDimensionsChanged => Ok(VideoDimensionsChanged::view(msg)), PlayMessageType::MediaInfoUpdated => Ok(MediaInfoUpdated::view(msg)), PlayMessageType::VolumeChanged => Ok(VolumeChanged::view(msg)), PlayMessageType::MuteChanged => Ok(MuteChanged::view(msg)), PlayMessageType::SeekDone => Ok(SeekDone::view(msg)), _ => Ok(Other::view(msg)), } } } } gstreamer-play-0.24.0/src/play_signal_adapter.rs000064400000000000000000000066271046102023000200150ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use std::{boxed::Box as Box_, mem::transmute}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use crate::{ffi, PlaySignalAdapter}; impl PlaySignalAdapter { #[doc(alias = "duration-changed")] pub fn connect_duration_changed< F: Fn(&PlaySignalAdapter, Option) + Send + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn duration_changed_trampoline< F: Fn(&PlaySignalAdapter, Option) + Send + 'static, >( this: *mut ffi::GstPlaySignalAdapter, object: u64, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), FromGlib::from_glib(object)) } #[allow(clippy::cast_ptr_alignment)] unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"duration-changed\0".as_ptr() as *const _, Some(transmute::<*const (), unsafe extern "C" fn()>( duration_changed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "position-updated")] pub fn connect_position_updated< F: Fn(&PlaySignalAdapter, Option) + Send + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn position_updated_trampoline< F: Fn(&PlaySignalAdapter, Option) + Send + 'static, >( this: *mut ffi::GstPlaySignalAdapter, object: u64, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), FromGlib::from_glib(object)) } #[allow(clippy::cast_ptr_alignment)] unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"position-updated\0".as_ptr() as *const _, Some(transmute::<*const (), unsafe extern "C" fn()>( position_updated_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "seek-done")] pub fn connect_seek_done( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn seek_done_trampoline< F: Fn(&PlaySignalAdapter, gst::ClockTime) + Send + 'static, >( this: *mut ffi::GstPlaySignalAdapter, object: u64, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), try_from_glib(object).expect("undefined seek position"), ) } #[allow(clippy::cast_ptr_alignment)] unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"seek-done\0".as_ptr() as *const _, Some(transmute::<*const (), unsafe extern "C" fn()>( seek_done_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } gstreamer-play-0.24.0/src/play_video_info.rs000064400000000000000000000023751046102023000171550ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use std::mem; use glib::translate::*; use crate::{ffi, PlayVideoInfo}; impl PlayVideoInfo { #[doc(alias = "get_framerate")] #[doc(alias = "gst_play_video_info_get_framerate")] pub fn framerate(&self) -> gst::Fraction { unsafe { let mut fps_n = mem::MaybeUninit::uninit(); let mut fps_d = mem::MaybeUninit::uninit(); ffi::gst_play_video_info_get_framerate( self.to_glib_none().0, fps_n.as_mut_ptr(), fps_d.as_mut_ptr(), ); (fps_n.assume_init(), fps_d.assume_init()).into() } } #[doc(alias = "get_pixel_aspect_ratio")] #[doc(alias = "gst_play_video_info_get_pixel_aspect_ratio")] pub fn pixel_aspect_ratio(&self) -> gst::Fraction { unsafe { let mut par_n = mem::MaybeUninit::uninit(); let mut par_d = mem::MaybeUninit::uninit(); ffi::gst_play_video_info_get_pixel_aspect_ratio( self.to_glib_none().0, par_n.as_mut_ptr(), par_d.as_mut_ptr(), ); (par_n.assume_init() as i32, par_d.assume_init() as i32).into() } } } gstreamer-play-0.24.0/src/play_video_overlay_video_renderer.rs000064400000000000000000000033711046102023000227540ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use std::ptr; use glib::{prelude::*, translate::*}; use libc::uintptr_t; use crate::{ffi, PlayVideoOverlayVideoRenderer}; impl PlayVideoOverlayVideoRenderer { pub unsafe fn new(window_handle: uintptr_t) -> PlayVideoOverlayVideoRenderer { assert_initialized_main_thread!(); from_glib_full( ffi::gst_play_video_overlay_video_renderer_new(window_handle as *mut _) as *mut _, ) } pub unsafe fn with_handle_and_sink>( window_handle: uintptr_t, video_sink: &P, ) -> PlayVideoOverlayVideoRenderer { skip_assert_initialized!(); from_glib_full(ffi::gst_play_video_overlay_video_renderer_new_with_sink( window_handle as *mut _, video_sink.as_ref().to_glib_none().0, ) as *mut _) } #[doc(alias = "gst_play_video_overlay_video_renderer_new_with_sink")] pub fn with_sink>(video_sink: &P) -> PlayVideoOverlayVideoRenderer { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gst_play_video_overlay_video_renderer_new_with_sink( ptr::null_mut(), video_sink.as_ref().to_glib_none().0, ) as *mut _) } } #[doc(alias = "get_window_handle")] pub unsafe fn window_handle(&self) -> uintptr_t { ffi::gst_play_video_overlay_video_renderer_get_window_handle(self.to_glib_none().0) as uintptr_t } pub unsafe fn set_window_handle(&self, window_handle: uintptr_t) { ffi::gst_play_video_overlay_video_renderer_set_window_handle( self.to_glib_none().0, window_handle as *mut _, ) } } gstreamer-play-0.24.0/src/play_visualization.rs000064400000000000000000000007111046102023000177250ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use std::ffi::CStr; use crate::PlayVisualization; impl PlayVisualization { pub fn name(&self) -> &str { unsafe { CStr::from_ptr((*self.as_ptr()).name).to_str().unwrap() } } pub fn description(&self) -> &str { unsafe { CStr::from_ptr((*self.as_ptr()).description) .to_str() .unwrap() } } } gstreamer-play-0.24.0/src/subclass/mod.rs000064400000000000000000000004251046102023000163770ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. mod play_video_renderer; pub mod prelude { #[doc(hidden)] pub use gst::subclass::prelude::*; pub use super::play_video_renderer::{PlayVideoRendererImpl, PlayVideoRendererImplExt}; } gstreamer-play-0.24.0/src/subclass/play_video_renderer.rs000064400000000000000000000052601046102023000216430ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use glib::{prelude::*, subclass::prelude::*, translate::*}; use crate::{ffi, Play, PlayVideoRenderer}; pub trait PlayVideoRendererImpl: ObjectImpl + ObjectSubclass> { fn create_video_sink(&self, play: &Play) -> gst::Element; } unsafe impl IsImplementable for PlayVideoRenderer { fn interface_init(iface: &mut glib::Interface) { let iface = iface.as_mut(); iface.create_video_sink = Some(video_renderer_create_video_sink::); } } pub trait PlayVideoRendererImplExt: PlayVideoRendererImpl { fn parent_create_video_sink(&self, play: &Play) -> gst::Element { unsafe { let type_data = Self::type_data(); let parent_iface = type_data.as_ref().parent_interface::() as *const ffi::GstPlayVideoRendererInterface; let func = (*parent_iface) .create_video_sink .expect("no parent \"create_video_sink\" implementation"); let ret = func( self.obj() .unsafe_cast_ref::() .to_glib_none() .0, play.to_glib_none().0, ); from_glib_none(ret) } } } impl PlayVideoRendererImplExt for T {} unsafe extern "C" fn video_renderer_create_video_sink( video_renderer: *mut ffi::GstPlayVideoRenderer, play: *mut ffi::GstPlay, ) -> *mut gst::ffi::GstElement { static VIDEO_SINK_QUARK: std::sync::OnceLock = std::sync::OnceLock::new(); let video_sink_quark = VIDEO_SINK_QUARK.get_or_init(|| glib::Quark::from_str("gstreamer-rs-play-video-sink")); let instance = &*(video_renderer as *mut T::Instance); let imp = instance.imp(); let sink = imp.create_video_sink(&Play::from_glib_borrow(play)); let sink_ptr: *mut gst::ffi::GstElement = sink.to_glib_none().0; let old_sink_ptr = glib::gobject_ffi::g_object_get_qdata( video_renderer as *mut _, video_sink_quark.into_glib(), ) as *mut gst::ffi::GstElement; if !old_sink_ptr.is_null() && old_sink_ptr != sink_ptr { panic!("Video sink must not change"); } unsafe extern "C" fn unref(ptr: glib::ffi::gpointer) { glib::gobject_ffi::g_object_unref(ptr as *mut _); } glib::gobject_ffi::g_object_set_qdata_full( video_renderer as *mut _, video_sink_quark.into_glib(), glib::gobject_ffi::g_object_ref(sink_ptr as *mut _) as *mut _, Some(unref), ); sink_ptr } gstreamer-play-0.24.0/tests/check_gir.rs000064400000000000000000000003461046102023000162740ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); println!("{res}"); assert_eq!(res.nb_errors, 0); } gstreamer-play-0.24.0/tests/manual.h000064400000000000000000000001651046102023000154350ustar 00000000000000// Feel free to edit this file, it won't be regenerated by gir generator unless removed. #include