[Vala] Some basic problems with gstreamer



Hello,

some other problems, now with gstreamer. I want to "translate" the
example in 
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/
chapter-queryevents.html#section-querying
to vala. But every time I compile the whole thing I get the error:

[sbox-SDK_BETA_X86: ~/oggtest] > make
valac -o oggtest --pkg gstreamer-0.10 oggtest.vala
/home/klaus/oggtest/oggtest.vala:65.17-65.27: error: Argument 2: Cannot
convert from `oggVala.printPosition' to `GLib.SourceFunc'
Compilation failed: 1 error(s), 0 warning(s)
make: *** [oggtest] Error 1
[sbox-SDK_BETA_X86: ~/oggtest] > 

I really don't know how to tell the compiler that printPosition is just
a "SourceFunc". SourceFunc is not a class.  I hope I don't bother you
with those "basic" questions (at least basic for the vala experts, I
think :-)

There are more errors, I get a runtime assertion fail with myBusFunc.

using GLib;
using Gst;

public class oggVala {
        public bool myBusFunc (Gst.Bus bus, Gst.Message message) {
            stdout.printf("Got %d message\n", message.type);
            return true;        
        }         

        public bool printPosition (Element pipeline) {
            Format fmt = Format.TIME;
            int64 pos, len;
    
            pipeline.query_position (ref fmt, out pos);
            stdout.printf("Time %d\n",pos);
            return true;        
        }         

        public static void main(string[] args) {
                MainLoop loop;
                Element src;
                Element sink;
                Element dec;
                Element pipeline;
                Bus bus;

                // Creating a GLib main loop with a default context
                loop = new MainLoop (null, false);

                // Initializing GStreamer
                Gst.init (ref args);

                // Creating pipeline and elements
                pipeline = new Pipeline ("ogg");
                src = ElementFactory.make ("filesrc", "my_src");
                dec = ElementFactory.make ("tremor", "my_dec");
                sink = ElementFactory.make ("esdsink", "my_sink");

                // Adding elements to pipeline
                ((Bin) pipeline).add_many (src, dec, sink);

                // Linking source to dec
                src.link (dec);

                // Linking dec to sink
                dec.link (sink);

                // Setting waveform to square
                src.set ("location","jump.ogg");

                // add a watch for new messages on pipeline
                bus = pipeline.get_bus();
                bus.add_watch(myBusFunc);
                  
                // Set pipeline state to PLAYING
                pipeline.set_state (State.PLAYING);

                Timeout.add (200, printPosition, pipeline);  

                // Start GLib mainloop
                loop.run ();
        }
}




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