我正在尝试使用 GStreamermm 绑定(bind)在 C++ 中编写一个 gstreamer 插件。现在,有一个很好的插件编写者指南 (http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/),并且在网络上有各种示例和模板,但是对于 gstreamermm,很少大量的文档。
我知道我可以混合使用 C 和 C++,但使用 C++ 绑定(bind)似乎更加优雅。
简单地将 gstreamer pwg 中的示例“翻译”为 gstreamermm 是一种死胡同; gstreamer 需要使用相当多的宏来定义类型,我看不到 gstreamermm 的直接翻译。此外,我对 gstreamer 的经验很少,对 gobj 完全没有经验(到目前为止)。
有人能让我走上正轨吗?即使是最微小的例子或解释也行。
谢谢
最佳答案
我几天前在 gtkmm 邮件列表上问过这个问题,得到了以下答案(来自 José Alburquerque):
Presently, the only plug-ins that have a (probably non-existent) possibility of being developed using gstreamermm are ones that are private to applications. If that's possible, These plug-ins would be registered using the Gst::Plugin::register_static()[1] method and not the process that you've described above.
In theory, one would extend one of the gstreamermm base classes[2] and call the Gst::ElementFactory::register_element()[3] method in the Gst::Plugin::SlotInit slot (callback) so that an element factory that generates these elements can be created. That factory can then be added to the registry using Gst::Registry::add_feature()[4] in the same Gst::Plugin::SlotInit slot.
[2] http://developer.gnome.org/gstreamermm/unstable/group__GstBaseClasses.html
[3] The Gst::ElementFactory::register_element() method is a method that is not implemented yet but would wrap the gst_element_register() function. That would be part of an upcoming release.
I've not tested this and don't really know exactly how it would work (or if it actually would) but it's how I'd try if I had to. However, I think it's easier to write the plug-in in C presently, but that's just a matter of making things easier.
关于c++ - GStreamer 插件与 GStreamermm(C++),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11691016/