From 9fc88b294214d5944b6bb5076528f7dd427d6e0c Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 18 Feb 2017 17:49:24 +0200 Subject: [PATCH] Export op_current_link --- Opusfile.xs | 16 +++++++++++++++- lib/Audio/Opusfile.pm | 9 +++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Opusfile.xs b/Opusfile.xs index 40037e1..243795f 100644 --- a/Opusfile.xs +++ b/Opusfile.xs @@ -81,11 +81,17 @@ long op_raw_total(of, li = -1) Audio::Opusfile of; int li; +POSTCALL: + if(RETVAL < 0) + croak("op_current_link returned error %ld\n", RETVAL); long op_pcm_total(of, li = -1) Audio::Opusfile of; int li; +POSTCALL: + if(RETVAL < 0) + croak("op_current_link returned error %ld\n", RETVAL); Audio::Opusfile::Head op_head(of, li = -1) @@ -97,12 +103,20 @@ op_tags(of, li = -1) Audio::Opusfile of; int li; -# op_current_link not exported until we export the decoding API +int +op_current_link(of) + Audio::Opusfile of; +POSTCALL: + if(RETVAL < 0) + croak("op_current_link returned error %ld\n", RETVAL); int op_bitrate(of, li = -1) Audio::Opusfile of; int li; +POSTCALL: + if(RETVAL < 0) + croak("op_bitrate returned error %ld\n", RETVAL); long op_bitrate_instant(of) diff --git a/lib/Audio/Opusfile.pm b/lib/Audio/Opusfile.pm index a6bbc47..f5a1365 100644 --- a/lib/Audio/Opusfile.pm +++ b/lib/Audio/Opusfile.pm @@ -206,6 +206,15 @@ 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 $of->B + +Retrieve the index of the current link. + +This is the link that produced the data most recently read by +op_read_float() or its associated functions, or, after a seek, the +link that the seek target landed in. Reading more data may advance the +link index (even on the first read after a seek). + =item $of->B([I<$link_index>]) Computes the bitrate of the stream (with no arguments), or of an -- 2.39.2