Re: [Vala] How to implement the get_type method of Gst.URIHandler interface in vala?



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.

Regards,

LM



On Mon, Mar 17, 2014 at 4:33 AM, Luca Bruno <lethalman88 gmail com> wrote:

On 16/03/2014 22:33, Lei Miao wrote:

Yes, I tried it, but it has no effect.

I have the following in my vala code:
...
[CCode (vfunc = "get_type")]
public URIType get_uri_type (Type type) { return URIType.SRC; }
...

Is it what you recommended?

Basically, the problem is that "iface->get_type =..." is missing in
"...gst_uri_handler_interface_init()" function in the generated c file.

Regards,

Sorry, vfunc_name: https://git.gnome.org/browse/
vala/tree/vapi/gio-2.0.vapi#n1365




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