Hi, Thanks for your help so far. I’ve made some progress but I’m still stuck. I am still trying to create a ‘do nothing’ audiosink upon which I can build.
Is there a clear statement somewhere of what an C++ audiosink class must provide? I was able to create a a ‘do nothing’ sink using “gst-element-maker mydemosink audiosink” which seems to work but there is nothing obvious to translate from that code into the C++ version. The latest output is: (gst-launch-1.0:16830): GStreamer-CRITICAL **: gst_object_set_parent: assertion 'GST_IS_OBJECT (object)' failed ** (gst-launch-1.0:16830): CRITICAL **: gst_audio_ring_buffer_open_device: assertion 'GST_IS_AUDIO_RING_BUFFER (buf)' failed (gst-launch-1.0:16830): GStreamer-CRITICAL **: gst_object_unparent: assertion 'GST_IS_OBJECT (object)' failed ERROR: Pipeline doesn't want to pause. I thought the ring buffer was provided by the parent class AudioBaseSink but it seems not. Note for testing this I’m using: gst-launch-1.0 -v audiotestsrc blocksize=8000 num-buffers=10 ! audio/x-raw,rate=8000,channels=1 ! myaudiosink The simplest MyAudioSink.hpp to reproduce this: #include <gstreamermm.h> #include <gstreamermm/audiosink.h> class MyAudioSink: public Gst::AudioSink
{ public: explicit MyAudioSink(Gst::AudioSink::BaseObjectType* gobj): Glib::ObjectBase(typeid (MyAudioSink)), // type must be registered before use Gst::AudioSink(gobj) { } virtual ~MyAudioSink() { } static void class_init(Gst::ElementClass<MyAudioSink> *klass) { klass->set_metadata("MyAudioSink", "Sink/Audio", "A test audio sink", "author"); klass->add_pad_template(Gst::PadTemplate::create("sink", Gst::PAD_SINK, Gst::PAD_ALWAYS, Gst::Caps::create_from_string("audio/x-raw,format=S16LE,rate=8000,channels=1"))); } }; A C++ myaudiofilter derived from AudioFilter on the other hand seems to just work: gst-launch-1.0 audiotestsrc blocksize=8000 num-buffers=10 ! audio/x-raw,rate=8000,channels=1 ! myaudiofilter ! fakesink Calling create_ring_buffer() in the constructor MyAudioSink causes a seg fault: (gst-inspect-1.0:23564): GStreamer-CRITICAL **: gst_object_set_parent: assertion 'GST_IS_OBJECT (object)' failed (gst-inspect-1.0:23564): GLib-GObject-CRITICAL **: g_object_get_qdata: assertion 'G_IS_OBJECT (object)' failed (gst-inspect-1.0:23564): GLib-GObject-CRITICAL **: g_object_get_qdata: assertion 'G_IS_OBJECT (object)' failed Segmentation fault (core dumped) #3 fault_handler_sighandler (signum=11) at gst-launch.c:94 #4 <signal handler called> #5 0x00007eff8272b898 in Glib::wrap_auto(_GObject*, bool) () from /usr/lib/x86_64-linux-gnu/libglibmm-2.4.so.1 #6 0x00007eff82df5bcf in Glib::wrap(_GstAudioRingBuffer*, bool) () from /usr/lib/x86_64-linux-gnu/libgstreamermm-1.0.so.1 #7 0x00007eff82df16c6 in Gst::AudioBaseSink::create_ring_buffer() () from /usr/lib/x86_64-linux-gnu/libgstreamermm-1.0.so.1 #8 0x00007eff830f5eb4 in MyAudioSink::MyAudioSink I tried putting it in some of the vfunc’s like open, reset , write and start instead but none of them are invoked before it starts asserting.
Its not immediately obvious where to set a breakpoint to try and track this down I’m wading through glib and gstreamer source trying to find out without much success so far. Any tips would be appreciated. Regards, Bruce. |