gstreamermm, Gst::AudioSink and virtual functions



Hi,

     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, gstreamermm and gobject. Also I have no background or real interest in gtkmm as I’m not working on GUI code at present.

 

I am trying to create a class along the lines of:

 

class MyAudioSink: public Gst::AudioSink

{

public:

    explicit MyAudioSink(KantarAudioSink *gobj);

    virtual ~MyAudioSink();

 

    static void class_init(Gst::ElementClass<MyAudioSink> *klass);

 

    virtual int write_vfunc(gpointer data, guint length) override;

    virtual void reset_vfunc();

};

 

I seem to missing some magic in the class_init() function that should link the base class functions to the virtual functions in MyAudioSink.

In C we would do something like:

 

  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);

  GstAudioSinkClass *audio_sink_class = GST_AUDIO_SINK_CLASS (klass);

  audio_sink_class->write = GST_DEBUG_FUNCPTR (myaudiosink_write);

 

I don’t really grok the C++ binding to gobject.

What is the equivalent for linking to the C++ virtual function hierarchy?

 

I got the impression from Marcin’s video https://gstconf.ubicast.tv/videos/gstreamermm-c-way-of-doing-gstreamer-based-applications/ that the virtual functions should be invoked automatically.

 

I can create a half usable (doesn’t handle things like EOS) plugin by adding:

 

   add_pad(sinkpad = Gst::Pad::create(get_pad_template("sink"), "sink"));

   sinkpad->set_chain_function(sigc::mem_fun(*this, &MyAudioSink::chain));

 

But a sink should not have a chain function.

Also it seems strange that I have to add the sink pad at all. An audio sink should already have one I should just need to refine the capabilities a bit more.

I guess this is an artifact of using gmmproc to create C++ wrappers? I don’t want to use gmmproc myself (I not sure what package its in anyway).

 

I think there should some example elements and more introductory documentation (this is something I may be able to help with as I do this other commitments permitting). The best example transform element I could find was the foo element used in the test code. There is no equivalent for a sink element.

 

It’s also worth mentioning that the generated documentation does not appear online here https://developer.gnome.org/gstreamermm/1.10/

 

Regards,

 

Bruce.



Kantar Disclaimer


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]