为 gstreamer crate 0.14 编写 rust/gstreamer 插件需要哪些依赖项?
What dependencies are needed to write rust/gstreamer plugins for gstreamer crate 0.14?
我正在尝试按照 https://coaxion.net/blog/2018/01/how-to-write-gstreamer-elements-in-rust-part-1-a-video-filter-for-converting-rgb-to-grayscale/ 上关于使用 Rust 编写 gstreamer 插件的教程进行操作。
如果你按照教程到我有可编译代码的第一点 Cargo.toml 是
[package]
name = "gst-plugin-tutorial"
version = "0.1.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://github.com/sdroege/gst-plugin-rs"
license = "MIT/Apache-2.0"
[dependencies]
glib = "0.4"
gstreamer = "0.10"
gstreamer-base = "0.10"
gstreamer-video = "0.10"
gst-plugin = "0.1"
[lib]
name = "gstrstutorial"
crate-type = ["cdylib"]
path = "src/lib.rs"
和 src/lib.rs 是
extern crate glib;
#[macro_use]
extern crate gstreamer as gst;
extern crate gstreamer_base as gst_base;
extern crate gstreamer_video as gst_video;
#[macro_use]
extern crate gst_plugin;
plugin_define!(
b"rstutorial[=12=]",
b"Rust Tutorial Plugin[=12=]",
plugin_init,
b"1.0[=12=]",
b"MIT/X11[=12=]",
b"rstutorial[=12=]",
b"rstutorial[=12=]",
b"https://github.com/sdroege/gst-plugin-rs[=12=]",
b"2017-12-30[=12=]"
);
fn plugin_init(plugin: &gst::Plugin) -> bool {
true
}
这可以编译,但是我需要为其编写插件的项目使用 gstreamer 1.16,因此它需要 rust crate gstreamer 0.14。
当我更改 Cargo.toml 以引用 gstreamer crate 的最新版本时:
[dependencies]
#glib = "0.4"
gstreamer = "0.14"
gstreamer-base = "0.14"
gstreamer-video = "0.14"
gst-plugin = "0.3.2"
我在构建时遇到错误:
Updating crates.io index
error: failed to select a version for `glib-sys`.
... required by package `gstreamer-base v0.14.0`
... which is depended on by `gst-plugin-tutorial v0.1.0 (/home/thoth/src/rust-gst-plugin-exp/coaxion-plugin)`
versions that meet the requirements `^0.9` are: 0.9.0
the package `glib-sys` links to the native library `glib`, but it conflicts with a previous package which links to `glib` as well:
package `glib-sys v0.7.0`
... which is depended on by `gst-plugin v0.3.2`
... which is depended on by `gst-plugin-tutorial v0.1.0 (/home/thoth/src/rust-gst-plugin-exp/coaxion-plugin)`
failed to select a version for `glib-sys` which could resolve this conflict
在 rust 中编写与 gstreamer 1.16 一起使用的 gstreamer 插件的 crate 版本的正确组合是什么?
您可以找到教程的新版本 here and the latest version of the code here。
您的问题是您仍在使用 gst-plugin
板条箱,但现在已经过时了,所有内容都是 glib
/ gstreamer
/ gstreamer-base
/ 等等如果您启用它们的 subclass
功能,现在会生成板条箱。有关详细信息,请参阅上面的链接。
根据旧版本的 gst-plugin
crate 将引入旧版本的 glib-sys
(和其他)crate,并且你不能有两个不同版本的 -sys
同一个项目中的箱子。
如果取消注释 glib
依赖项,您将再次遇到同样的问题。将其更新为 glib
的 0.8
版本后,该错误也会消失。
作为塞巴斯蒂安答案的变体,我试验了一个 Cargo.toml 不指向 git 并使用已发布的板条箱。
glib = "0.8"
gstreamer = "0.14"
gstreamer-base = "0.14"
gstreamer-video = "0.14"
#gst-plugin = "0.3.2"
未能提供 gst_plugin_define!
的定义。这似乎是子类化功能的一部分。切换到以下依赖项:
glib = { version = "0.8", features = [ "subclassing"] }
gstreamer = { version = "0.14", features = [ "subclassing"] }
gstreamer-base = { version = "0.14", features = [ "subclassing"] }
gstreamer-video = "0.14"
激活了定义 gst_plugin_define!
宏的代码。
我正在尝试按照 https://coaxion.net/blog/2018/01/how-to-write-gstreamer-elements-in-rust-part-1-a-video-filter-for-converting-rgb-to-grayscale/ 上关于使用 Rust 编写 gstreamer 插件的教程进行操作。
如果你按照教程到我有可编译代码的第一点 Cargo.toml 是
[package]
name = "gst-plugin-tutorial"
version = "0.1.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://github.com/sdroege/gst-plugin-rs"
license = "MIT/Apache-2.0"
[dependencies]
glib = "0.4"
gstreamer = "0.10"
gstreamer-base = "0.10"
gstreamer-video = "0.10"
gst-plugin = "0.1"
[lib]
name = "gstrstutorial"
crate-type = ["cdylib"]
path = "src/lib.rs"
和 src/lib.rs 是
extern crate glib;
#[macro_use]
extern crate gstreamer as gst;
extern crate gstreamer_base as gst_base;
extern crate gstreamer_video as gst_video;
#[macro_use]
extern crate gst_plugin;
plugin_define!(
b"rstutorial[=12=]",
b"Rust Tutorial Plugin[=12=]",
plugin_init,
b"1.0[=12=]",
b"MIT/X11[=12=]",
b"rstutorial[=12=]",
b"rstutorial[=12=]",
b"https://github.com/sdroege/gst-plugin-rs[=12=]",
b"2017-12-30[=12=]"
);
fn plugin_init(plugin: &gst::Plugin) -> bool {
true
}
这可以编译,但是我需要为其编写插件的项目使用 gstreamer 1.16,因此它需要 rust crate gstreamer 0.14。
当我更改 Cargo.toml 以引用 gstreamer crate 的最新版本时:
[dependencies]
#glib = "0.4"
gstreamer = "0.14"
gstreamer-base = "0.14"
gstreamer-video = "0.14"
gst-plugin = "0.3.2"
我在构建时遇到错误:
Updating crates.io index
error: failed to select a version for `glib-sys`.
... required by package `gstreamer-base v0.14.0`
... which is depended on by `gst-plugin-tutorial v0.1.0 (/home/thoth/src/rust-gst-plugin-exp/coaxion-plugin)`
versions that meet the requirements `^0.9` are: 0.9.0
the package `glib-sys` links to the native library `glib`, but it conflicts with a previous package which links to `glib` as well:
package `glib-sys v0.7.0`
... which is depended on by `gst-plugin v0.3.2`
... which is depended on by `gst-plugin-tutorial v0.1.0 (/home/thoth/src/rust-gst-plugin-exp/coaxion-plugin)`
failed to select a version for `glib-sys` which could resolve this conflict
在 rust 中编写与 gstreamer 1.16 一起使用的 gstreamer 插件的 crate 版本的正确组合是什么?
您可以找到教程的新版本 here and the latest version of the code here。
您的问题是您仍在使用 gst-plugin
板条箱,但现在已经过时了,所有内容都是 glib
/ gstreamer
/ gstreamer-base
/ 等等如果您启用它们的 subclass
功能,现在会生成板条箱。有关详细信息,请参阅上面的链接。
根据旧版本的 gst-plugin
crate 将引入旧版本的 glib-sys
(和其他)crate,并且你不能有两个不同版本的 -sys
同一个项目中的箱子。
如果取消注释 glib
依赖项,您将再次遇到同样的问题。将其更新为 glib
的 0.8
版本后,该错误也会消失。
作为塞巴斯蒂安答案的变体,我试验了一个 Cargo.toml 不指向 git 并使用已发布的板条箱。
glib = "0.8"
gstreamer = "0.14"
gstreamer-base = "0.14"
gstreamer-video = "0.14"
#gst-plugin = "0.3.2"
未能提供 gst_plugin_define!
的定义。这似乎是子类化功能的一部分。切换到以下依赖项:
glib = { version = "0.8", features = [ "subclassing"] }
gstreamer = { version = "0.14", features = [ "subclassing"] }
gstreamer-base = { version = "0.14", features = [ "subclassing"] }
gstreamer-video = "0.14"
激活了定义 gst_plugin_define!
宏的代码。