Re: Basic GStreamer "level" example converted from C

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:

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' }

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]