问题
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.
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.
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
{
...
}
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.
回答1:
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.
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.
来源:https://stackoverflow.com/questions/9609201/gstreamermm-creating-a-new-element-type-in-plugin-by-deriving-from-gsteleme