Add Source support to GstBus, and the sync message handler

This commit is contained in:
Sebastian Dröge 2017-07-11 19:29:16 +03:00
parent 71c0885575
commit 9cfb83d6a2
28 changed files with 108 additions and 268 deletions

228
Cargo.lock generated
View file

@ -7,19 +7,7 @@ dependencies = [
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gstreamer-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)", "gstreamer-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "atk-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#113444397b56ffda5214ffcc5a2ed80c25020fe5"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -27,157 +15,44 @@ name = "bitflags"
version = "0.9.1" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "c_vec"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cairo-rs"
version = "0.1.3"
source = "git+https://github.com/gtk-rs/cairo#ef0c3315a57b5cd7134801779c111c6b7d84a410"
dependencies = [
"c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)",
"glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cairo-sys-rs"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/cairo#ef0c3315a57b5cd7134801779c111c6b7d84a410"
dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "examples" name = "examples"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"glib 0.1.3 (git+https://github.com/gtk-rs/glib)", "glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gstreamer 0.1.0", "gstreamer 0.1.0",
"gstreamer-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)",
"gtk 0.1.3 (git+https://github.com/gtk-rs/gtk)",
]
[[package]]
name = "gdk"
version = "0.5.3"
source = "git+https://github.com/gtk-rs/gdk#6f6487a46874be4e96659f6697b480a8345d2690"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)",
"cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)",
"gdk-pixbuf 0.1.3 (git+https://github.com/gtk-rs/gdk-pixbuf)",
"gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gio 0.1.3 (git+https://github.com/gtk-rs/gio)",
"glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"pango 0.1.3 (git+https://github.com/gtk-rs/pango)",
]
[[package]]
name = "gdk-pixbuf"
version = "0.1.3"
source = "git+https://github.com/gtk-rs/gdk-pixbuf#191812c0157e798dd680a34120bb1a5512bdb23f"
dependencies = [
"gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gdk-pixbuf-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#113444397b56ffda5214ffcc5a2ed80c25020fe5"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gdk-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#113444397b56ffda5214ffcc5a2ed80c25020fe5"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)",
"gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gio"
version = "0.1.3"
source = "git+https://github.com/gtk-rs/gio#c410bf7ca4561b6ee9a48e605474824e3eff85e5"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gio-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#113444397b56ffda5214ffcc5a2ed80c25020fe5"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "glib" name = "glib"
version = "0.1.3" version = "0.1.3"
source = "git+https://github.com/gtk-rs/glib#f874842c0a660165c08c2b522551cd6673431b39" source = "git+https://github.com/gtk-rs/glib#aaad1963ea3b1b45c62a3f49a7a1ed0a7f3b12ab"
dependencies = [ dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "glib-sys" name = "glib-sys"
version = "0.3.4" version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#113444397b56ffda5214ffcc5a2ed80c25020fe5" source = "git+https://github.com/gtk-rs/sys#9354d21dfdb9174bfecafbd75cf2a7c0c8ba5759"
dependencies = [ dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "gobject-sys" name = "gobject-sys"
version = "0.3.4" version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#113444397b56ffda5214ffcc5a2ed80c25020fe5" source = "git+https://github.com/gtk-rs/sys#9354d21dfdb9174bfecafbd75cf2a7c0c8ba5759"
dependencies = [ dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -189,47 +64,7 @@ dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gtk"
version = "0.1.3"
source = "git+https://github.com/gtk-rs/gtk#bdf8319b8457dcca0b894ef1563fc0fc55ba2b45"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)",
"cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)",
"gdk 0.5.3 (git+https://github.com/gtk-rs/gdk)",
"gdk-pixbuf 0.1.3 (git+https://github.com/gtk-rs/gdk-pixbuf)",
"gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gio 0.1.3 (git+https://github.com/gtk-rs/gio)",
"gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"pango 0.1.3 (git+https://github.com/gtk-rs/pango)",
]
[[package]]
name = "gtk-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#113444397b56ffda5214ffcc5a2ed80c25020fe5"
dependencies = [
"atk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)",
"gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -240,63 +75,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.24" version = "0.2.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "pango"
version = "0.1.3"
source = "git+https://github.com/gtk-rs/pango#e60e984a7e22e73c7de42adb5a485dde665a43e2"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
]
[[package]]
name = "pango-sys"
version = "0.3.4"
source = "git+https://github.com/gtk-rs/sys#113444397b56ffda5214ffcc5a2ed80c25020fe5"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.9" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata] [metadata]
"checksum atk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
"checksum c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6237ac5a4b1e81c213c24c6437964c61e646df910a914b4ab1487b46df20bd13"
"checksum cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)" = "<none>"
"checksum cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)" = "<none>"
"checksum gdk 0.5.3 (git+https://github.com/gtk-rs/gdk)" = "<none>"
"checksum gdk-pixbuf 0.1.3 (git+https://github.com/gtk-rs/gdk-pixbuf)" = "<none>"
"checksum gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum gio 0.1.3 (git+https://github.com/gtk-rs/gio)" = "<none>"
"checksum gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum glib 0.1.3 (git+https://github.com/gtk-rs/glib)" = "<none>" "checksum glib 0.1.3 (git+https://github.com/gtk-rs/glib)" = "<none>"
"checksum glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>" "checksum glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>" "checksum gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum gstreamer-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)" = "<none>" "checksum gstreamer-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)" = "<none>"
"checksum gtk 0.1.3 (git+https://github.com/gtk-rs/gtk)" = "<none>"
"checksum gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" "checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf"
"checksum libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)" = "38f5c2b18a287cf78b4097db62e20f43cace381dc76ae5c0a3073067f78b7ddc" "checksum libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)" = "30885bcb161cf67054244d10d4a7f4835ffd58773bc72e07d35fecf472295503"
"checksum pango 0.1.3 (git+https://github.com/gtk-rs/pango)" = "<none>"
"checksum pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" "checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"

View file

@ -47,10 +47,12 @@ generate = [
"Gst.StreamFlags", "Gst.StreamFlags",
"Gst.PadLinkReturn", "Gst.PadLinkReturn",
"Gst.ProgressType", "Gst.ProgressType",
"Gst.BusSyncReply",
] ]
manual = [ manual = [
"GLib.Error", "GLib.Error",
"GLib.Source",
"Gst.Message", "Gst.Message",
"Gst.Structure", "Gst.Structure",
] ]
@ -100,6 +102,11 @@ trait = false
# Uses enum as flags # Uses enum as flags
ignore = true ignore = true
[[object.function]]
name = "create_watch"
# More convenient manual implementation
ignore = true
[[object]] [[object]]
name = "Gst.Caps" name = "Gst.Caps"
status = "manual" status = "manual"

View file

@ -5,11 +5,7 @@ authors = ["Sebastian Dröge <sebastian@centricular.com>"]
[dependencies] [dependencies]
glib = { version = "0.1.3", git = "https://github.com/gtk-rs/glib" } glib = { version = "0.1.3", git = "https://github.com/gtk-rs/glib" }
gtk = { version = "0.1.3", git = "https://github.com/gtk-rs/gtk" }
gstreamer = { path = "../gstreamer" } gstreamer = { path = "../gstreamer" }
glib-sys = { version = "0.3.4", git = "https://github.com/gtk-rs/sys" }
gobject-sys = { version = "0.3.4", git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { version = "0.1.1", git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
[[bin]] [[bin]]
name = "launch" name = "launch"

View file

@ -1,16 +1,16 @@
extern crate gstreamer as gst; extern crate gstreamer as gst;
use gst::*; use gst::*;
use gst::ObjectExt as GstObjectExt;
extern crate gtk; extern crate glib;
use glib::*;
use std::u64; use std::u64;
fn main() { fn main() {
gst::init().unwrap(); gst::init().unwrap();
// FIXME: Use glib crate once it has mainloop/etc bindings let main_loop = MainLoop::new(None, false);
// https://github.com/gtk-rs/glib/issues/168
gtk::init().unwrap();
let pipeline = gst::parse_launch("audiotestsrc ! autoaudiosink").unwrap(); let pipeline = gst::parse_launch("audiotestsrc ! autoaudiosink").unwrap();
let bus = pipeline.get_bus().unwrap(); let bus = pipeline.get_bus().unwrap();
@ -18,22 +18,30 @@ fn main() {
let ret = pipeline.set_state(gst::State::Playing); let ret = pipeline.set_state(gst::State::Playing);
assert_ne!(ret, gst::StateChangeReturn::Failure); assert_ne!(ret, gst::StateChangeReturn::Failure);
bus.add_signal_watch(); let main_loop_clone = main_loop.clone();
bus.connect_message(|_, msg| match msg.view() {
MessageView::Eos => gtk::main_quit(), //bus.add_signal_watch();
MessageView::Error(err) => { //bus.connect_message(move |_, msg| {
println!( bus.add_watch(move |_, msg| {
"Error from {}: {} ({:?})", let main_loop = &main_loop_clone;
msg.get_src().get_path_string(), match msg.view() {
err.get_error(), MessageView::Eos => main_loop.quit(),
err.get_debug() MessageView::Error(err) => {
); println!(
gtk::main_quit(); "Error from {}: {} ({:?})",
} msg.get_src().get_path_string(),
_ => (), err.get_error(),
err.get_debug()
);
main_loop.quit();
}
_ => (),
};
glib::Continue(true)
}); });
gtk::main(); main_loop.run();
let ret = pipeline.set_state(gst::State::Null); let ret = pipeline.set_state(gst::State::Null);
assert_ne!(ret, gst::StateChangeReturn::Failure); assert_ne!(ret, gst::StateChangeReturn::Failure);

View file

@ -1,5 +1,8 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
#[allow(unused_imports)]
use auto::*;
pub type ClockTime = u64; pub type ClockTime = u64;
pub type ElementFactoryListType = u64; pub type ElementFactoryListType = u64;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Element; use Element;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ClockTime; use ClockTime;
@ -51,10 +51,6 @@ impl Bus {
// unsafe { TODO: call ffi::gst_bus_async_signal_func() } // unsafe { TODO: call ffi::gst_bus_async_signal_func() }
//} //}
//pub fn create_watch(&self) -> /*Ignored*/Option<glib::Source> {
// unsafe { TODO: call ffi::gst_bus_create_watch() }
//}
pub fn disable_sync_message_emission(&self) { pub fn disable_sync_message_emission(&self) {
unsafe { unsafe {
ffi::gst_bus_disable_sync_message_emission(self.to_glib_none().0); ffi::gst_bus_disable_sync_message_emission(self.to_glib_none().0);
@ -107,7 +103,7 @@ impl Bus {
// unsafe { TODO: call ffi::gst_bus_set_sync_handler() } // unsafe { TODO: call ffi::gst_bus_set_sync_handler() }
//} //}
//pub fn sync_signal_handler<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, message: &mut Message, data: P) -> /*Ignored*/BusSyncReply { //pub fn sync_signal_handler<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, message: &mut Message, data: P) -> BusSyncReply {
// unsafe { TODO: call ffi::gst_bus_sync_signal_handler() } // unsafe { TODO: call ffi::gst_bus_sync_signal_handler() }
//} //}

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ClockTime; use ClockTime;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Caps; use Caps;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Bus; use Bus;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Bus; use Bus;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use DeviceProvider; use DeviceProvider;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Bus; use Bus;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Caps; use Caps;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ffi; use ffi;
@ -46,6 +46,42 @@ impl FromGlib<ffi::GstBufferingMode> for BufferingMode {
} }
} }
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum BusSyncReply {
Drop,
Pass,
Async,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for BusSyncReply {
type GlibType = ffi::GstBusSyncReply;
fn to_glib(&self) -> ffi::GstBusSyncReply {
match *self {
BusSyncReply::Drop => ffi::GST_BUS_DROP,
BusSyncReply::Pass => ffi::GST_BUS_PASS,
BusSyncReply::Async => ffi::GST_BUS_ASYNC,
BusSyncReply::__Unknown(value) => unsafe{std::mem::transmute(value)}
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstBusSyncReply> for BusSyncReply {
fn from_glib(value: ffi::GstBusSyncReply) -> Self {
skip_assert_initialized!();
match value as i32 {
0 => BusSyncReply::Drop,
1 => BusSyncReply::Pass,
2 => BusSyncReply::Async,
value => BusSyncReply::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum CoreError { pub enum CoreError {
Failed, Failed,

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ffi; use ffi;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Bin; use Bin;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
mod bin; mod bin;
@ -74,6 +74,7 @@ pub use self::u_r_i_handler::URIHandlerExt;
mod enums; mod enums;
pub use self::enums::BufferingMode; pub use self::enums::BufferingMode;
pub use self::enums::BusSyncReply;
pub use self::enums::CoreError; pub use self::enums::CoreError;
pub use self::enums::FlowReturn; pub use self::enums::FlowReturn;
pub use self::enums::Format; pub use self::enums::Format;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ClockTime; use ClockTime;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Caps; use Caps;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Caps; use Caps;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Bin; use Bin;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Error; use Error;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Object; use Object;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (33e9567+) from gir-files (???) // This file was generated by gir (7504fb6) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Error; use Error;

View file

@ -230,7 +230,7 @@ mod tests {
fn test_simple() { fn test_simple() {
gst::init(); gst::init();
let caps = CapsRef::new_simple( let caps = Caps::new_simple(
"foo/bar", "foo/bar",
&[ &[
("int", 12.into()), ("int", 12.into()),

View file

@ -55,6 +55,7 @@ pub use caps::Caps;
mod element; mod element;
mod bin; mod bin;
mod bus;
pub use bin::BinExtManual; pub use bin::BinExtManual;
use std::ptr; use std::ptr;