Compare commits

...

25 commits
main ... 0.8

Author SHA1 Message Date
Sebastian Dröge
a871d71d34 Toc::merge() doesn't take ownership of the taglist 2017-11-27 15:20:50 +02:00
Sebastian Dröge
2364bbe85d Update version to 0.8.2 and update changelog 2017-11-11 17:17:33 +01:00
Sebastian Dröge
c232e192f1 Add a table of contents to the README.md 2017-11-11 17:17:33 +01:00
Sebastian Dröge
d3c586633d Update README.md with installation instructions and some links for getting started
https://github.com/sdroege/gstreamer-rs/issues/49
https://github.com/sdroege/gstreamer-rs/issues/50
2017-11-11 17:17:32 +01:00
Sebastian Dröge
c3b1c53812 Free memory of the correct type for the callback structs in appsink/appsrc 2017-11-11 16:44:16 +01:00
Sebastian Dröge
918d66375e Implement StaticType for BufferRef, not Buffer 2017-09-16 19:28:00 +03:00
Sebastian Dröge
ca8b2f5406 Fix documentation URIs 2017-09-15 00:50:03 +03:00
Sebastian Dröge
1e2d9fa691 Update CHANGELOG.md for 0.8.1 2017-09-15 00:37:22 +03:00
Sebastian Dröge
7f58c814a0 Update versions to 0.8.1 2017-09-14 21:55:28 +03:00
Sebastian Dröge
59c7ac6788 Also implement Sync+Send for Event and Message 2017-09-14 21:47:43 +03:00
fengalin
01d7501da2 Implement Sync and Send for Query
Fixes https://github.com/sdroege/gstreamer-rs/pull/35
2017-09-14 21:47:37 +03:00
Sebastian Dröge
c956d082cc Use while-let and CLOCK_TIME_NONE for the bus.timed_pop() loops in the examples/tutorials 2017-09-14 21:47:23 +03:00
Sebastian Dröge
5d5b1e6908 Fix various clippy warnings in examples 2017-09-14 21:47:06 +03:00
Sebastian Dröge
35aeaa1395 Run everything through latest rustfmt-nightly 2017-09-14 21:46:40 +03:00
Sebastian Dröge
74ac0f9cdb Fix/hide various clippy warnings in gstreamer 2017-09-14 21:45:56 +03:00
Sebastian Dröge
3b66ea66e1 Fix various clippy warnings in gstreamer-video 2017-09-14 21:45:46 +03:00
Sebastian Dröge
d99e15aa30 Fix/hide various clippy warnings in gstreamer-player 2017-09-14 21:45:30 +03:00
Sebastian Dröge
6674243cc7 Fix Player constructor on GStreamer 1.12 if a video renderer or signal dispatcher are given 2017-09-10 15:28:43 +03:00
Sebastian Dröge
556b0197fc Conditionally use glib crate in player example 2017-09-01 14:13:16 +03:00
Sebastian Dröge
4900fbe293 Remove Cargo.lock
It's not a good idea to lock to specific versions for library crates.
2017-09-01 13:53:17 +03:00
Sebastian Dröge
5203e80c38 Fix-up various unused external crate warnings 2017-09-01 13:53:02 +03:00
Sebastian Dröge
67d5f06f3b Add README.md to all crate subdirectories
This way it would show up on crates.io
2017-09-01 12:09:12 +03:00
Sebastian Dröge
7a0b380407 Don't return &'static references from functions but give them a generic lifetime
https://github.com/rust-lang/rust/pull/42417#issue-233404573
2017-09-01 12:09:12 +03:00
Sebastian Dröge
7bf0140d27 Use releases instead of GIT for all the dependencies 2017-08-31 13:35:12 +03:00
Sebastian Dröge
3d1a7efb64 Work around gtk/gdk bindings bug in gtkvideooverlay example
https://github.com/gtk-rs/gtk/issues/570
2017-08-31 13:35:12 +03:00
59 changed files with 1483 additions and 1118 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
/target/
**/*.rs.bk
Cargo.lock

735
Cargo.lock generated
View file

@ -1,735 +0,0 @@
[root]
name = "gstreamer-video"
version = "0.8.0"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gstreamer 0.8.0",
"gstreamer-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"gstreamer-video-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"rustdoc-stripper 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "array-init"
version = "0.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "atk-sys"
version = "0.4.0"
source = "git+https://github.com/gtk-rs/sys#7d428511eab76b3cc9ba12aa99285ad54ff6f8d3"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.30 (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 = "bitflags"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "byte-slice-cast"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "byteorder"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bytes"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.0 (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.2.0"
source = "git+https://github.com/gtk-rs/cairo#635b0b89999287c1eb5d1d03f721633a0eee2102"
dependencies = [
"c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.4.0 (git+https://github.com/gtk-rs/cairo)",
"glib 0.3.0 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.30 (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.4.0"
source = "git+https://github.com/gtk-rs/cairo#635b0b89999287c1eb5d1d03f721633a0eee2102"
dependencies = [
"libc 0.2.30 (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]]
name = "cfg-if"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "conv"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "custom_derive"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "examples"
version = "0.8.0"
dependencies = [
"byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk 0.6.0 (git+https://github.com/gtk-rs/gdk)",
"gio 0.2.0 (git+https://github.com/gtk-rs/gio)",
"glib 0.3.0 (git+https://github.com/gtk-rs/glib)",
"gstreamer 0.8.0",
"gstreamer-app 0.8.0",
"gstreamer-audio 0.8.0",
"gstreamer-player 0.8.0",
"gstreamer-video 0.8.0",
"gtk 0.2.0 (git+https://github.com/gtk-rs/gtk)",
"send-cell 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "futures"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "gdk"
version = "0.6.0"
source = "git+https://github.com/gtk-rs/gdk#edd70dfdd246b3f765e01a2064e5dd81ea72e445"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-rs 0.2.0 (git+https://github.com/gtk-rs/cairo)",
"cairo-sys-rs 0.4.0 (git+https://github.com/gtk-rs/cairo)",
"gdk-pixbuf 0.2.0 (git+https://github.com/gtk-rs/gdk-pixbuf)",
"gdk-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gio 0.2.0 (git+https://github.com/gtk-rs/gio)",
"glib 0.3.0 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"pango 0.2.0 (git+https://github.com/gtk-rs/pango)",
]
[[package]]
name = "gdk-pixbuf"
version = "0.2.0"
source = "git+https://github.com/gtk-rs/gdk-pixbuf#3c5fceade1409569acdf584b16284e069307c08d"
dependencies = [
"gdk-pixbuf-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"glib 0.3.0 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gdk-pixbuf-sys"
version = "0.4.0"
source = "git+https://github.com/gtk-rs/sys#7d428511eab76b3cc9ba12aa99285ad54ff6f8d3"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.30 (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.4.0"
source = "git+https://github.com/gtk-rs/sys#7d428511eab76b3cc9ba12aa99285ad54ff6f8d3"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.4.0 (git+https://github.com/gtk-rs/cairo)",
"gdk-pixbuf-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gio-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.4.0 (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.2.0"
source = "git+https://github.com/gtk-rs/gio#c006146a72843776311c6851bbd36abe514f4871"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"glib 0.3.0 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gio-sys"
version = "0.4.0"
source = "git+https://github.com/gtk-rs/sys#7d428511eab76b3cc9ba12aa99285ad54ff6f8d3"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.30 (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 = "glib"
version = "0.3.0"
source = "git+https://github.com/gtk-rs/glib#91b9c2b76310c84c4b904e0f627dc0bc24bfdacb"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "glib-sys"
version = "0.4.0"
source = "git+https://github.com/gtk-rs/sys#7d428511eab76b3cc9ba12aa99285ad54ff6f8d3"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.30 (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 = "gobject-sys"
version = "0.4.0"
source = "git+https://github.com/gtk-rs/sys#7d428511eab76b3cc9ba12aa99285ad54ff6f8d3"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.30 (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 = "gstreamer"
version = "0.8.0"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gstreamer-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"num-rational 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
"rustdoc-stripper 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gstreamer-app"
version = "0.8.0"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gstreamer 0.8.0",
"gstreamer-app-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"gstreamer-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"rustdoc-stripper 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gstreamer-app-sys"
version = "0.2.0"
source = "git+https://github.com/sdroege/gstreamer-sys#2593c0c82add6592131d6ca831a3fdf1e565960b"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gstreamer-base-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"gstreamer-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"libc 0.2.30 (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 = "gstreamer-audio"
version = "0.8.0"
dependencies = [
"array-init 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gstreamer 0.8.0",
"gstreamer-audio-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"gstreamer-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"rustdoc-stripper 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gstreamer-audio-sys"
version = "0.2.0"
source = "git+https://github.com/sdroege/gstreamer-sys#2593c0c82add6592131d6ca831a3fdf1e565960b"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gstreamer-base-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"gstreamer-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"gstreamer-tag-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"libc 0.2.30 (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 = "gstreamer-base-sys"
version = "0.2.0"
source = "git+https://github.com/sdroege/gstreamer-sys#2593c0c82add6592131d6ca831a3fdf1e565960b"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gstreamer-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"libc 0.2.30 (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 = "gstreamer-player"
version = "0.8.0"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gstreamer 0.8.0",
"gstreamer-player-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"gstreamer-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"rustdoc-stripper 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gstreamer-player-sys"
version = "0.2.0"
source = "git+https://github.com/sdroege/gstreamer-sys#2593c0c82add6592131d6ca831a3fdf1e565960b"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gstreamer-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"gstreamer-video-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"libc 0.2.30 (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 = "gstreamer-sys"
version = "0.2.0"
source = "git+https://github.com/sdroege/gstreamer-sys#2593c0c82add6592131d6ca831a3fdf1e565960b"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.30 (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 = "gstreamer-tag-sys"
version = "0.2.0"
source = "git+https://github.com/sdroege/gstreamer-sys#2593c0c82add6592131d6ca831a3fdf1e565960b"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gstreamer-base-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"gstreamer-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"libc 0.2.30 (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 = "gstreamer-video-sys"
version = "0.2.0"
source = "git+https://github.com/sdroege/gstreamer-sys#2593c0c82add6592131d6ca831a3fdf1e565960b"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gstreamer-base-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"gstreamer-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)",
"libc 0.2.30 (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.2.0"
source = "git+https://github.com/gtk-rs/gtk#3ea125db10adacf7406aacb3046d3dc866918e25"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-rs 0.2.0 (git+https://github.com/gtk-rs/cairo)",
"cairo-sys-rs 0.4.0 (git+https://github.com/gtk-rs/cairo)",
"gdk 0.6.0 (git+https://github.com/gtk-rs/gdk)",
"gdk-pixbuf 0.2.0 (git+https://github.com/gtk-rs/gdk-pixbuf)",
"gdk-pixbuf-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gdk-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gio 0.2.0 (git+https://github.com/gtk-rs/gio)",
"gio-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"glib 0.3.0 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gtk-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"pango 0.2.0 (git+https://github.com/gtk-rs/pango)",
]
[[package]]
name = "gtk-sys"
version = "0.4.0"
source = "git+https://github.com/gtk-rs/sys#7d428511eab76b3cc9ba12aa99285ad54ff6f8d3"
dependencies = [
"atk-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.4.0 (git+https://github.com/gtk-rs/cairo)",
"gdk-pixbuf-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gdk-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gio-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "iovec"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "kernel32-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lazy_static"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "lazycell"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
version = "0.2.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "log"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "magenta"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "magenta-sys"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "mio"
version = "0.6.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"iovec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "miow"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "net2"
version = "0.2.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "nodrop"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-integer"
version = "0.1.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-rational"
version = "0.1.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-traits"
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "odds"
version = "0.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "pango"
version = "0.2.0"
source = "git+https://github.com/gtk-rs/pango#14362ce2b537dff25bb50862a122f06c7eaa9ba8"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
]
[[package]]
name = "pango-sys"
version = "0.4.0"
source = "git+https://github.com/gtk-rs/sys#7d428511eab76b3cc9ba12aa99285ad54ff6f8d3"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)",
"libc 0.2.30 (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 = "pkg-config"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rustdoc-stripper"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "scoped-tls"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "send-cell"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "slab"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "tokio-core"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-io"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (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"
[[package]]
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "ws2_32-sys"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[metadata]
"checksum array-init 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4d3b508d35216892b50a135fb52c9bb90f04a97b7782230805dff1a156ad5469"
"checksum atk-sys 0.4.0 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
"checksum byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a865e7bfa6c3b79216ccba767d4dc66e4f9f65f1ed4639e73faff3c4a2485d7"
"checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d"
"checksum bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d828f97b58cc5de3e40c421d0cf2132d6b2da4ee0e11b8632fa838f0f9333ad6"
"checksum c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6237ac5a4b1e81c213c24c6437964c61e646df910a914b4ab1487b46df20bd13"
"checksum cairo-rs 0.2.0 (git+https://github.com/gtk-rs/cairo)" = "<none>"
"checksum cairo-sys-rs 0.4.0 (git+https://github.com/gtk-rs/cairo)" = "<none>"
"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299"
"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9"
"checksum futures 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a82bdc62350ca9d7974c760e9665102fc9d740992a528c2254aa930e53b783c4"
"checksum gdk 0.6.0 (git+https://github.com/gtk-rs/gdk)" = "<none>"
"checksum gdk-pixbuf 0.2.0 (git+https://github.com/gtk-rs/gdk-pixbuf)" = "<none>"
"checksum gdk-pixbuf-sys 0.4.0 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum gdk-sys 0.4.0 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum gio 0.2.0 (git+https://github.com/gtk-rs/gio)" = "<none>"
"checksum gio-sys 0.4.0 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum glib 0.3.0 (git+https://github.com/gtk-rs/glib)" = "<none>"
"checksum glib-sys 0.4.0 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum gobject-sys 0.4.0 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum gstreamer-app-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)" = "<none>"
"checksum gstreamer-audio-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)" = "<none>"
"checksum gstreamer-base-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)" = "<none>"
"checksum gstreamer-player-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)" = "<none>"
"checksum gstreamer-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)" = "<none>"
"checksum gstreamer-tag-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)" = "<none>"
"checksum gstreamer-video-sys 0.2.0 (git+https://github.com/sdroege/gstreamer-sys)" = "<none>"
"checksum gtk 0.2.0 (git+https://github.com/gtk-rs/gtk)" = "<none>"
"checksum gtk-sys 0.4.0 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum iovec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "29d062ee61fccdf25be172e70f34c9f6efc597e1fb8f6526e8437b2046ab26be"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf"
"checksum lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3b585b7a6811fb03aa10e74b278a0f00f8dd9b45dc681f148bb29fa5cb61859b"
"checksum libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)" = "2370ca07ec338939e356443dac2296f581453c35fe1e3a3ed06023c49435f915"
"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b"
"checksum magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf0336886480e671965f794bc9b6fce88503563013d1bfb7a502c81fe3ac527"
"checksum magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40d014c7011ac470ae28e2f76a02bfea4a8480f73e701353b49ad7a8d75f4699"
"checksum mio 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "dbd91d3bfbceb13897065e97b2ef177a09a438cb33612b2d371bf568819a9313"
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
"checksum net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "3a80f842784ef6c9a958b68b7516bc7e35883c614004dd94959a4dca1b716c09"
"checksum nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "52cd74cd09beba596430cc6e3091b74007169a56246e1262f0ba451ea95117b2"
"checksum num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "d1452e8b06e448a07f0e6ebb0bb1d92b8890eea63288c0b627331d53514d0fba"
"checksum num-rational 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "288629c76fac4b33556f4b7ab57ba21ae202da65ba8b77466e6d598e31990790"
"checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0"
"checksum odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)" = "c3df9b730298cea3a1c3faa90b7e2f9df3a9c400d0936d6015e6165734eefcba"
"checksum pango 0.2.0 (git+https://github.com/gtk-rs/pango)" = "<none>"
"checksum pango-sys 0.4.0 (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 rustdoc-stripper 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab70973988ecb752bc19e28e47bb3913bd98a8db8abe2dbd0f862067b176cf95"
"checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d"
"checksum send-cell 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c620dd7e056b468b9d374a9f51cfa6bb4bf17a8ca4ee62e5efa0d99aaff2c41"
"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
"checksum tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e85d419699ec4b71bfe35bbc25bb8771e52eff0471a7f75c853ad06e200b4f86"
"checksum tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ab83e7adb5677e42e405fa4ceff75659d93c4d7d7dd22f52fcec59ee9f02af"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"

132
README.md
View file

@ -1,4 +1,4 @@
# gstreamer-rs [![Build Status](https://travis-ci.org/sdroege/gstreamer-rs.svg?branch=master)](https://travis-ci.org/sdroege/gstreamer-rs)
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer.svg)](https://crates.io/crates/gstreamer) [![Build Status](https://travis-ci.org/sdroege/gstreamer-rs.svg?branch=master)](https://travis-ci.org/sdroege/gstreamer-rs)
[GStreamer](https://gstreamer.freedesktop.org/) bindings for Rust.
Documentation can be found [here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/).
@ -16,6 +16,134 @@ The API of the two is incompatible.
A crate for writing GStreamer plugins in Rust can be found here: https://github.com/sdroege/gst-plugin-rs
## 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)
<a name="installation"/>
## Installation
To build the GStreamer bindings or anything depending on them, you need to
have at least GStreamer 1.8 and gst-plugins-base 1.8 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.
<a name="installation-linux"/>
### 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
```
$ 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
```
Package names on other distributions should be similar.
Please submit a pull request with instructions for yours.
<a name="installation-macos"/>
### 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.
#### Homebrew
```
$ brew install gstreamer gst-plugins-base gst-plugins-good \
gst-plugins-bad gst-plugins-ugly gst-libav
```
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.12.3-x86_64.pkg` and
`gstreamer-1.0-devel-1.12.3-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### 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.
#### MSYS2 / pacman
```
$ pacman -S 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
```
#### 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.12.3.msi` and
`gstreamer-1.0-devel-x86_64-1.12.3.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started
The API reference can be found
[here](https://sdroege.github.io/rustdoc/gstreamer/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://github.com/sdroege/gstreamer-rs/tree/master/tutorials)
directory.
Some further examples for various aspects of GStreamer and how to use it from
Rust can be found in the
[examples](https://github.com/sdroege/gstreamer-rs/tree/master/examples)
directory.
<a name="license"/>
## LICENSE
gstreamer-rs and all crates contained in here are licensed under either of
@ -31,6 +159,8 @@ 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
<a name="contribution"/>
## Contribution
Any kinds of contributions are welcome as a pull request.

View file

@ -1,18 +1,18 @@
[package]
name = "examples"
version = "0.8.0"
version = "0.8.2"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
[dependencies]
glib = { version = "0.3", git = "https://github.com/gtk-rs/glib" }
glib = "0.3"
gstreamer = { path = "../gstreamer" }
gstreamer-app = { path = "../gstreamer-app" }
gstreamer-audio = { path = "../gstreamer-audio" }
gstreamer-video = { path = "../gstreamer-video" }
gstreamer-player = { path = "../gstreamer-player", optional = true }
gtk = { version = "0.2", git = "https://github.com/gtk-rs/gtk", features = ["v3_6"], optional = true }
gdk = { version = "0.6", git = "https://github.com/gtk-rs/gdk", optional = true }
gio = { version = "0.2", git = "https://github.com/gtk-rs/gio", optional = true }
gtk = { version = "0.2", features = ["v3_6"], optional = true }
gdk = { version = "0.6", optional = true }
gio = { version = "0.2", optional = true }
futures = { version = "0.1", optional = true }
tokio-core = { version = "0.1", optional = true }
send-cell = "0.1"

View file

@ -3,12 +3,9 @@ use gst::prelude::*;
extern crate gstreamer_app as gst_app;
extern crate gstreamer_audio as gst_audio;
extern crate glib;
extern crate byte_slice_cast;
use byte_slice_cast::*;
use std::u64;
use std::i16;
use std::i32;
@ -69,7 +66,7 @@ fn create_pipeline() -> Result<gst::Pipeline, utils::ExampleError> {
let sum: f64 = samples
.iter()
.map(|sample| {
let f = (*sample as f64) / (i16::MAX as f64);
let f = f64::from(*sample) / f64::from(i16::MAX);
f * f
})
.sum();
@ -92,14 +89,9 @@ fn main_loop() -> Result<(), utils::ExampleError> {
.get_bus()
.expect("Pipeline without bus. Shouldn't happen!");
loop {
while let Some(msg) = bus.timed_pop(gst::CLOCK_TIME_NONE) {
use gst::MessageView;
let msg = match bus.timed_pop(u64::MAX) {
None => break,
Some(msg) => msg,
};
match msg.view() {
MessageView::Eos(..) => break,
MessageView::Error(err) => {

View file

@ -3,9 +3,6 @@ use gst::prelude::*;
extern crate gstreamer_app as gst_app;
extern crate gstreamer_video as gst_video;
extern crate glib;
use std::u64;
use std::thread;
pub mod utils;
@ -85,14 +82,9 @@ fn main_loop() -> Result<(), utils::ExampleError> {
.get_bus()
.expect("Pipeline without bus. Shouldn't happen!");
loop {
while let Some(msg) = bus.timed_pop(gst::CLOCK_TIME_NONE) {
use gst::MessageView;
let msg = match bus.timed_pop(u64::MAX) {
None => break,
Some(msg) => msg,
};
match msg.view() {
MessageView::Eos(..) => break,
MessageView::Error(err) => {

View file

@ -4,7 +4,6 @@ use gst::prelude::*;
extern crate glib;
use std::env;
use std::u64;
fn main() {
gst::init().unwrap();
@ -13,7 +12,7 @@ fn main() {
let uri: &str = if args.len() == 2 {
args[1].as_ref()
} else {
panic!("Usage: decodebin file_path");
panic!("Usage: decodebin file_path")
};
let pipeline = gst::Pipeline::new(None);
@ -81,14 +80,9 @@ fn main() {
let bus = pipeline.get_bus().unwrap();
loop {
while let Some(msg) = bus.timed_pop(gst::CLOCK_TIME_NONE) {
use gst::MessageView;
let msg = match bus.timed_pop(u64::MAX) {
None => break,
Some(msg) => msg,
};
match msg.view() {
MessageView::Eos(..) => break,
MessageView::Error(err) => {

View file

@ -22,11 +22,15 @@ use gio::prelude::*;
extern crate gtk;
#[cfg(feature = "gtkvideooverlay")]
use gtk::prelude::*;
#[cfg(feature = "gtkvideooverlay")]
use gtk::prelude::WindowExt as GtkWindowExt;
#[cfg(feature = "gtkvideooverlay")]
extern crate gdk;
#[cfg(feature = "gtkvideooverlay")]
use gdk::prelude::*;
#[cfg(feature = "gtkvideooverlay")]
use gdk::prelude::WindowExt as GdkWindowExt;
#[cfg(feature = "gtkvideooverlay")]
use std::env;
@ -114,7 +118,6 @@ fn create_ui(app: &gtk::Application) {
process::exit(-1);
}
}
});
vbox.pack_start(&video_window, true, true, 0);

View file

@ -1,7 +1,6 @@
extern crate gstreamer as gst;
use gst::prelude::*;
use std::u64;
use std::env;
use std::process;
@ -21,7 +20,7 @@ fn main() {
println!("Failed to parse pipeline: {}", err);
}
process::exit(-1);
process::exit(-1)
}
};
let bus = pipeline.get_bus().unwrap();
@ -29,14 +28,9 @@ fn main() {
let ret = pipeline.set_state(gst::State::Playing);
assert_ne!(ret, gst::StateChangeReturn::Failure);
loop {
while let Some(msg) = bus.timed_pop(gst::CLOCK_TIME_NONE) {
use gst::MessageView;
let msg = match bus.timed_pop(u64::MAX) {
None => break,
Some(msg) => msg,
};
match msg.view() {
MessageView::Eos(..) => break,
MessageView::Error(err) => {

View file

@ -5,7 +5,6 @@ extern crate gstreamer_audio as gst_audio;
extern crate byte_slice_cast;
use byte_slice_cast::*;
use std::u64;
use std::i16;
fn main() {
@ -37,7 +36,7 @@ fn main() {
let sum: f64 = samples
.iter()
.map(|sample| {
let f = (*sample as f64) / (i16::MAX as f64);
let f = f64::from(*sample) / f64::from(i16::MAX);
f * f
})
.sum();
@ -51,14 +50,9 @@ fn main() {
let ret = pipeline.set_state(gst::State::Playing);
assert_ne!(ret, gst::StateChangeReturn::Failure);
loop {
while let Some(msg) = bus.timed_pop(gst::CLOCK_TIME_NONE) {
use gst::MessageView;
let msg = match bus.timed_pop(u64::MAX) {
None => break,
Some(msg) => msg,
};
match msg.view() {
MessageView::Eos(..) => break,
MessageView::Error(err) => {

View file

@ -4,7 +4,6 @@ use gst::prelude::*;
extern crate glib;
use std::env;
use std::u64;
fn main() {
gst::init().unwrap();
@ -13,7 +12,7 @@ fn main() {
let uri: &str = if args.len() == 2 {
args[1].as_ref()
} else {
panic!("Usage: playbin uri");
panic!("Usage: playbin uri")
};
let playbin = gst::ElementFactory::make("playbin", None).unwrap();
@ -65,14 +64,9 @@ fn main() {
let ret = playbin.set_state(gst::State::Playing);
assert_ne!(ret, gst::StateChangeReturn::Failure);
loop {
while let Some(msg) = bus.timed_pop(gst::CLOCK_TIME_NONE) {
use gst::MessageView;
let msg = match bus.timed_pop(u64::MAX) {
None => break,
Some(msg) => msg,
};
match msg.view() {
MessageView::Eos(..) => break,
MessageView::Error(err) => {

View file

@ -5,6 +5,7 @@ use gst::prelude::*;
#[cfg(feature = "gst-player")]
extern crate gstreamer_player as gst_player;
#[cfg(feature = "gst-player")]
extern crate glib;
use std::env;
@ -72,7 +73,7 @@ fn main() {
let uri: &str = if args.len() == 2 {
args[1].as_ref()
} else {
panic!("Usage: player uri");
panic!("Usage: player uri")
};
match main_loop(uri) {

View file

@ -4,7 +4,6 @@ use gst::prelude::*;
extern crate glib;
use std::env;
use std::u64;
fn main() {
gst::init().unwrap();
@ -13,7 +12,7 @@ fn main() {
let uri: &str = if args.len() == 2 {
args[1].as_ref()
} else {
panic!("Usage: toc file_path");
panic!("Usage: toc file_path")
};
let pipeline = gst::Pipeline::new(None);
@ -52,16 +51,11 @@ fn main() {
let bus = pipeline.get_bus().unwrap();
loop {
while let Some(msg) = bus.timed_pop(gst::CLOCK_TIME_NONE) {
use gst::MessageView;
let msg = match bus.timed_pop(u64::MAX) {
None => break,
Some(msg) => msg,
};
match msg.view() {
MessageView::Eos(..) => break,
MessageView::Eos(_) | MessageView::AsyncDone(_) => break,
MessageView::Error(err) => {
println!(
"Error from {}: {} ({:?})",
@ -71,7 +65,6 @@ fn main() {
);
break;
}
MessageView::AsyncDone(_) => break,
MessageView::Toc(msg_toc) => {
let (toc, updated) = msg_toc.get_toc();
println!(

View file

@ -1,3 +1,4 @@
#[cfg(feature = "tokio")]
extern crate gstreamer as gst;
#[cfg(feature = "tokio")]
use gst::prelude::*;

View file

@ -5,10 +5,45 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html),
specifically the [variant used by Rust](http://doc.crates.io/manifest.html#the-version-field).
## [0.8.2] - 2017-11-11
### Fixed
- Implement StaticType of BufferRef instead of Buffer. Buffer aka
GstRc<BufferRef> already implements StaticType if BufferRef does, and
without this it was not possible to use Buffers in GValues.
- Free memory of the appsink/appsrc callbacks with the correct type. It was
crashing because of using the wrong type before.
- Fix documentation URLs in Cargo.toml.
### Added
- Installation instructions and links to documentation for getting started to
README.md.
## [0.8.1] - 2017-09-15
### Added
- Implement Send+Sync for Query, Message and Event, and their corresponding
Ref types.
### Fixed
- Constructor for gst_player::Player now works properly with GStreamer 1.12
when passing a video renderer or signal dispatcher. There was a reference
counting bug.
- Instead of returning &'static references from functions, return references
with a generic, unbound lifetime instead.
See https://github.com/rust-lang/rust/pull/42417#issue-233404573
- Various "unused external crate" warnings and clippy warnings everywhere.
### Changed
- Remove Cargo.lock from GIT, it's not very useful for library crates.
- Run everything through latest rustfmt-nightly.
- Use while-let (instead of loop and if-let) and CLOCK_TIME_NONE (instead of
u64::MAX) in the examples.
## [0.8.0] - 2017-08-31
- Initial release of the autogenerated GStreamer bindings. Older versions
(< 0.8.0) of the bindings can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
[Unreleased]: https://github.com/sdroege/gstreamer-rs/compare/0.8.0...HEAD
[Unreleased]: https://github.com/sdroege/gstreamer-rs/compare/0.8.1...HEAD
[0.8.1]: https://github.com/sdroege/gstreamer-rs/compare/0.8.0...0.8.1

View file

@ -1,24 +1,25 @@
[package]
name = "gstreamer-app"
version = "0.8.0"
version = "0.8.2"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer App library"
repository = "https://github.com/sdroege/gstreamer-rs"
license = "MIT/Apache-2.0"
readme = "README.md"
homepage = "https://gstreamer.freedesktop.org"
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer-app"
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer_app"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
build = "build.rs"
[dependencies]
bitflags = "0.9"
libc = "0.2"
glib-sys = { version = "0.4", git = "https://github.com/gtk-rs/sys" }
gobject-sys = { version = "0.4", git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { version = "0.2", git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
gstreamer-app-sys = { version = "0.2", git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
glib = { version = "0.3", git = "https://github.com/gtk-rs/glib" }
glib-sys = "0.4"
gobject-sys = "0.4"
gstreamer-sys = { version = "0.2", features = ["v1_8"] }
gstreamer-app-sys = { version = "0.2", features = ["v1_8"] }
glib = "0.3"
gstreamer = { version = "0.8", path = "../gstreamer" }
[build-dependencies.rustdoc-stripper]

170
gstreamer-app/README.md Normal file
View file

@ -0,0 +1,170 @@
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-app.svg)](https://crates.io/crates/gstreamer-app) [![Build Status](https://travis-ci.org/sdroege/gstreamer-rs.svg?branch=master)](https://travis-ci.org/sdroege/gstreamer-rs)
[GStreamer](https://gstreamer.freedesktop.org/) (App library) bindings for Rust.
Documentation can be found [here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/).
These bindings are providing a safe API that can be used to interface with
GStreamer, e.g. for writing GStreamer-based applications.
For background and motivation, see the [announcement blogpost](https://coaxion.net/blog/2017/07/writing-gstreamer-applications-in-rust/).
The bindings (since 0.8.0) are 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. Older versions before 0.8.0 were manually
written and the repository can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
A crate for writing GStreamer plugins in Rust can be found here: https://github.com/sdroege/gst-plugin-rs
## 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)
<a name="installation"/>
## Installation
To build the GStreamer bindings or anything depending on them, you need to
have at least GStreamer 1.8 and gst-plugins-base 1.8 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.
<a name="installation-linux"/>
### 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
```
$ 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
```
Package names on other distributions should be similar.
Please submit a pull request with instructions for yours.
<a name="installation-macos"/>
### 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.
#### Homebrew
```
$ brew install gstreamer gst-plugins-base gst-plugins-good \
gst-plugins-bad gst-plugins-ugly gst-libav
```
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.12.3-x86_64.pkg` and
`gstreamer-1.0-devel-1.12.3-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### 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.
#### MSYS2 / pacman
```
$ pacman -S 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
```
#### 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.12.3.msi` and
`gstreamer-1.0-devel-x86_64-1.12.3.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started
The API reference can be found
[here](https://sdroege.github.io/rustdoc/gstreamer/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://github.com/sdroege/gstreamer-rs/tree/master/tutorials)
directory.
Some further examples for various aspects of GStreamer and how to use it from
Rust can be found in the
[examples](https://github.com/sdroege/gstreamer-rs/tree/master/examples)
directory.
<a name="license"/>
## 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
<a name="contribution"/>
## 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.

View file

@ -79,7 +79,7 @@ unsafe extern "C" fn trampoline_new_sample(
unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
let _guard = CallbackGuard::new();
Box::<Box<AppSinkCallbacks>>::from_raw(ptr as *mut _);
Box::<AppSinkCallbacks>::from_raw(ptr as *mut _);
}
impl AppSink {

View file

@ -80,7 +80,7 @@ unsafe extern "C" fn trampoline_seek_data(
unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
let _guard = CallbackGuard::new();
Box::<Box<AppSrcCallbacks>>::from_raw(ptr as *mut _);
Box::<AppSrcCallbacks>::from_raw(ptr as *mut _);
}
impl AppSrc {

View file

@ -10,9 +10,9 @@ extern crate libc;
extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi;
extern crate gstreamer_sys as gst_ffi;
extern crate gstreamer_app_sys as ffi;
extern crate gstreamer as gst;
extern crate gstreamer_app_sys as ffi;
extern crate gstreamer_sys as gst_ffi;
#[macro_use]
extern crate glib;

View file

@ -5,10 +5,45 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html),
specifically the [variant used by Rust](http://doc.crates.io/manifest.html#the-version-field).
## [0.8.2] - 2017-11-11
### Fixed
- Implement StaticType of BufferRef instead of Buffer. Buffer aka
GstRc<BufferRef> already implements StaticType if BufferRef does, and
without this it was not possible to use Buffers in GValues.
- Free memory of the appsink/appsrc callbacks with the correct type. It was
crashing because of using the wrong type before.
- Fix documentation URLs in Cargo.toml.
### Added
- Installation instructions and links to documentation for getting started to
README.md.
## [0.8.1] - 2017-09-15
### Added
- Implement Send+Sync for Query, Message and Event, and their corresponding
Ref types.
### Fixed
- Constructor for gst_player::Player now works properly with GStreamer 1.12
when passing a video renderer or signal dispatcher. There was a reference
counting bug.
- Instead of returning &'static references from functions, return references
with a generic, unbound lifetime instead.
See https://github.com/rust-lang/rust/pull/42417#issue-233404573
- Various "unused external crate" warnings and clippy warnings everywhere.
### Changed
- Remove Cargo.lock from GIT, it's not very useful for library crates.
- Run everything through latest rustfmt-nightly.
- Use while-let (instead of loop and if-let) and CLOCK_TIME_NONE (instead of
u64::MAX) in the examples.
## [0.8.0] - 2017-08-31
- Initial release of the autogenerated GStreamer bindings. Older versions
(< 0.8.0) of the bindings can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
[Unreleased]: https://github.com/sdroege/gstreamer-rs/compare/0.8.0...HEAD
[Unreleased]: https://github.com/sdroege/gstreamer-rs/compare/0.8.1...HEAD
[0.8.1]: https://github.com/sdroege/gstreamer-rs/compare/0.8.0...0.8.1

View file

@ -1,24 +1,24 @@
[package]
name = "gstreamer-audio"
version = "0.8.0"
version = "0.8.2"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer Audio library"
repository = "https://github.com/sdroege/gstreamer-rs"
license = "MIT/Apache-2.0"
readme = "README.md"
homepage = "https://gstreamer.freedesktop.org"
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer-audio"
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer_audio"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
build = "build.rs"
[dependencies]
bitflags = "0.9"
libc = "0.2"
glib-sys = { version = "0.4", git = "https://github.com/gtk-rs/sys" }
gobject-sys = { version = "0.4", git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { version = "0.2", git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
gstreamer-audio-sys = { version = "0.2", git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
glib = { version = "0.3", git = "https://github.com/gtk-rs/glib" }
glib-sys = "0.4"
gobject-sys = "0.4"
gstreamer-sys = { version = "0.2", features = ["v1_8"] }
gstreamer-audio-sys = { version = "0.2", features = ["v1_8"] }
glib = "0.3"
gstreamer = { version = "0.8", path = "../gstreamer" }
array-init = "0.0"

170
gstreamer-audio/README.md Normal file
View file

@ -0,0 +1,170 @@
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-audio.svg)](https://crates.io/crates/gstreamer-audio) [![Build Status](https://travis-ci.org/sdroege/gstreamer-rs.svg?branch=master)](https://travis-ci.org/sdroege/gstreamer-rs)
[GStreamer](https://gstreamer.freedesktop.org/) (Audio library) bindings for Rust.
Documentation can be found [here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/).
These bindings are providing a safe API that can be used to interface with
GStreamer, e.g. for writing GStreamer-based applications.
For background and motivation, see the [announcement blogpost](https://coaxion.net/blog/2017/07/writing-gstreamer-applications-in-rust/).
The bindings (since 0.8.0) are 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. Older versions before 0.8.0 were manually
written and the repository can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
A crate for writing GStreamer plugins in Rust can be found here: https://github.com/sdroege/gst-plugin-rs
## 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)
<a name="installation"/>
## Installation
To build the GStreamer bindings or anything depending on them, you need to
have at least GStreamer 1.8 and gst-plugins-base 1.8 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.
<a name="installation-linux"/>
### 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
```
$ 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
```
Package names on other distributions should be similar.
Please submit a pull request with instructions for yours.
<a name="installation-macos"/>
### 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.
#### Homebrew
```
$ brew install gstreamer gst-plugins-base gst-plugins-good \
gst-plugins-bad gst-plugins-ugly gst-libav
```
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.12.3-x86_64.pkg` and
`gstreamer-1.0-devel-1.12.3-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### 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.
#### MSYS2 / pacman
```
$ pacman -S 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
```
#### 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.12.3.msi` and
`gstreamer-1.0-devel-x86_64-1.12.3.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started
The API reference can be found
[here](https://sdroege.github.io/rustdoc/gstreamer/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://github.com/sdroege/gstreamer-rs/tree/master/tutorials)
directory.
Some further examples for various aspects of GStreamer and how to use it from
Rust can be found in the
[examples](https://github.com/sdroege/gstreamer-rs/tree/master/examples)
directory.
<a name="license"/>
## 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
<a name="contribution"/>
## 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.

View file

@ -39,7 +39,7 @@ impl ::AudioFormat {
unsafe { from_glib(ffi::gst_audio_format_from_string(s.to_glib_none().0)) }
}
pub fn to_string(&self) -> &'static str {
pub fn to_string<'a>(&self) -> &'a str {
unsafe {
CStr::from_ptr(ffi::gst_audio_format_to_string(self.to_glib()))
.to_str()

View file

@ -66,11 +66,11 @@ impl AudioFormatInfo {
from_glib(self.0.format)
}
pub fn name(&self) -> &'static str {
pub fn name<'a>(&self) -> &'a str {
unsafe { CStr::from_ptr(self.0.name).to_str().unwrap() }
}
pub fn description(&self) -> &'static str {
pub fn description<'a>(&self) -> &'a str {
unsafe { CStr::from_ptr(self.0.description).to_str().unwrap() }
}
@ -94,7 +94,7 @@ impl AudioFormatInfo {
from_glib(self.0.unpack_format)
}
pub fn silence(&self) -> &'static [u8] {
pub fn silence<'a>(&self) -> &'a [u8] {
&self.0.silence
}

View file

@ -6,18 +6,17 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate array_init;
#[macro_use]
extern crate bitflags;
extern crate libc;
extern crate array_init;
extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi;
extern crate gstreamer_sys as gst_ffi;
extern crate gstreamer_audio_sys as ffi;
extern crate gstreamer as gst;
#[macro_use]
extern crate glib;
extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi;
extern crate gstreamer as gst;
extern crate gstreamer_audio_sys as ffi;
extern crate gstreamer_sys as gst_ffi;
macro_rules! callback_guard {
() => (

View file

@ -5,10 +5,45 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html),
specifically the [variant used by Rust](http://doc.crates.io/manifest.html#the-version-field).
## [0.8.2] - 2017-11-11
### Fixed
- Implement StaticType of BufferRef instead of Buffer. Buffer aka
GstRc<BufferRef> already implements StaticType if BufferRef does, and
without this it was not possible to use Buffers in GValues.
- Free memory of the appsink/appsrc callbacks with the correct type. It was
crashing because of using the wrong type before.
- Fix documentation URLs in Cargo.toml.
### Added
- Installation instructions and links to documentation for getting started to
README.md.
## [0.8.1] - 2017-09-15
### Added
- Implement Send+Sync for Query, Message and Event, and their corresponding
Ref types.
### Fixed
- Constructor for gst_player::Player now works properly with GStreamer 1.12
when passing a video renderer or signal dispatcher. There was a reference
counting bug.
- Instead of returning &'static references from functions, return references
with a generic, unbound lifetime instead.
See https://github.com/rust-lang/rust/pull/42417#issue-233404573
- Various "unused external crate" warnings and clippy warnings everywhere.
### Changed
- Remove Cargo.lock from GIT, it's not very useful for library crates.
- Run everything through latest rustfmt-nightly.
- Use while-let (instead of loop and if-let) and CLOCK_TIME_NONE (instead of
u64::MAX) in the examples.
## [0.8.0] - 2017-08-31
- Initial release of the autogenerated GStreamer bindings. Older versions
(< 0.8.0) of the bindings can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
[Unreleased]: https://github.com/sdroege/gstreamer-rs/compare/0.8.0...HEAD
[Unreleased]: https://github.com/sdroege/gstreamer-rs/compare/0.8.1...HEAD
[0.8.1]: https://github.com/sdroege/gstreamer-rs/compare/0.8.0...0.8.1

View file

@ -1,24 +1,24 @@
[package]
name = "gstreamer-player"
version = "0.8.0"
version = "0.8.2"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer Player library"
repository = "https://github.com/sdroege/gstreamer-rs"
license = "MIT/Apache-2.0"
readme = "README.md"
homepage = "https://gstreamer.freedesktop.org"
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer-player"
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer_player"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
build = "build.rs"
[dependencies]
bitflags = "0.9"
libc = "0.2"
glib-sys = { version = "0.4", git = "https://github.com/gtk-rs/sys" }
gobject-sys = { version = "0.4", git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { version = "0.2", git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_12"] }
gstreamer-player-sys = { version = "0.2", git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_12"] }
glib = { version = "0.3", git = "https://github.com/gtk-rs/glib" }
glib-sys = "0.4"
gobject-sys = "0.4"
gstreamer-player-sys = { version = "0.2", features = ["v1_12"] }
glib = "0.3"
gstreamer = { version = "0.8", path = "../gstreamer", features = ["v1_12"] }
[build-dependencies.rustdoc-stripper]

170
gstreamer-player/README.md Normal file
View file

@ -0,0 +1,170 @@
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-player.svg)](https://crates.io/crates/gstreamer-player) [![Build Status](https://travis-ci.org/sdroege/gstreamer-rs.svg?branch=master)](https://travis-ci.org/sdroege/gstreamer-rs)
[GStreamer](https://gstreamer.freedesktop.org/) (Player library) bindings for Rust.
Documentation can be found [here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/).
These bindings are providing a safe API that can be used to interface with
GStreamer, e.g. for writing GStreamer-based applications.
For background and motivation, see the [announcement blogpost](https://coaxion.net/blog/2017/07/writing-gstreamer-applications-in-rust/).
The bindings (since 0.8.0) are 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. Older versions before 0.8.0 were manually
written and the repository can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
A crate for writing GStreamer plugins in Rust can be found here: https://github.com/sdroege/gst-plugin-rs
## 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)
<a name="installation"/>
## Installation
To build the GStreamer bindings or anything depending on them, you need to
have at least GStreamer 1.8 and gst-plugins-base 1.8 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.
<a name="installation-linux"/>
### 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
```
$ 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
```
Package names on other distributions should be similar.
Please submit a pull request with instructions for yours.
<a name="installation-macos"/>
### 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.
#### Homebrew
```
$ brew install gstreamer gst-plugins-base gst-plugins-good \
gst-plugins-bad gst-plugins-ugly gst-libav
```
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.12.3-x86_64.pkg` and
`gstreamer-1.0-devel-1.12.3-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### 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.
#### MSYS2 / pacman
```
$ pacman -S 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
```
#### 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.12.3.msi` and
`gstreamer-1.0-devel-x86_64-1.12.3.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started
The API reference can be found
[here](https://sdroege.github.io/rustdoc/gstreamer/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://github.com/sdroege/gstreamer-rs/tree/master/tutorials)
directory.
Some further examples for various aspects of GStreamer and how to use it from
Rust can be found in the
[examples](https://github.com/sdroege/gstreamer-rs/tree/master/examples)
directory.
<a name="license"/>
## 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
<a name="contribution"/>
## 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.

View file

@ -10,9 +10,8 @@ extern crate libc;
extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi;
extern crate gstreamer_sys as gst_ffi;
extern crate gstreamer_player_sys as ffi;
extern crate gstreamer as gst;
extern crate gstreamer_player_sys as ffi;
#[macro_use]
extern crate glib;
@ -39,6 +38,8 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
#[cfg_attr(feature = "cargo-clippy", allow(useless_transmute))]
mod auto;
pub use auto::*;

View file

@ -19,19 +19,17 @@ impl Player {
signal_dispatcher: Option<&PlayerSignalDispatcher>,
) -> Player {
assert_initialized_main_thread!();
let video_renderer = video_renderer.to_glib_full();
let signal_dispatcher = signal_dispatcher.to_glib_full();
let (major, minor, _, _) = gst::version();
if (major, minor) > (1, 12) {
let video_renderer = video_renderer.to_glib_full();
let signal_dispatcher = signal_dispatcher.to_glib_full();
unsafe { from_glib_full(ffi::gst_player_new(video_renderer, signal_dispatcher)) }
} else {
// Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 in
// https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/gst-libs/gst/player/gstplayer.c?id=634cd87c76f58b5e1383715bafd5614db825c7d1
let video_renderer = video_renderer.to_glib_none();
let signal_dispatcher = signal_dispatcher.to_glib_none();
unsafe { from_glib_none(ffi::gst_player_new(video_renderer.0, signal_dispatcher.0)) }
unsafe { from_glib_none(ffi::gst_player_new(video_renderer, signal_dispatcher)) }
}
}
pub fn set_config(&self, config: gst::Structure) -> bool {

View file

@ -21,9 +21,9 @@ impl PlayerVideoOverlayVideoRenderer {
pub unsafe fn new(window_handle: uintptr_t) -> PlayerVideoOverlayVideoRenderer {
assert_initialized_main_thread!();
from_glib_full(ffi::gst_player_video_overlay_video_renderer_new(
window_handle as *mut _,
) as *mut _)
from_glib_full(
ffi::gst_player_video_overlay_video_renderer_new(window_handle as *mut _) as *mut _,
)
}
pub unsafe fn new_with_handle_and_sink<P: IsA<gst::Element>>(
@ -35,8 +35,7 @@ impl PlayerVideoOverlayVideoRenderer {
from_glib_full(ffi::gst_player_video_overlay_video_renderer_new_with_sink(
window_handle as *mut _,
video_sink.to_glib_none().0,
) as
*mut _)
) as *mut _)
}
pub fn new_with_sink<P: IsA<gst::Element>>(video_sink: &P) -> PlayerVideoOverlayVideoRenderer {
@ -46,8 +45,7 @@ impl PlayerVideoOverlayVideoRenderer {
from_glib_full(ffi::gst_player_video_overlay_video_renderer_new_with_sink(
ptr::null_mut(),
video_sink.to_glib_none().0,
) as
*mut _)
) as *mut _)
}
}
}

View file

@ -5,10 +5,45 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html),
specifically the [variant used by Rust](http://doc.crates.io/manifest.html#the-version-field).
## [0.8.2] - 2017-11-11
### Fixed
- Implement StaticType of BufferRef instead of Buffer. Buffer aka
GstRc<BufferRef> already implements StaticType if BufferRef does, and
without this it was not possible to use Buffers in GValues.
- Free memory of the appsink/appsrc callbacks with the correct type. It was
crashing because of using the wrong type before.
- Fix documentation URLs in Cargo.toml.
### Added
- Installation instructions and links to documentation for getting started to
README.md.
## [0.8.1] - 2017-09-15
### Added
- Implement Send+Sync for Query, Message and Event, and their corresponding
Ref types.
### Fixed
- Constructor for gst_player::Player now works properly with GStreamer 1.12
when passing a video renderer or signal dispatcher. There was a reference
counting bug.
- Instead of returning &'static references from functions, return references
with a generic, unbound lifetime instead.
See https://github.com/rust-lang/rust/pull/42417#issue-233404573
- Various "unused external crate" warnings and clippy warnings everywhere.
### Changed
- Remove Cargo.lock from GIT, it's not very useful for library crates.
- Run everything through latest rustfmt-nightly.
- Use while-let (instead of loop and if-let) and CLOCK_TIME_NONE (instead of
u64::MAX) in the examples.
## [0.8.0] - 2017-08-31
- Initial release of the autogenerated GStreamer bindings. Older versions
(< 0.8.0) of the bindings can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
[Unreleased]: https://github.com/sdroege/gstreamer-rs/compare/0.8.0...HEAD
[Unreleased]: https://github.com/sdroege/gstreamer-rs/compare/0.8.1...HEAD
[0.8.1]: https://github.com/sdroege/gstreamer-rs/compare/0.8.0...0.8.1

View file

@ -1,24 +1,25 @@
[package]
name = "gstreamer-video"
version = "0.8.0"
version = "0.8.2"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer Video library"
repository = "https://github.com/sdroege/gstreamer-rs"
license = "MIT/Apache-2.0"
readme = "README.md"
homepage = "https://gstreamer.freedesktop.org"
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer-video"
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer_video"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
build = "build.rs"
[dependencies]
bitflags = "0.9"
libc = "0.2"
glib-sys = { version = "0.4", git = "https://github.com/gtk-rs/sys" }
gobject-sys = { version = "0.4", git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { version = "0.2", git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
gstreamer-video-sys = { version = "0.2", git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
glib = { version = "0.3", git = "https://github.com/gtk-rs/glib" }
glib-sys = "0.4"
gobject-sys = "0.4"
gstreamer-sys = { version = "0.2", features = ["v1_8"] }
gstreamer-video-sys = { version = "0.2", features = ["v1_8"] }
glib = "0.3"
gstreamer = { version = "0.8", path = "../gstreamer" }
[build-dependencies.rustdoc-stripper]

170
gstreamer-video/README.md Normal file
View file

@ -0,0 +1,170 @@
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-video.svg)](https://crates.io/crates/gstreamer-video) [![Build Status](https://travis-ci.org/sdroege/gstreamer-rs.svg?branch=master)](https://travis-ci.org/sdroege/gstreamer-rs)
[GStreamer](https://gstreamer.freedesktop.org/) (Video library) bindings for Rust.
Documentation can be found [here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/).
These bindings are providing a safe API that can be used to interface with
GStreamer, e.g. for writing GStreamer-based applications.
For background and motivation, see the [announcement blogpost](https://coaxion.net/blog/2017/07/writing-gstreamer-applications-in-rust/).
The bindings (since 0.8.0) are 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. Older versions before 0.8.0 were manually
written and the repository can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
A crate for writing GStreamer plugins in Rust can be found here: https://github.com/sdroege/gst-plugin-rs
## 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)
<a name="installation"/>
## Installation
To build the GStreamer bindings or anything depending on them, you need to
have at least GStreamer 1.8 and gst-plugins-base 1.8 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.
<a name="installation-linux"/>
### 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
```
$ 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
```
Package names on other distributions should be similar.
Please submit a pull request with instructions for yours.
<a name="installation-macos"/>
### 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.
#### Homebrew
```
$ brew install gstreamer gst-plugins-base gst-plugins-good \
gst-plugins-bad gst-plugins-ugly gst-libav
```
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.12.3-x86_64.pkg` and
`gstreamer-1.0-devel-1.12.3-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### 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.
#### MSYS2 / pacman
```
$ pacman -S 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
```
#### 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.12.3.msi` and
`gstreamer-1.0-devel-x86_64-1.12.3.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started
The API reference can be found
[here](https://sdroege.github.io/rustdoc/gstreamer/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://github.com/sdroege/gstreamer-rs/tree/master/tutorials)
directory.
Some further examples for various aspects of GStreamer and how to use it from
Rust can be found in the
[examples](https://github.com/sdroege/gstreamer-rs/tree/master/examples)
directory.
<a name="license"/>
## 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
<a name="contribution"/>
## 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.

View file

@ -10,13 +10,13 @@
extern crate bitflags;
extern crate libc;
extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi;
extern crate gstreamer_sys as gst_ffi;
extern crate gstreamer_video_sys as ffi;
extern crate gstreamer as gst;
#[macro_use]
extern crate glib;
extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi;
extern crate gstreamer as gst;
extern crate gstreamer_sys as gst_ffi;
extern crate gstreamer_video_sys as ffi;
macro_rules! assert_initialized_main_thread {
() => (

View file

@ -82,7 +82,7 @@ impl ::VideoFormat {
}
}
pub fn to_string(&self) -> &'static str {
pub fn to_string<'a>(&self) -> &'a str {
unsafe {
CStr::from_ptr(ffi::gst_video_format_to_string(self.to_glib()))
.to_str()

View file

@ -33,11 +33,11 @@ impl VideoFormatInfo {
from_glib(self.0.format)
}
pub fn name(&self) -> &'static str {
pub fn name<'a>(&self) -> &'a str {
unsafe { CStr::from_ptr(self.0.name).to_str().unwrap() }
}
pub fn description(&self) -> &'static str {
pub fn description<'a>(&self) -> &'a str {
unsafe { CStr::from_ptr(self.0.description).to_str().unwrap() }
}
@ -138,11 +138,11 @@ impl VideoFormatInfo {
}
pub fn scale_width(&self, component: u8, width: u32) -> u32 {
(-((-(width as i64)) >> self.w_sub()[component as usize])) as u32
(-((-(i64::from(width))) >> self.w_sub()[component as usize])) as u32
}
pub fn scale_height(&self, component: u8, height: u32) -> u32 {
(-((-(height as i64)) >> self.h_sub()[component as usize])) as u32
(-((-(i64::from(height))) >> self.h_sub()[component as usize])) as u32
}
// TODO: pack/unpack

View file

@ -26,8 +26,7 @@ pub enum VideoColorRange {
Unknown,
Range0255,
Range16235,
#[doc(hidden)]
__Unknown(i32),
#[doc(hidden)] __Unknown(i32),
}
#[doc(hidden)]
@ -183,8 +182,7 @@ pub struct VideoInfoBuilder<'a> {
stride: Option<&'a [i32]>,
multiview_mode: Option<::VideoMultiviewMode>,
multiview_flags: Option<::VideoMultiviewFlags>,
#[cfg(feature = "v1_12")]
field_order: Option<::VideoFieldOrder>,
#[cfg(feature = "v1_12")] field_order: Option<::VideoFieldOrder>,
}
impl<'a> VideoInfoBuilder<'a> {
@ -242,9 +240,8 @@ impl<'a> VideoInfoBuilder<'a> {
return None;
}
for i in 0..((*info.finfo).n_planes as usize) {
info.offset[i] = offset[i];
}
let n_planes = (*info.finfo).n_planes as usize;
info.offset[..n_planes].copy_from_slice(&offset[..n_planes]);
}
if let Some(stride) = self.stride {
@ -252,9 +249,8 @@ impl<'a> VideoInfoBuilder<'a> {
return None;
}
for i in 0..((*info.finfo).n_planes as usize) {
info.stride[i] = stride[i];
}
let n_planes = (*info.finfo).n_planes as usize;
info.stride[..n_planes].copy_from_slice(&stride[..n_planes]);
}
if let Some(multiview_mode) = self.multiview_mode {

View file

@ -5,10 +5,45 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html),
specifically the [variant used by Rust](http://doc.crates.io/manifest.html#the-version-field).
## [0.8.2] - 2017-11-11
### Fixed
- Implement StaticType of BufferRef instead of Buffer. Buffer aka
GstRc<BufferRef> already implements StaticType if BufferRef does, and
without this it was not possible to use Buffers in GValues.
- Free memory of the appsink/appsrc callbacks with the correct type. It was
crashing because of using the wrong type before.
- Fix documentation URLs in Cargo.toml.
### Added
- Installation instructions and links to documentation for getting started to
README.md.
## [0.8.1] - 2017-09-15
### Added
- Implement Send+Sync for Query, Message and Event, and their corresponding
Ref types.
### Fixed
- Constructor for gst_player::Player now works properly with GStreamer 1.12
when passing a video renderer or signal dispatcher. There was a reference
counting bug.
- Instead of returning &'static references from functions, return references
with a generic, unbound lifetime instead.
See https://github.com/rust-lang/rust/pull/42417#issue-233404573
- Various "unused external crate" warnings and clippy warnings everywhere.
### Changed
- Remove Cargo.lock from GIT, it's not very useful for library crates.
- Run everything through latest rustfmt-nightly.
- Use while-let (instead of loop and if-let) and CLOCK_TIME_NONE (instead of
u64::MAX) in the examples.
## [0.8.0] - 2017-08-31
- Initial release of the autogenerated GStreamer bindings. Older versions
(< 0.8.0) of the bindings can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
[Unreleased]: https://github.com/sdroege/gstreamer-rs/compare/0.8.0...HEAD
[Unreleased]: https://github.com/sdroege/gstreamer-rs/compare/0.8.1...HEAD
[0.8.1]: https://github.com/sdroege/gstreamer-rs/compare/0.8.0...0.8.1

View file

@ -1,11 +1,12 @@
[package]
name = "gstreamer"
version = "0.8.0"
version = "0.8.2"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer"
repository = "https://github.com/sdroege/gstreamer-rs"
license = "MIT/Apache-2.0"
readme = "README.md"
homepage = "https://gstreamer.freedesktop.org"
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
@ -14,10 +15,10 @@ build = "build.rs"
[dependencies]
bitflags = "0.9"
libc = "0.2"
glib-sys = { version = "0.4", git = "https://github.com/gtk-rs/sys" }
gobject-sys = { version = "0.4", git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { version = "0.2", git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
glib = { version = "0.3", git = "https://github.com/gtk-rs/glib" }
glib-sys = "0.4"
gobject-sys = "0.4"
gstreamer-sys = { version = "0.2", features = ["v1_8"] }
glib = "0.3"
num-rational = { version = "0.1.38", default-features = false, features = [] }
lazy_static = "0.2"
futures = { version = "0.1", optional = true }

170
gstreamer/README.md Normal file
View file

@ -0,0 +1,170 @@
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer.svg)](https://crates.io/crates/gstreamer) [![Build Status](https://travis-ci.org/sdroege/gstreamer-rs.svg?branch=master)](https://travis-ci.org/sdroege/gstreamer-rs)
[GStreamer](https://gstreamer.freedesktop.org/) bindings for Rust.
Documentation can be found [here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/).
These bindings are providing a safe API that can be used to interface with
GStreamer, e.g. for writing GStreamer-based applications.
For background and motivation, see the [announcement blogpost](https://coaxion.net/blog/2017/07/writing-gstreamer-applications-in-rust/).
The bindings (since 0.8.0) are 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. Older versions before 0.8.0 were manually
written and the repository can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
A crate for writing GStreamer plugins in Rust can be found here: https://github.com/sdroege/gst-plugin-rs
## 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)
<a name="installation"/>
## Installation
To build the GStreamer bindings or anything depending on them, you need to
have at least GStreamer 1.8 and gst-plugins-base 1.8 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.
<a name="installation-linux"/>
### 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
```
$ 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
```
Package names on other distributions should be similar.
Please submit a pull request with instructions for yours.
<a name="installation-macos"/>
### 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.
#### Homebrew
```
$ brew install gstreamer gst-plugins-base gst-plugins-good \
gst-plugins-bad gst-plugins-ugly gst-libav
```
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.12.3-x86_64.pkg` and
`gstreamer-1.0-devel-1.12.3-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### 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.
#### MSYS2 / pacman
```
$ pacman -S 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
```
#### 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.12.3.msi` and
`gstreamer-1.0-devel-x86_64-1.12.3.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started
The API reference can be found
[here](https://sdroege.github.io/rustdoc/gstreamer/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://github.com/sdroege/gstreamer-rs/tree/master/tutorials)
directory.
Some further examples for various aspects of GStreamer and how to use it from
Rust can be found in the
[examples](https://github.com/sdroege/gstreamer-rs/tree/master/examples)
directory.
<a name="license"/>
## 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
<a name="contribution"/>
## 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.

View file

@ -142,6 +142,12 @@ impl GstRc<BufferRef> {
}
}
impl Default for GstRc<BufferRef> {
fn default() -> Self {
Self::new()
}
}
impl BufferRef {
pub fn map_readable(&self) -> Option<BufferMap<Readable>> {
let mut map_info: ffi::GstMapInfo = unsafe { mem::zeroed() };
@ -317,7 +323,7 @@ impl BufferRef {
unsafe impl Sync for BufferRef {}
unsafe impl Send for BufferRef {}
impl glib::types::StaticType for Buffer {
impl glib::types::StaticType for BufferRef {
fn static_type() -> glib::types::Type {
unsafe { from_glib(ffi::gst_buffer_get_type()) }
}

View file

@ -68,11 +68,21 @@ impl BufferListRef {
unsafe { ffi::gst_buffer_list_length(self.as_mut_ptr()) as usize }
}
pub fn is_empty(&self) -> bool {
self.len() == 0
}
pub fn iter(&self) -> Iter {
Iter::new(self)
}
}
impl Default for GstRc<BufferListRef> {
fn default() -> Self {
Self::new()
}
}
impl ToOwned for BufferListRef {
type Owned = GstRc<BufferListRef>;

View file

@ -37,6 +37,7 @@ unsafe extern "C" fn trampoline_watch(
func: gpointer,
) -> gboolean {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &RefCell<Box<FnMut(&Bus, &Message) -> Continue + Send + 'static>> = transmute(func);
(&mut *func.borrow_mut())(&from_glib_none(bus), &Message::from_glib_none(msg)).to_glib()
}
@ -49,6 +50,7 @@ unsafe extern "C" fn destroy_closure_watch(ptr: gpointer) {
}
fn into_raw_watch<F: FnMut(&Bus, &Message) -> Continue + Send + 'static>(func: F) -> gpointer {
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
let func: Box<RefCell<Box<FnMut(&Bus, &Message) -> Continue + Send + 'static>>> =
Box::new(RefCell::new(Box::new(func)));
Box::into_raw(func) as gpointer
@ -60,6 +62,7 @@ unsafe extern "C" fn trampoline_sync(
func: gpointer,
) -> ffi::GstBusSyncReply {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let f: &&(Fn(&Bus, &Message) -> BusSyncReply + Send + Sync + 'static) = transmute(func);
f(&from_glib_none(bus), &Message::from_glib_none(msg)).to_glib()
}

View file

@ -39,6 +39,7 @@ unsafe extern "C" fn trampoline_wait_async(
func: gpointer,
) -> gboolean {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let f: &&(Fn(&Clock, ClockTime, &ClockId) -> bool + Send + 'static) = transmute(func);
f(&from_glib_none(clock), time, &from_glib_none(id)).to_glib()
}
@ -51,6 +52,7 @@ unsafe extern "C" fn destroy_closure_wait_async(ptr: gpointer) {
fn into_raw_wait_async<F: Fn(&Clock, ClockTime, &ClockId) -> bool + Send + 'static>(
func: F,
) -> gpointer {
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
let func: Box<Box<Fn(&Clock, ClockTime, &ClockId) -> bool + Send + 'static>> =
Box::new(Box::new(func));
Box::into_raw(func) as gpointer

View file

@ -17,11 +17,11 @@ use ffi;
use gobject_ffi;
pub trait DeviceProviderExtManual {
fn get_metadata(&self, key: &str) -> Option<&'static str>;
fn get_metadata<'a>(&self, key: &str) -> Option<&'a str>;
}
impl<O: IsA<DeviceProvider>> DeviceProviderExtManual for O {
fn get_metadata(&self, key: &str) -> Option<&'static str> {
fn get_metadata<'a>(&self, key: &str) -> Option<&'a str> {
unsafe {
let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class as
*mut ffi::GstDeviceProviderClass;

View file

@ -54,7 +54,7 @@ pub trait ElementExtManual {
fn send_event(&self, event: Event) -> bool;
fn get_metadata(&self, key: &str) -> Option<&'static str>;
fn get_metadata<'a>(&self, key: &str) -> Option<&'a str>;
fn get_pad_template(&self, name: &str) -> Option<PadTemplate>;
fn get_pad_template_list(&self) -> Vec<PadTemplate>;
@ -79,7 +79,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
}
}
fn get_metadata(&self, key: &str) -> Option<&'static str> {
fn get_metadata<'a>(&self, key: &str) -> Option<&'a str> {
unsafe {
let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class as
*mut ffi::GstElementClass;

View file

@ -25,6 +25,9 @@ pub struct EventRef(ffi::GstEvent);
pub type Event = GstRc<EventRef>;
unsafe impl Sync for EventRef {}
unsafe impl Send for EventRef {}
unsafe impl MiniObject for EventRef {
type GstType = ffi::GstEvent;
}
@ -69,66 +72,41 @@ impl EventRef {
pub fn view(&self) -> EventView {
let type_ = unsafe { (*self.as_ptr()).type_ };
if type_ == ffi::GST_EVENT_FLUSH_START {
EventView::FlushStart(FlushStart(self))
} else if type_ == ffi::GST_EVENT_FLUSH_STOP {
EventView::FlushStop(FlushStop(self))
} else if type_ == ffi::GST_EVENT_STREAM_START {
EventView::StreamStart(StreamStart(self))
} else if type_ == ffi::GST_EVENT_CAPS {
EventView::Caps(Caps(self))
} else if type_ == ffi::GST_EVENT_SEGMENT {
EventView::Segment(Segment(self))
} else if type_ == ffi::GST_EVENT_STREAM_COLLECTION {
EventView::StreamCollection(StreamCollection(self))
} else if type_ == ffi::GST_EVENT_TAG {
EventView::Tag(Tag(self))
} else if type_ == ffi::GST_EVENT_BUFFERSIZE {
EventView::BufferSize(BufferSize(self))
} else if type_ == ffi::GST_EVENT_SINK_MESSAGE {
EventView::SinkMessage(SinkMessage(self))
} else if type_ == ffi::GST_EVENT_STREAM_GROUP_DONE {
EventView::StreamGroupDone(StreamGroupDone(self))
} else if type_ == ffi::GST_EVENT_EOS {
EventView::Eos(Eos(self))
} else if type_ == ffi::GST_EVENT_TOC {
EventView::Toc(Toc(self))
} else if type_ == ffi::GST_EVENT_PROTECTION {
EventView::Protection(Protection(self))
} else if type_ == ffi::GST_EVENT_SEGMENT_DONE {
EventView::SegmentDone(SegmentDone(self))
} else if type_ == ffi::GST_EVENT_GAP {
EventView::Gap(Gap(self))
} else if type_ == ffi::GST_EVENT_QOS {
EventView::Qos(Qos(self))
} else if type_ == ffi::GST_EVENT_SEEK {
EventView::Seek(Seek(self))
} else if type_ == ffi::GST_EVENT_NAVIGATION {
EventView::Navigation(Navigation(self))
} else if type_ == ffi::GST_EVENT_LATENCY {
EventView::Latency(Latency(self))
} else if type_ == ffi::GST_EVENT_STEP {
EventView::Step(Step(self))
} else if type_ == ffi::GST_EVENT_RECONFIGURE {
EventView::Reconfigure(Reconfigure(self))
} else if type_ == ffi::GST_EVENT_TOC_SELECT {
EventView::TocSelect(TocSelect(self))
} else if type_ == ffi::GST_EVENT_SELECT_STREAMS {
EventView::SelectStreams(SelectStreams(self))
} else if type_ == ffi::GST_EVENT_CUSTOM_UPSTREAM {
EventView::CustomUpstream(CustomUpstream(self))
} else if type_ == ffi::GST_EVENT_CUSTOM_DOWNSTREAM {
EventView::CustomDownstream(CustomDownstream(self))
} else if type_ == ffi::GST_EVENT_CUSTOM_DOWNSTREAM_OOB {
EventView::CustomDownstreamOob(CustomDownstreamOob(self))
} else if type_ == ffi::GST_EVENT_CUSTOM_DOWNSTREAM_STICKY {
EventView::CustomDownstreamSticky(CustomDownstreamSticky(self))
} else if type_ == ffi::GST_EVENT_CUSTOM_BOTH {
EventView::CustomBoth(CustomBoth(self))
} else if type_ == ffi::GST_EVENT_CUSTOM_BOTH_OOB {
EventView::CustomBothOob(CustomBothOob(self))
} else {
EventView::Other
match type_ {
ffi::GST_EVENT_FLUSH_START => EventView::FlushStart(FlushStart(self)),
ffi::GST_EVENT_FLUSH_STOP => EventView::FlushStop(FlushStop(self)),
ffi::GST_EVENT_STREAM_START => EventView::StreamStart(StreamStart(self)),
ffi::GST_EVENT_CAPS => EventView::Caps(Caps(self)),
ffi::GST_EVENT_SEGMENT => EventView::Segment(Segment(self)),
ffi::GST_EVENT_STREAM_COLLECTION => EventView::StreamCollection(StreamCollection(self)),
ffi::GST_EVENT_TAG => EventView::Tag(Tag(self)),
ffi::GST_EVENT_BUFFERSIZE => EventView::BufferSize(BufferSize(self)),
ffi::GST_EVENT_SINK_MESSAGE => EventView::SinkMessage(SinkMessage(self)),
ffi::GST_EVENT_STREAM_GROUP_DONE => EventView::StreamGroupDone(StreamGroupDone(self)),
ffi::GST_EVENT_EOS => EventView::Eos(Eos(self)),
ffi::GST_EVENT_TOC => EventView::Toc(Toc(self)),
ffi::GST_EVENT_PROTECTION => EventView::Protection(Protection(self)),
ffi::GST_EVENT_SEGMENT_DONE => EventView::SegmentDone(SegmentDone(self)),
ffi::GST_EVENT_GAP => EventView::Gap(Gap(self)),
ffi::GST_EVENT_QOS => EventView::Qos(Qos(self)),
ffi::GST_EVENT_SEEK => EventView::Seek(Seek(self)),
ffi::GST_EVENT_NAVIGATION => EventView::Navigation(Navigation(self)),
ffi::GST_EVENT_LATENCY => EventView::Latency(Latency(self)),
ffi::GST_EVENT_STEP => EventView::Step(Step(self)),
ffi::GST_EVENT_RECONFIGURE => EventView::Reconfigure(Reconfigure(self)),
ffi::GST_EVENT_TOC_SELECT => EventView::TocSelect(TocSelect(self)),
ffi::GST_EVENT_SELECT_STREAMS => EventView::SelectStreams(SelectStreams(self)),
ffi::GST_EVENT_CUSTOM_UPSTREAM => EventView::CustomUpstream(CustomUpstream(self)),
ffi::GST_EVENT_CUSTOM_DOWNSTREAM => EventView::CustomDownstream(CustomDownstream(self)),
ffi::GST_EVENT_CUSTOM_DOWNSTREAM_OOB => {
EventView::CustomDownstreamOob(CustomDownstreamOob(self))
}
ffi::GST_EVENT_CUSTOM_DOWNSTREAM_STICKY => {
EventView::CustomDownstreamSticky(CustomDownstreamSticky(self))
}
ffi::GST_EVENT_CUSTOM_BOTH => EventView::CustomBoth(CustomBoth(self)),
ffi::GST_EVENT_CUSTOM_BOTH_OOB => EventView::CustomBothOob(CustomBothOob(self)),
_ => EventView::Other,
}
}
}

View file

@ -21,6 +21,7 @@ glib_wrapper! {
}
impl Iterator {
#[cfg_attr(feature = "cargo-clippy", allow(should_implement_trait))]
pub fn next(&mut self) -> Result<Value, IteratorResult> {
unsafe {
let mut value = Value::uninitialized();

View file

@ -9,9 +9,9 @@
#![recursion_limit = "256"]
#[macro_use]
extern crate bitflags;
extern crate libc;
#[macro_use]
extern crate lazy_static;
extern crate libc;
extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi;
@ -52,6 +52,7 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
mod auto;
pub use auto::*;
pub use auto::functions::*;
@ -92,14 +93,8 @@ mod iterator;
mod device_provider;
mod parse_context;
pub use element::ElementExtManual;
pub use element::{
ELEMENT_METADATA_AUTHOR,
ELEMENT_METADATA_DESCRIPTION,
ELEMENT_METADATA_DOC_URI,
ELEMENT_METADATA_ICON_NAME,
ELEMENT_METADATA_KLASS,
ELEMENT_METADATA_LONGNAME,
};
pub use element::{ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_DESCRIPTION, ELEMENT_METADATA_DOC_URI,
ELEMENT_METADATA_ICON_NAME, ELEMENT_METADATA_KLASS, ELEMENT_METADATA_LONGNAME};
pub use bin::BinExtManual;
pub use pad::{PadExtManual, PadProbeData, PadProbeId, PadProbeInfo, PAD_PROBE_ID_INVALID};
pub use gobject::GObjectExtManualGst;
@ -121,7 +116,7 @@ pub mod toc;
pub use toc::{Toc, TocEntry, TocEntryRef, TocRef};
mod clock;
pub use clock::{ClockId, ClockExtManual};
pub use clock::{ClockExtManual, ClockId};
pub mod functions;
pub use functions::*;

View file

@ -26,6 +26,9 @@ pub struct MessageRef(ffi::GstMessage);
pub type Message = GstRc<MessageRef>;
unsafe impl Sync for MessageRef {}
unsafe impl Send for MessageRef {}
unsafe impl MiniObject for MessageRef {
type GstType = ffi::GstMessage;
}
@ -49,80 +52,52 @@ impl MessageRef {
pub fn view(&self) -> MessageView {
let type_ = unsafe { (*self.as_ptr()).type_ };
if type_ == ffi::GST_MESSAGE_EOS {
MessageView::Eos(Eos(self))
} else if type_ == ffi::GST_MESSAGE_ERROR {
MessageView::Error(Error(self))
} else if type_ == ffi::GST_MESSAGE_WARNING {
MessageView::Warning(Warning(self))
} else if type_ == ffi::GST_MESSAGE_INFO {
MessageView::Info(Info(self))
} else if type_ == ffi::GST_MESSAGE_TAG {
MessageView::Tag(Tag(self))
} else if type_ == ffi::GST_MESSAGE_BUFFERING {
MessageView::Buffering(Buffering(self))
} else if type_ == ffi::GST_MESSAGE_STATE_CHANGED {
MessageView::StateChanged(StateChanged(self))
} else if type_ == ffi::GST_MESSAGE_STATE_DIRTY {
MessageView::StateDirty(StateDirty(self))
} else if type_ == ffi::GST_MESSAGE_STEP_DONE {
MessageView::StepDone(StepDone(self))
} else if type_ == ffi::GST_MESSAGE_CLOCK_PROVIDE {
MessageView::ClockProvide(ClockProvide(self))
} else if type_ == ffi::GST_MESSAGE_CLOCK_LOST {
MessageView::ClockLost(ClockLost(self))
} else if type_ == ffi::GST_MESSAGE_NEW_CLOCK {
MessageView::NewClock(NewClock(self))
} else if type_ == ffi::GST_MESSAGE_STRUCTURE_CHANGE {
MessageView::StructureChange(StructureChange(self))
} else if type_ == ffi::GST_MESSAGE_STREAM_STATUS {
MessageView::StreamStatus(StreamStatus(self))
} else if type_ == ffi::GST_MESSAGE_APPLICATION {
MessageView::Application(Application(self))
} else if type_ == ffi::GST_MESSAGE_ELEMENT {
MessageView::Element(Element(self))
} else if type_ == ffi::GST_MESSAGE_SEGMENT_START {
MessageView::SegmentStart(SegmentStart(self))
} else if type_ == ffi::GST_MESSAGE_SEGMENT_DONE {
MessageView::SegmentDone(SegmentDone(self))
} else if type_ == ffi::GST_MESSAGE_DURATION_CHANGED {
MessageView::DurationChanged(DurationChanged(self))
} else if type_ == ffi::GST_MESSAGE_LATENCY {
MessageView::Latency(Latency(self))
} else if type_ == ffi::GST_MESSAGE_ASYNC_START {
MessageView::AsyncStart(AsyncStart(self))
} else if type_ == ffi::GST_MESSAGE_ASYNC_DONE {
MessageView::AsyncDone(AsyncDone(self))
} else if type_ == ffi::GST_MESSAGE_REQUEST_STATE {
MessageView::RequestState(RequestState(self))
} else if type_ == ffi::GST_MESSAGE_STEP_START {
MessageView::StepStart(StepStart(self))
} else if type_ == ffi::GST_MESSAGE_QOS {
MessageView::Qos(Qos(self))
} else if type_ == ffi::GST_MESSAGE_PROGRESS {
MessageView::Progress(Progress(self))
} else if type_ == ffi::GST_MESSAGE_TOC {
MessageView::Toc(Toc(self))
} else if type_ == ffi::GST_MESSAGE_RESET_TIME {
MessageView::ResetTime(ResetTime(self))
} else if type_ == ffi::GST_MESSAGE_STREAM_START {
MessageView::StreamStart(StreamStart(self))
} else if type_ == ffi::GST_MESSAGE_NEED_CONTEXT {
MessageView::NeedContext(NeedContext(self))
} else if type_ == ffi::GST_MESSAGE_HAVE_CONTEXT {
MessageView::HaveContext(HaveContext(self))
} else if type_ == ffi::GST_MESSAGE_DEVICE_ADDED {
MessageView::DeviceAdded(DeviceAdded(self))
} else if type_ == ffi::GST_MESSAGE_DEVICE_REMOVED {
MessageView::DeviceRemoved(DeviceRemoved(self))
} else if type_ == ffi::GST_MESSAGE_PROPERTY_NOTIFY {
MessageView::PropertyNotify(PropertyNotify(self))
} else if type_ == ffi::GST_MESSAGE_STREAM_COLLECTION {
MessageView::StreamCollection(StreamCollection(self))
} else if type_ == ffi::GST_MESSAGE_STREAMS_SELECTED {
MessageView::StreamsSelected(StreamsSelected(self))
} else {
MessageView::Other
match type_ {
ffi::GST_MESSAGE_EOS => MessageView::Eos(Eos(self)),
ffi::GST_MESSAGE_ERROR => MessageView::Error(Error(self)),
ffi::GST_MESSAGE_WARNING => MessageView::Warning(Warning(self)),
ffi::GST_MESSAGE_INFO => MessageView::Info(Info(self)),
ffi::GST_MESSAGE_TAG => MessageView::Tag(Tag(self)),
ffi::GST_MESSAGE_BUFFERING => MessageView::Buffering(Buffering(self)),
ffi::GST_MESSAGE_STATE_CHANGED => MessageView::StateChanged(StateChanged(self)),
ffi::GST_MESSAGE_STATE_DIRTY => MessageView::StateDirty(StateDirty(self)),
ffi::GST_MESSAGE_STEP_DONE => MessageView::StepDone(StepDone(self)),
ffi::GST_MESSAGE_CLOCK_PROVIDE => MessageView::ClockProvide(ClockProvide(self)),
ffi::GST_MESSAGE_CLOCK_LOST => MessageView::ClockLost(ClockLost(self)),
ffi::GST_MESSAGE_NEW_CLOCK => MessageView::NewClock(NewClock(self)),
ffi::GST_MESSAGE_STRUCTURE_CHANGE => {
MessageView::StructureChange(StructureChange(self))
}
ffi::GST_MESSAGE_STREAM_STATUS => MessageView::StreamStatus(StreamStatus(self)),
ffi::GST_MESSAGE_APPLICATION => MessageView::Application(Application(self)),
ffi::GST_MESSAGE_ELEMENT => MessageView::Element(Element(self)),
ffi::GST_MESSAGE_SEGMENT_START => MessageView::SegmentStart(SegmentStart(self)),
ffi::GST_MESSAGE_SEGMENT_DONE => MessageView::SegmentDone(SegmentDone(self)),
ffi::GST_MESSAGE_DURATION_CHANGED => {
MessageView::DurationChanged(DurationChanged(self))
}
ffi::GST_MESSAGE_LATENCY => MessageView::Latency(Latency(self)),
ffi::GST_MESSAGE_ASYNC_START => MessageView::AsyncStart(AsyncStart(self)),
ffi::GST_MESSAGE_ASYNC_DONE => MessageView::AsyncDone(AsyncDone(self)),
ffi::GST_MESSAGE_REQUEST_STATE => MessageView::RequestState(RequestState(self)),
ffi::GST_MESSAGE_STEP_START => MessageView::StepStart(StepStart(self)),
ffi::GST_MESSAGE_QOS => MessageView::Qos(Qos(self)),
ffi::GST_MESSAGE_PROGRESS => MessageView::Progress(Progress(self)),
ffi::GST_MESSAGE_TOC => MessageView::Toc(Toc(self)),
ffi::GST_MESSAGE_RESET_TIME => MessageView::ResetTime(ResetTime(self)),
ffi::GST_MESSAGE_STREAM_START => MessageView::StreamStart(StreamStart(self)),
ffi::GST_MESSAGE_NEED_CONTEXT => MessageView::NeedContext(NeedContext(self)),
ffi::GST_MESSAGE_HAVE_CONTEXT => MessageView::HaveContext(HaveContext(self)),
ffi::GST_MESSAGE_DEVICE_ADDED => MessageView::DeviceAdded(DeviceAdded(self)),
ffi::GST_MESSAGE_DEVICE_REMOVED => MessageView::DeviceRemoved(DeviceRemoved(self)),
ffi::GST_MESSAGE_PROPERTY_NOTIFY => MessageView::PropertyNotify(PropertyNotify(self)),
ffi::GST_MESSAGE_STREAM_COLLECTION => {
MessageView::StreamCollection(StreamCollection(self))
}
ffi::GST_MESSAGE_STREAMS_SELECTED => {
MessageView::StreamsSelected(StreamsSelected(self))
}
_ => MessageView::Other,
}
}
}
@ -1181,8 +1156,7 @@ pub struct ErrorBuilder<'a> {
seqnum: Option<u32>,
error: &'a glib::Error,
debug: Option<&'a str>,
#[allow(unused)]
details: Option<Structure>,
#[allow(unused)] details: Option<Structure>,
}
impl<'a> ErrorBuilder<'a> {
fn new(error: &'a glib::Error) -> Self {
@ -1242,8 +1216,7 @@ pub struct WarningBuilder<'a> {
seqnum: Option<u32>,
error: &'a glib::Error,
debug: Option<&'a str>,
#[allow(unused)]
details: Option<Structure>,
#[allow(unused)] details: Option<Structure>,
}
impl<'a> WarningBuilder<'a> {
fn new(error: &'a glib::Error) -> Self {
@ -1303,8 +1276,7 @@ pub struct InfoBuilder<'a> {
seqnum: Option<u32>,
error: &'a glib::Error,
debug: Option<&'a str>,
#[allow(unused)]
details: Option<Structure>,
#[allow(unused)] details: Option<Structure>,
}
impl<'a> InfoBuilder<'a> {
fn new(error: &'a glib::Error) -> Self {
@ -1877,13 +1849,7 @@ pub struct QosBuilder {
stats: Option<(::Format, u64, u64)>,
}
impl QosBuilder {
fn new(
live: bool,
running_time: u64,
stream_time: u64,
timestamp: u64,
duration: u64,
) -> Self {
fn new(live: bool, running_time: u64, stream_time: u64, timestamp: u64, duration: u64) -> Self {
skip_assert_initialized!();
Self {
src: None,
@ -2182,10 +2148,8 @@ impl<'a> StreamCollectionBuilder<'a> {
pub struct StreamsSelectedBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
#[cfg(feature = "v1_10")]
collection: &'a ::StreamCollection,
#[cfg(feature = "v1_10")]
streams: Option<&'a [&'a ::Stream]>,
#[cfg(feature = "v1_10")] collection: &'a ::StreamCollection,
#[cfg(feature = "v1_10")] streams: Option<&'a [&'a ::Stream]>,
}
#[cfg(feature = "v1_10")]
impl<'a> StreamsSelectedBuilder<'a> {
@ -2224,7 +2188,9 @@ pub struct RedirectBuilder<'a> {
location: &'a str,
tag_list: Option<&'a TagList>,
entry_struct: Option<Structure>,
entries: Option<&'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)]>,
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
entries:
Option<&'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)]>,
}
#[cfg(feature = "v1_10")]
impl<'a> RedirectBuilder<'a> {
@ -2271,7 +2237,7 @@ impl<'a> RedirectBuilder<'a> {
);
if let Some(entries) = s.entries {
for &(location, tag_list, entry_struct) in entries {
let entry_struct = entry_struct.map(|s| s.clone());
let entry_struct = entry_struct.cloned();
let entry_struct_ptr = if let Some(entry_struct) = entry_struct {
entry_struct.into_ptr()
} else {

View file

@ -162,7 +162,7 @@ impl<T: MiniObject + PartialEq> PartialEq for GstRc<T> {
}
}
impl<T: MiniObject + Eq> Eq for GstRc<T> { }
impl<T: MiniObject + Eq> Eq for GstRc<T> {}
impl<T: MiniObject + fmt::Debug> fmt::Debug for GstRc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@ -241,7 +241,11 @@ impl<'a, T: MiniObject + 'static> ToGlibPtrMut<'a, *mut T::GstType> for GstRc<T>
}
impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstType> for GstRc<T> {
type Storage = (Vec<Stash<'a, *mut T::GstType, GstRc<T>>>, Option<Vec<*mut T::GstType>>);
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
type Storage = (
Vec<Stash<'a, *mut T::GstType, GstRc<T>>>,
Option<Vec<*mut T::GstType>>,
);
fn to_glib_none_from_slice(t: &'a [GstRc<T>]) -> (*mut *mut T::GstType, Self::Storage) {
skip_assert_initialized!();
@ -257,7 +261,8 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT
let v: Vec<_> = t.iter().map(|s| s.to_glib_none()).collect();
let v_ptr = unsafe {
let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) as *mut *mut T::GstType;
let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) as
*mut *mut T::GstType;
for (i, s) in v.iter().enumerate() {
ptr::write(v_ptr.offset(i as isize), s.0);
@ -272,7 +277,8 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT
fn to_glib_full_from_slice(t: &[GstRc<T>]) -> *mut *mut T::GstType {
skip_assert_initialized!();
unsafe {
let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) as *mut *mut T::GstType;
let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) as
*mut *mut T::GstType;
for (i, s) in t.iter().enumerate() {
ptr::write(v_ptr.offset(i as isize), s.to_glib_full());
@ -283,12 +289,18 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT
}
}
impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *const *mut T::GstType> for GstRc<T> {
type Storage = (Vec<Stash<'a, *mut T::GstType, GstRc<T>>>, Option<Vec<*mut T::GstType>>);
impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *const *mut T::GstType>
for GstRc<T> {
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
type Storage = (
Vec<Stash<'a, *mut T::GstType, GstRc<T>>>,
Option<Vec<*mut T::GstType>>,
);
fn to_glib_none_from_slice(t: &'a [GstRc<T>]) -> (*const *mut T::GstType, Self::Storage) {
skip_assert_initialized!();
let (ptr, stash) = ToGlibContainerFromSlice::<'a, *mut *mut T::GstType>::to_glib_none_from_slice(t);
let (ptr, stash) =
ToGlibContainerFromSlice::<'a, *mut *mut T::GstType>::to_glib_none_from_slice(t);
(ptr as *const *mut T::GstType, stash)
}
@ -341,7 +353,8 @@ impl<T: MiniObject + 'static> FromGlibPtrBorrow<*mut T::GstType> for GstRc<T> {
}
}
impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *mut *mut T::GstType> for GstRc<T> {
impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *mut *mut T::GstType>
for GstRc<T> {
unsafe fn from_glib_none_num_as_vec(ptr: *mut *mut T::GstType, num: usize) -> Vec<Self> {
if num == 0 || ptr.is_null() {
return Vec::new();
@ -374,7 +387,8 @@ impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *mut *mut
}
}
impl<T: MiniObject + 'static> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *mut *mut T::GstType> for GstRc<T> {
impl<T: MiniObject + 'static> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *mut *mut T::GstType>
for GstRc<T> {
unsafe fn from_glib_none_as_vec(ptr: *mut *mut T::GstType) -> Vec<Self> {
FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr, c_ptr_array_len(ptr))
}
@ -388,7 +402,8 @@ impl<T: MiniObject + 'static> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *m
}
}
impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *const *mut T::GstType> for GstRc<T> {
impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *const *mut T::GstType>
for GstRc<T> {
unsafe fn from_glib_none_num_as_vec(ptr: *const *mut T::GstType, num: usize) -> Vec<Self> {
FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr as *mut *mut _, num)
}
@ -404,7 +419,9 @@ impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *const *mu
}
}
impl<T: MiniObject + 'static> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *const *mut T::GstType> for GstRc<T> {
impl<
T: MiniObject + 'static,
> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *const *mut T::GstType> for GstRc<T> {
unsafe fn from_glib_none_as_vec(ptr: *const *mut T::GstType) -> Vec<Self> {
FromGlibPtrArrayContainerAsVec::from_glib_none_as_vec(ptr as *mut *mut _)
}

View file

@ -145,11 +145,21 @@ impl<O: IsA<Pad>> PadExtManual for O {
}
fn chain_list(&self, list: BufferList) -> FlowReturn {
unsafe { from_glib(ffi::gst_pad_chain_list(self.to_glib_none().0, list.into_ptr())) }
unsafe {
from_glib(ffi::gst_pad_chain_list(
self.to_glib_none().0,
list.into_ptr(),
))
}
}
fn push_list(&self, list: BufferList) -> FlowReturn {
unsafe { from_glib(ffi::gst_pad_push_list(self.to_glib_none().0, list.into_ptr())) }
unsafe {
from_glib(ffi::gst_pad_push_list(
self.to_glib_none().0,
list.into_ptr(),
))
}
}
fn get_range(&self, offset: u64, size: u32) -> Result<Buffer, FlowReturn> {
@ -289,6 +299,7 @@ unsafe extern "C" fn trampoline_pad_probe(
func: gpointer,
) -> ffi::GstPadProbeReturn {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &&(Fn(&Pad, &mut PadProbeInfo) -> PadProbeReturn + Send + Sync + 'static) =
transmute(func);
let mut data_type = None;

View file

@ -30,9 +30,7 @@ glib_wrapper! {
impl ParseContext {
pub fn new() -> Self {
unsafe {
from_glib_full(ffi::gst_parse_context_new())
}
unsafe { from_glib_full(ffi::gst_parse_context_new()) }
}
pub fn get_missing_elements(&self) -> Vec<String> {
@ -43,3 +41,9 @@ impl ParseContext {
}
}
}
impl Default for ParseContext {
fn default() -> Self {
Self::new()
}
}

View file

@ -21,6 +21,9 @@ use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr};
#[repr(C)]
pub struct QueryRef(ffi::GstQuery);
unsafe impl Send for QueryRef {}
unsafe impl Sync for QueryRef {}
pub type Query = GstRc<QueryRef>;
unsafe impl MiniObject for QueryRef {
@ -145,44 +148,26 @@ impl QueryRef {
pub fn view(&self) -> QueryView<&Self> {
let type_ = unsafe { (*self.as_ptr()).type_ };
if type_ == ffi::GST_QUERY_POSITION {
QueryView::Position(Position(self))
} else if type_ == ffi::GST_QUERY_DURATION {
QueryView::Duration(Duration(self))
} else if type_ == ffi::GST_QUERY_LATENCY {
QueryView::Latency(Latency(self))
} else if type_ == ffi::GST_QUERY_JITTER {
QueryView::Jitter(Jitter(self))
} else if type_ == ffi::GST_QUERY_RATE {
QueryView::Rate(Rate(self))
} else if type_ == ffi::GST_QUERY_SEEKING {
QueryView::Seeking(Seeking(self))
} else if type_ == ffi::GST_QUERY_SEGMENT {
QueryView::Segment(Segment(self))
} else if type_ == ffi::GST_QUERY_CONVERT {
QueryView::Convert(Convert(self))
} else if type_ == ffi::GST_QUERY_FORMATS {
QueryView::Formats(Formats(self))
} else if type_ == ffi::GST_QUERY_BUFFERING {
QueryView::Buffering(Buffering(self))
} else if type_ == ffi::GST_QUERY_CUSTOM {
QueryView::Custom(Custom(self))
} else if type_ == ffi::GST_QUERY_URI {
QueryView::Uri(Uri(self))
} else if type_ == ffi::GST_QUERY_ALLOCATION {
QueryView::Allocation(Allocation(self))
} else if type_ == ffi::GST_QUERY_SCHEDULING {
QueryView::Scheduling(Scheduling(self))
} else if type_ == ffi::GST_QUERY_ACCEPT_CAPS {
QueryView::AcceptCaps(AcceptCaps(self))
} else if type_ == ffi::GST_QUERY_CAPS {
QueryView::Caps(Caps(self))
} else if type_ == ffi::GST_QUERY_DRAIN {
QueryView::Drain(Drain(self))
} else if type_ == ffi::GST_QUERY_CONTEXT {
QueryView::Context(Context(self))
} else {
QueryView::Other(Other(self))
match type_ {
ffi::GST_QUERY_POSITION => QueryView::Position(Position(self)),
ffi::GST_QUERY_DURATION => QueryView::Duration(Duration(self)),
ffi::GST_QUERY_LATENCY => QueryView::Latency(Latency(self)),
ffi::GST_QUERY_JITTER => QueryView::Jitter(Jitter(self)),
ffi::GST_QUERY_RATE => QueryView::Rate(Rate(self)),
ffi::GST_QUERY_SEEKING => QueryView::Seeking(Seeking(self)),
ffi::GST_QUERY_SEGMENT => QueryView::Segment(Segment(self)),
ffi::GST_QUERY_CONVERT => QueryView::Convert(Convert(self)),
ffi::GST_QUERY_FORMATS => QueryView::Formats(Formats(self)),
ffi::GST_QUERY_BUFFERING => QueryView::Buffering(Buffering(self)),
ffi::GST_QUERY_CUSTOM => QueryView::Custom(Custom(self)),
ffi::GST_QUERY_URI => QueryView::Uri(Uri(self)),
ffi::GST_QUERY_ALLOCATION => QueryView::Allocation(Allocation(self)),
ffi::GST_QUERY_SCHEDULING => QueryView::Scheduling(Scheduling(self)),
ffi::GST_QUERY_ACCEPT_CAPS => QueryView::AcceptCaps(AcceptCaps(self)),
ffi::GST_QUERY_CAPS => QueryView::Caps(Caps(self)),
ffi::GST_QUERY_DRAIN => QueryView::Drain(Drain(self)),
ffi::GST_QUERY_CONTEXT => QueryView::Context(Context(self)),
_ => QueryView::Other(Other(self)),
}
}

View file

@ -51,6 +51,7 @@ impl Segment {
}
}
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
pub fn do_seek(
&mut self,
rate: f64,
@ -320,6 +321,12 @@ impl glib::types::StaticType for Segment {
}
}
impl Default for Segment {
fn default() -> Self {
Self::new()
}
}
#[doc(hidden)]
impl<'a> glib::value::FromValueOptional<'a> for Segment {
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {

View file

@ -24,7 +24,7 @@ use Sample;
pub trait Tag<'a> {
type TagType: FromValueOptional<'a> + SetValue;
fn tag_name() -> &'static str;
fn tag_name<'b>() -> &'b str;
}
macro_rules! impl_tag(
@ -32,7 +32,7 @@ macro_rules! impl_tag(
pub struct $name;
impl<'a> Tag<'a> for $name {
type TagType = $t;
fn tag_name() -> &'static str {
fn tag_name<'b>() -> &'b str {
$tag
}
}
@ -244,6 +244,12 @@ impl GstRc<TagListRef> {
}
}
impl Default for GstRc<TagListRef> {
fn default() -> Self {
Self::new()
}
}
impl TagListRef {
pub fn add<'a, T: Tag<'a>>(&mut self, value: T::TagType, mode: TagMergeMode)
where

View file

@ -82,7 +82,7 @@ impl TocRef {
pub fn merge_tags(&mut self, tag_list: TagList, mode: TagMergeMode) {
unsafe {
ffi::gst_toc_merge_tags(self.as_mut_ptr(), tag_list.into_ptr(), mode.to_glib());
ffi::gst_toc_merge_tags(self.as_mut_ptr(), tag_list.as_mut_ptr(), mode.to_glib());
}
}