Re: [Vala] How to implement the get_type method of Gst.URIHandler interface in vala?
- From: Lei Miao <leimiao09 gmail com>
- To: Luca Bruno <lethalman88 gmail com>
- Cc: Vala List <vala-list gnome org>
- Subject: Re: [Vala] How to implement the get_type method of Gst.URIHandler interface in vala?
- Date: Tue, 18 Mar 2014 18:25:50 -0400
That worked! Thank you so much for the help!
I still have a related question though:
In the following function in the generated c code,
static gchar**my_streaming_source_real_get_protocols (GstURIHandler*
base, GType type, int* result_length1) {
MyStreamingSource * self;
gchar** result = NULL;
gchar** _tmp0_ = NULL;
gint _tmp0__length1 = 0;
self = (MyStreamingSource*) base;
_tmp0_ = MY_STREAMING_SOURCE_protocols;
_tmp0__length1 = G_N_ELEMENTS (MY_STREAMING_SOURCE_protocols);
if (result_length1) {
*result_length1 = _tmp0__length1;
}
result = _tmp0_;
return result;
}
the last argument "int* result_length1" somehow is causing seg faults.
If I remove this argument manually, then the problem goes away.
I was wondering why this argument is added, since in the vapi, I only have:
[CCode (array_length = false, array_null_terminated = true)]
public abstract unowned string[] get_protocols (GLib.Type type);
and in the vala code, I have
"public unowned string[] get_protocols(Type type) { return protocols; }"
where "protocols" is a string array.
Is there a way to remove this argument in the generated c code?
Regards,
LM
On 3/18/2014 4:35 AM, Luca Bruno wrote:
On 17/03/2014 20:29, Lei Miao wrote:
Thanks for pointing out the typo.
Unfortunately, it doesn't resolve the problem.
Below is what I have right now in gstreamer-1.0.vapi:
[CCode (cheader_filename = "gst/gst.h", type_cname =
"GstURIHandlerInterface", type_id = "gst_uri_handler_get_type ()")]
public interface URIHandler : GLib.Object {
[CCode (array_length = false, array_null_terminated = true)]
public abstract unowned string[] get_protocols (GLib.Type type);
public abstract string get_uri ();
[CCode (vfunc_name = "get_type")]
public abstract Gst.URIType get_uri_type (GLib.Type type);
public abstract bool set_uri (string uri) throws GLib.Error;
}
In the generated c file, I have:
iface->get_protocols = (gchar** (*)(GstURIHandler*, GType)) ...
iface->get_uri_type = (GstURIType (*)(GstURIHandler*, GType)) ...
iface->get_uri = (gchar* (*)(GstURIHandler*)) ...
iface->set_uri = (gboolean (*)(GstURIHandler*, const gchar*,
GError**)) ...
It won't compile due to the following error:
error: 'GstURIHandlerInterface' has no member named 'get_uri_type'
If I manually change "iface->get_uri_type" to "iface->get_type", then
it compiles.
Mh ok. Try putting vfunc_name also when implementing the method.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]