问题描述
在插件中创建一个新的元素类型的标准方法是gobject风格的派生从GstElement类型与所有这个gobject魔术,如。
The standard method of creating a new element type in plugin is gobject-style "derivation" from GstElement type with all this gobject magic, like this.
我正在写一个项目C ++,它使用GStreamer和一些专门为我的目的的元素。我以上面提到的方式编写了几个插件,但我不满意的代码,因为太多的只是满足gobject的需求。
I'm writting a project in C++ which use GStreamer with some elements specialized for my purpose. I've written several plugins in the way mentioned above, but I'm not satisfied with the code, since too much of it is just to met gobject requirements.
我考虑使用gstreamermm。是否可以使用Gst :: Element的C ++风格派生来创建一种新类型的元素?我的意思是:
I consider using gstreamermm. Is it possible to create a new type of elements with C++-style derivation from Gst::Element? I mean something like:
class MyElement: public Gst::Element
{
...
}
这将是更漂亮的解决方案(假设我已经使用gstreamermm和C ++插件)。
当然,我们需要一个真正的gobject类型,具有唯一的类型id等。
It would be much prettier solution (assuming I'm already using gstreamermm and C++ in the plugin).Of course we need a real gobject type, that have unique type id and so on.
推荐答案
找不到任何合适的,我打补丁gstreamermm,所以它允许这样的元素注册。请参阅它未经测试,直到现在,但似乎工作在几个基本情况。
As I didn't find anything suitable, I patched gstreamermm so it allows such element registration. See https://github.com/peper0/gstreamermm-plugins It is not tested well up till now, but seems to work in several basic cases. Bug reports and feature-requests would be appreciated.
注意:我的补丁没有以gstreamer或gstreamermm开发者的方式授权,所以它可能会破坏一些设计假设在这些项目中。
Notice: my patch isn't authorized in any way by gstreamer or gstreamermm developers, so it may broke some design assumptions made in these projects.
这篇关于GStreamermm:通过从Gst :: Element派生来创建一个新的元素类型(在插件中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!