Re: Basic GStreamer "level" example converted from C
- From: Torsten Schoenfeld <kaffeetisch gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: Basic GStreamer "level" example converted from C
- Date: Sun, 07 Aug 2011 22:45:12 +0200
On 23.04.2011 07:41, James Bromberger wrote:
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
Thanks for the example.
sub hdl_level {
my ($bus, $message, $loop) = @_;
return 1 unless $message->type & 'element' &&
$message->get_structure->{name} eq "level";
my $num_channels = scalar @{$message->get_structure->{fields}[5][2]};
printf "%s: " . join(', ', ('%.4f') x $num_channels) . "\n", scalar
localtime, map { $_->[0] } @{$message->get_structure->{fields}[5][2]};
return 1;
}
Something like this might make the above a bit more general:
my ($rms) = grep { $_->[0] eq 'rms' }
@{$message->get_structure->{fields}};
But that's still rather inelegant. Maybe we need a wrapper for
gst_structure_get_value?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]