Hello all, I'm trying to convert into Perl the given C example of the "level" element (using a message) found at: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-level.html
Trivial, right? I'm using Debian/unstable, so GStreamer 0.15-2 (amd64 build) - nothing very bizzare. 42 lines of code that should be printing out an RMS level from testaudiosrc for each channel every second: #!/usr/bin/perl use strict; use warnings; use GStreamer -init; my $loop = Glib::MainLoop->new; my $pipeline = GStreamer::Pipeline->new("sample"); my $caps = GStreamer::Caps->from_string("audio/x-raw-int,channels=2"); my $testsrc = GStreamer::ElementFactory->make("audiotestsrc", "src"); my $convert = GStreamer::ElementFactory->make("audioconvert", "convert"); my $level = GStreamer::ElementFactory->make("level", "level"); my $sink = GStreamer::ElementFactory->make("fakesink", "sink"); $pipeline->add($testsrc, $convert, $level, $sink); $testsrc->link($convert); $convert->link_filtered($level, $caps); $level->link($sink); $level->set("message", 1); $level->set("interval", 1000000000); # 1 second interval $pipeline->get_bus->add_watch(\&hdl_level, $loop); $pipeline->set_state("playing"); $loop->run; $pipeline->set_state("null"); exit; sub hdl_level { my ($bus, $message, $loop) = @_; printf "Got message: %s\n", $message->type; return unless $message->type eq "element"; my $structure = $message->get_structure; my $name = $structure->get_name; return unless $name eq "level"; my @rms = $structure->get_value("rms"); foreach (@rms) { print "RMS: $_\n"; } return 1; } And my output is: Got message: [ unknown state-changed ] Use of uninitialized value in subroutine entry at ./simple.pl line 26. So 1st line is fine, I know the handler callback is registered; but what's uninitalized (at the run() call) and why isn't it printing the RMS output? I can;t see what I've missed from the C example here.... Many thanks, James -- Email: james_AT_rcpt.to
_______________________________________________ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list