From: Marius Gavrilescu Date: Sat, 24 Sep 2016 21:19:04 +0000 (+0100) Subject: Export more stream info functions X-Git-Tag: 0.004~2 X-Git-Url: http://git.ieval.ro/?p=audio-opusfile.git;a=commitdiff_plain;h=dc986a40f5a09844558d50c2017667de606ab6f5 Export more stream info functions --- diff --git a/Opusfile.xs b/Opusfile.xs index a8cf872..a8bd27b 100644 --- a/Opusfile.xs +++ b/Opusfile.xs @@ -75,6 +75,18 @@ op_serialno(of, li = -1) Audio::Opusfile of; int li; +# op_channel_count is not exported; it can be obtained via op_head + +long +op_raw_total(of, li = -1) + Audio::Opusfile of; + int li; + +long +op_pcm_total(of, li = -1) + Audio::Opusfile of; + int li; + Audio::Opusfile::Head op_head(of, li = -1) Audio::Opusfile of; @@ -85,6 +97,16 @@ op_tags(of, li = -1) Audio::Opusfile of; int li; +# op_current_link not exported until we export the decoding API + +int +op_bitrate(of, li = -1) + Audio::Opusfile of; + int li; + +# op_bitrate_instant, op_raw_tell, op_pcm_tell not exported until we +# export the decoding API + MODULE = Audio::Opusfile PACKAGE = Audio::Opusfile::Tags PREFIX = opus_tags_ int diff --git a/lib/Audio/Opusfile.pm b/lib/Audio/Opusfile.pm index 3c6a7c2..8f1e90e 100644 --- a/lib/Audio/Opusfile.pm +++ b/lib/Audio/Opusfile.pm @@ -177,6 +177,49 @@ If the source is not seekable, I<$link_index> is negative, or I<$link_index> is not given, then this function returns the serial number of the current link. +=item B<$of>->op_raw_total([I<$link_index>]) + +Get the total (compressed) size of the stream (with no arguments), or +of an individual link in a (possibly-chained) Ogg Opus stream (with +one nonnegative argument), including all headers and Ogg muxing +overhead. + +The stream must be seekable to get the total. A negative value is +returned if the stream is not seekable. + +B If the Opus stream (or link) is concurrently multiplexed +with other logical streams (e.g., video), this returns the size of the +entire stream (or link), not just the number of bytes in the first +logical Opus stream. Returning the latter would require scanning the +entire file. + +=item B<$of>->op_pcm_total([I<$link_index>]) + +Get the total PCM length (number of samples at 48 kHz) of the stream +(with no arguments), or of an individual link in a (possibly-chained) +Ogg Opus stream (with one nonnegative argument). + +Users looking for op_time_total() should use this function instead. +Because timestamps in Opus are fixed at 48 kHz, there is no need for a +separate function to convert this to seconds. + +The stream must be seekable to get the total. A negative value is +returned if the stream is not seekable. + +=item B<$of>->op_bitrate([I<$link_index>]) + +Computes the bitrate of the stream (with no arguments), or of an +individual link in a (possibly-chained) Ogg Opus stream (with one +nonnegative argument). + +The stream must be seekable to compute the bitrate. A negative value +is returned if the stream is not seekable. + +B If the Opus stream (or link) is concurrently multiplexed with +other logical streams (e.g., video), this uses the size of the entire +stream (or link) to compute the bitrate, not just the number of bytes +in the first logical Opus stream. + =back =head1 EXPORT