"Not a CODE reference" error with Gtk::Bus::add_watch


I've got a little bit of perl code like this:

use Glib;
use Glib::Object::Introspection;

                basename => "Gst",
                version => "1.0",
                package => "Gst",

my $mainloop = Glib::MainLoop->new();


sub buswatch {
        my $bus = shift;
        my $msg = shift;
        my $loop = shift;

        print "got a bus message: $bus $msg $data\n";

        return 1;

my $pipeline = Gst::parse_launch("...");

my $bus = $pipeline->get_bus();
$bus->add_watch(\&buswatch, $mainloop);


where the "parse_launch" call obviously has a valid gstreamer pipeline
entered into it.

Unfortunately, when I run it, I get "Not a CODE reference at line X",
where X points to the line "$mainloop->run();". If I comment out the
line with $bus->add_watch(), then the error disappears, but then I never
get the "EOS" message from gstreamer (and I can't do a

What am I doing wrong?


Wouter Verhelst
M: +32 486 836 198

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