[Vala] gstreamer appsink bindings



Hi,

I'm trying to use gstreamer plugin "appsink" and setup its callbacks using "set_callbacks" method. Main 
parameter of this method is "AppSinkCallbacks" class, which is the main problem for me. I need to setup 
callbacks, but I really don't know how to do it in vala. Here are two examples of what I was trying, both 
don't compile:

1)
public static int main (string[] args) {
    //Gst.AppSinkCallbacks cbks;
    var cbks = new Gst.AppSinkCallbacks();
    return 0;
}

gives:
`Gst.AppSinkCallbacks' does not have a default constructor
||     var cbks = new Gst.AppSinkCallbacks();

2)
void eos_cb() {
    stdout.printf("eos_cb\n");
}
public static int main (string[] args) {
    Gst.AppSinkCallbacks cbks;
    cbks.eos = eos_cb;
    return 0;
}

gives:
use of possibly unassigned local variable `cbks'
||     cbks.eos = eos_cb;


AppSinkCallbacks is declared in gstreamer-app-0.10.vapi as:
        [Compact]
        [CCode (cheader_filename = "gst/app/gstappsink.h")]
        public class AppSinkCallbacks {
                public weak GLib.Callback eos;
                public weak GLib.Callback new_buffer;
                public weak GLib.Callback new_buffer_list;
                public weak GLib.Callback new_preroll;
        }


and in gstreamer-plugins-base C code as:

typedef struct {
  void          (*eos)              (GstAppSink *sink, gpointer user_data);
  GstFlowReturn (*new_preroll)      (GstAppSink *sink, gpointer user_data);
  GstFlowReturn (*new_buffer)       (GstAppSink *sink, gpointer user_data);
  GstFlowReturn (*new_buffer_list)  (GstAppSink *sink, gpointer user_data);

  /*< private >*/
  gpointer     _gst_reserved[GST_PADDING - 1];
} GstAppSinkCallbacks;


I'm using vala 0.8.1.

What is a correct way of using AppSinkCallbacks?

Thanks for any help or reply.



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