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



Hi,

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

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

Glib::Object::Introspection->setup(
                basename => "Gst",
                version => "1.0",
                package => "Gst",
        );

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

Gst::init(\@ARGV);

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);

$mainloop->run();
-----

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
$mainloop->quit()).

What am I doing wrong?

Thanks,

-- 
Wouter Verhelst
NixSys BVBA
M: +32 486 836 198


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