【发布时间】:2021-04-14 21:02:21
【问题描述】:
我正在关注this 教程,因为我想创建一个 gstreamer 插件。我认为我的教程有点过时了,但是 Cargo.toml 文件没有指定它们用于教程的版本。我在 glib 方面遇到了一些问题,我希望有更多 glib 经验的人可以帮助我。
本教程提示我编写以下几行。 我添加了我遇到的错误,以及我已经在 cmets 中尝试过的东西:
mod rgb2gray/imp
#[derive(Default)]
pub struct Rgb2Gray {}
impl Rgb2Gray {}
// This macro doesn't seem to exist
// I tried putting "glib::glib_object_subclass!();" inside the struct (???)
// after that I get: "the trait `glib::subclass::object::ObjectImpl` is not implemented for `rgb2gray::imp::Rgb2Gray`"
#[glib::object_subclass]
impl ObjectSubclass for Rgb2Gray {
const NAME: &'static str = "RsRgb2Gray";
type Type = super::Rgb2Gray; // TYPE is not a variable in ObjectSubclass
type ParentType = gst_base::BaseTransform;
}
mod rgb2gray
mod imp;
// Again, this macro doesn't seem to exist
// I tried glib::glib_wrapper
glib::wrapper! {
// The following line doesn't accept ObjectSubclass, it does accept Boxed, or Object, or Shared.
// I tried Object, but then it wants more information in the angle brackets... And I'm not sure what kind of information.
pub struct Rgb2Gray(ObjectSubclass<imp::Rgb2Gray>) @extends gst_base::BaseTransform, gst::Element, gst::Object;
}
// more code...
【问题讨论】:
-
你的
Cargo.toml的内容是什么,你从编译器得到什么错误信息?
标签: rust gstreamer glib gstreamer-1.0