How to emit signal in node-gtk

Hi everyone,

I am trying writing Playback tutorial 1: Playbin usage to TypeScript with node-gtk

But g_signal_emit_by_name does not exist in node-gtk

I use g_signal_emitv instead

Works great in C

GType itype = g_type_from_name("GstPlayBin");
GValue instance_and_params[2] = {G_VALUE_INIT, G_VALUE_INIT};
g_value_init(&instance_and_params[0], itype);
g_value_set_object(&instance_and_params[0], data->playbin);
g_value_init(&instance_and_params[1], G_TYPE_INT);
g_value_set_int(&instance_and_params[1], i);
guint signal_id = g_signal_lookup("get-video-tags", itype);
GValue return_value = G_VALUE_INIT;
g_value_init(&return_value, g_type_from_name("GstTagList"));
g_signal_emitv(instance_and_params, signal_id, 0, &return_value);
GstTagList* tags = g_value_get_boxed(&return_value);

But it doesn’t work in node-gtk

const itype = GObject.typeFromName('GstPlayBin');
const instanceAndParams = [new GObject.Value(), new GObject.Value()];
instanceAndParams[0].init(itype);
instanceAndParams[0].setObject(data.playbin);
instanceAndParams[1].init(GObject.TYPE_INT);
instanceAndParams[1].setInt(i);
const signalId = GObject.signalLookup('get-video-tags', itype);
const returnValue = new GObject.Value();
returnValue.init(GObject.typeFromName('GstTagList'));
GObject.signalEmitv(instanceAndParams, signalId, 0, returnValue);
const tags = returnValue.getBoxed<Gst.TagList>();

Execution log:

(node:538554): GLib-GObject-CRITICAL **: 22:34:52.348: can't peek value table for type '(null)' which is not currently referenced
(node:538554): GLib-GObject-CRITICAL **: 22:34:52.349: g_value_peek_pointer: assertion 'value_table' failed
(node:538554): GLib-GObject-CRITICAL **: 22:34:52.349: invalid (NULL) pointer instance
(node:538554): GLib-GObject-CRITICAL **: 22:34:52.349: signal_emitv_unlocked: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
** (node:538554): CRITICAL **: 22:34:52.349: Unable to determine array length for 0x3dd05680

Each line of code corresponds to C

I don’t understand why I still can’t get the TagList

You’ll have to get g_signal_emit_by_name() bindings added to node-gtk, and that g_signal_emitv() does not work like this also seems to be a node-gtk bug.

IMHO this looks like an error between JS GObject.signalEmitv and C g_signal_emitv -
g_signal_emitv expects a C array with 2 GValues, but for some reason (from C point of view) it received something else.

I think you can propagate this to node-gtk as the issue you run into is definitelly not something GStreamer-specific.

P.S. following this message

** (node:538554): CRITICAL **: 22:34:52.349: Unable to determine array length for 0x3dd05680

maybe there’s a hope to work it around with

instanceAndParams.length = 2