Timm MurrayThanks,I'm trying to pass along a code reference to add_watch() (from of GstBus). My attempt, which is based on the examples in the old GStreamer module, is below. It fails with the message:Which is the "$loop->run" line. Is there some incantation that needs to run on GStreamer1 for the callback reference to be accepted?
Not a CODE reference at hello_callback.pl line 17.
#!perl
use v5.12;
use warnings;
use GStreamer1;
use Glib qw( TRUE FALSE );
my $URI = shift || die "Need URI to play\n";
my $loop = Glib::MainLoop->new( undef, FALSE );
GStreamer1::init([ $0, @ARGV ]);
my $pipeline = GStreamer1::parse_launch( "playbin uri=$URI" );
my $bus = $pipeline->get_bus;
$bus->add_watch( \&bus_callback, $loop );
$pipeline->set_state( "playing" );
$loop->run;
$pipeline->set_state( "null" );
sub bus_callback
{
my ($bus, $message, $loop) = @_;
if( $message->type & "error" ) {
warn $message->error;
$loop->quit;
}
elsif( $message->type & "eos" ) {
$loop->quit;
}
return TRUE;
}
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list