Setting up slots on signals

Russel Winder russel at winder.org.uk
Sun Mar 27 09:39:21 UTC 2016


I am trying to set up callbacks for the tuning signals of a DVB
pipeline in a playbin.

I have a call:

engine->set_tuning_callbacks(
	[](GstDvbSrc *, gpointer) { printf("Tuning started."); },
	[](GstDvbSrc *, gpointer) { printf("Tuning failed."); },
	[](GstDvbSrc *, gpointer) { printf("Tuning succeeded."); }
);

to the code:

void GStreamerEngine::set_tuning_callbacks(
	void (*start_callback)(GstDvbSrc *, gpointer),
	void (*failed_callback)(GstDvbSrc *, gpointer),
	void (*succeeded_callback)(GstDvbSrc *, gpointer)
) {
	g_assert(dvb_base_bin != nullptr);
	g_assert(start_callback != nullptr);
	g_assert(failed_callback != nullptr);
	g_assert(succeeded_callback != nullptr);
	g_signal_connect(dvb_base_bin, "tuning-start", G_CALLBACK(start_callback), nullptr);
	g_signal_connect(dvb_base_bin, "tuning-fail", G_CALLBACK(failed_callback), nullptr);
	g_signal_connect(dvb_base_bin, "tuning-done", G_CALLBACK(succeeded_callback), nullptr);
}

The value of dvb_base_bin is captured with:

void GStreamerEngine::on_source_created (GstElement * source, GstElement * pipe) {
	// Some other unrelated stuff here elided.
	dvb_base_bin = source;
	g_assert(dvb_base_bin != nullptr);
}

which is the callback for the "source-created" signal.

This appears to work, i.e. it compiles fine, and there are no failures
of the code to render DVB-T. However when executed, instead of the
messages from my callbacks, I appear to get:


(me-tv:20984): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer

(me-tv:20984): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(me-tv:20984): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer

(me-tv:20984): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(me-tv:20984): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer

(me-tv:20984): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed


I am not sure how to investigate this further to find out what is
actually happening, and why my callback are not being executed.

Setting GST_DEBUG=3 doesn't appear to provide any constructive data for
this issue.

Full code can be found at https://github.com/Me-TV/Me-TV


-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160327/1f54963b/attachment.sig>


More information about the gstreamer-devel mailing list