Export more stream info functions
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 24 Sep 2016 21:19:04 +0000 (22:19 +0100)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 24 Sep 2016 21:19:04 +0000 (22:19 +0100)
Opusfile.xs
lib/Audio/Opusfile.pm

index a8cf872bc3218ff1b33c71939818a65170f3508a..a8bd27b585c8107bb1868060b79a011b641af42b 100644 (file)
@@ -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
index 3c6a7c2d93990bf474dc9b51efa0e85fdab1e604..8f1e90e5aae07c71aaac90edbc2a63e1192bdc7b 100644 (file)
@@ -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<Warning:> 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<Warning:> 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
This page took 0.012649 seconds and 4 git commands to generate.