interfacing gobject with C++

前端 未结 2 2097
野性不改
野性不改 2021-01-26 04:44

I’m trying to create a custom audio sink plugin for gstreamer using the Gst::AudioSink as a base class. For me this involves multiple learning curves as I’m new to gstreamer, gs

2条回答
  •  一生所求
    2021-01-26 05:35

    You can find examples of writing your own plugin in the repository: https://git.gnome.org/browse/gstreamermm/tree/tests/plugins/derivedfrombasetransform.h

    In general, your header looks ok, and full implementation should look (more or less) like that:

    class MyAudioSink: public Gst::AudioSink
    {
    public:
        explicit MyAudioSink(KantarAudioSink *gobj)
            : Glib::ObjectBase(typeid (MyAudioSink)),
              Gst::AudioSink(gobj) {}
    
        static void class_init(Gst::ElementClass *klass)
        {
            // Y
            klass->set_metadata("longname", "classification", "description", "author");
    
            klass->add_pad_template(Gst::PadTemplate::create("sink", Gst::PAD_SINK, Gst::PAD_ALWAYS, Gst::Caps::create_any()));
        }
    
        virtual int write_vfunc(gpointer data, guint length) override {}
        virtual void reset_vfunc() {}
    };
    

    Very recently we had a bug report when someone posted very nice, tiny example of audiofilter plugin, you can use it as an example for your project as well: https://bug794249.bugzilla-attachments.gnome.org/attachment.cgi?id=369564

    If this doesn't work, feel free to file a bug here: https://bugzilla.gnome.org/enter_bug.cgi?product=gstreamermm

提交回复
热议问题