]> iEval git - audio-opusfile.git/blobdiff - Opusfile.xs
Bump version and update Changes
[audio-opusfile.git] / Opusfile.xs
index 43ab5a608fe34a6a016fc38d98cbaea41d433452..a8bd27b585c8107bb1868060b79a011b641af42b 100644 (file)
 
 #include "const-c.inc"
 
+typedef OggOpusFile*    Audio__Opusfile;
+typedef const OpusHead* Audio__Opusfile__Head;
+typedef const OpusTags* Audio__Opusfile__Tags;
+typedef const OpusPictureTag* Audio__Opusfile__PictureTag;
+
 MODULE = Audio::Opusfile               PACKAGE = Audio::Opusfile               PREFIX = op_
 
 PROTOTYPES: ENABLE
 INCLUDE: const-xs.inc
 
-OggOpusFile*
+Audio::Opusfile
 op_open_file(path)
        const char *path;
 PREINIT:
@@ -27,7 +32,7 @@ POSTCALL:
        if(err)
                croak("op_open_file returned error %d\n", err);
 
-OggOpusFile*
+Audio::Opusfile
 op_open_memory(const char *data, size_t length(data))
 PREINIT:
        int err;
@@ -53,49 +58,71 @@ OUTPUT:
 
 void
 DESTROY(of)
-       OggOpusFile *of;
+       Audio::Opusfile of;
 CODE:
        op_free(of);
 
 bool
 op_seekable(of)
-       OggOpusFile* of;
+       Audio::Opusfile of;
 
 int
 op_link_count(of)
-       OggOpusFile* of;
+       Audio::Opusfile of;
 
 int
 op_serialno(of, li = -1)
-       OggOpusFile* of;
+       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;
 
-const OpusHead*
+long
+op_pcm_total(of, li = -1)
+       Audio::Opusfile of;
+       int li;
+
+Audio::Opusfile::Head
 op_head(of, li = -1)
-       OggOpusFile *of;
+       Audio::Opusfile of;
        int li;
 
-const OpusTags*
+Audio::Opusfile::Tags
 op_tags(of, li = -1)
-       OggOpusFile *of;
+       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
 opus_tags_query_count(tags, tag)
-       const OpusTags* tags;
+       Audio::Opusfile::Tags tags;
        const char* tag;
 
 const char*
 opus_tags_query(tags, tag, count = 0)
-       const OpusTags* tags;
+       Audio::Opusfile::Tags tags;
        const char* tag;
        int count;
 
 MODULE = Audio::Opusfile               PACKAGE = Audio::Opusfile::PictureTag           PREFIX = opus_picture_tag_
 
-const OpusPictureTag*
+Audio::Opusfile::PictureTag
 opus_picture_tag_parse(tag)
        const char *tag;
 PREINIT:
@@ -111,13 +138,13 @@ OUTPUT:
 
 void
 DESTROY(pic)
-       const OpusPictureTag* pic
+       Audio::Opusfile::PictureTag pic
 CODE:
        Safefree(pic);
 
 int
 type(pic)
-       const OpusPictureTag *pic;
+       Audio::Opusfile::PictureTag pic;
 CODE:
        RETVAL = pic->type;
 OUTPUT:
@@ -125,7 +152,7 @@ OUTPUT:
 
 const char*
 mime_type(pic)
-       const OpusPictureTag *pic;
+       Audio::Opusfile::PictureTag pic;
 CODE:
        RETVAL = pic->mime_type;
 OUTPUT:
@@ -133,7 +160,7 @@ OUTPUT:
 
 const char*
 description(pic)
-       const OpusPictureTag *pic;
+       Audio::Opusfile::PictureTag pic;
 CODE:
        RETVAL = pic->description;
 OUTPUT:
@@ -141,7 +168,7 @@ OUTPUT:
 
 int
 width(pic)
-       const OpusPictureTag *pic;
+       Audio::Opusfile::PictureTag pic;
 CODE:
        RETVAL = pic->width;
 OUTPUT:
@@ -149,7 +176,7 @@ OUTPUT:
 
 int
 height(pic)
-       const OpusPictureTag *pic;
+       Audio::Opusfile::PictureTag pic;
 CODE:
        RETVAL = pic->height;
 OUTPUT:
@@ -157,7 +184,7 @@ OUTPUT:
 
 int
 depth(pic)
-       const OpusPictureTag *pic;
+       Audio::Opusfile::PictureTag pic;
 CODE:
        RETVAL = pic->depth;
 OUTPUT:
@@ -165,7 +192,7 @@ OUTPUT:
 
 int
 colors(pic)
-       const OpusPictureTag *pic;
+       Audio::Opusfile::PictureTag pic;
 CODE:
        RETVAL = pic->colors;
 OUTPUT:
@@ -173,7 +200,7 @@ OUTPUT:
 
 int
 data_length(pic)
-       const OpusPictureTag *pic;
+       Audio::Opusfile::PictureTag pic;
 CODE:
        RETVAL = pic->data_length;
 OUTPUT:
@@ -181,7 +208,7 @@ OUTPUT:
 
 SV*
 data(pic)
-       const OpusPictureTag *pic;
+       Audio::Opusfile::PictureTag pic;
 CODE:
        RETVAL = newSVpvn(pic->data, pic->data_length);
 OUTPUT:
@@ -189,7 +216,7 @@ OUTPUT:
 
 int
 format(pic)
-       const OpusPictureTag *pic;
+       Audio::Opusfile::PictureTag pic;
 CODE:
        RETVAL = pic->format;
 OUTPUT:
@@ -199,7 +226,7 @@ MODULE = Audio::Opusfile            PACKAGE = Audio::Opusfile::Head
 
 int
 version(head)
-       const OpusHead* head;
+       Audio::Opusfile::Head head;
 CODE:
        RETVAL = head->version;
 OUTPUT:
@@ -207,7 +234,7 @@ OUTPUT:
 
 int
 channel_count(head)
-       const OpusHead* head;
+       Audio::Opusfile::Head head;
 CODE:
        RETVAL = head->channel_count;
 OUTPUT:
@@ -215,7 +242,7 @@ OUTPUT:
 
 unsigned
 pre_skip(head)
-       const OpusHead* head;
+       Audio::Opusfile::Head head;
 CODE:
        RETVAL = head->pre_skip;
 OUTPUT:
@@ -223,15 +250,23 @@ OUTPUT:
 
 unsigned
 input_sample_rate(head)
-       const OpusHead* head;
+       Audio::Opusfile::Head head;
 CODE:
        RETVAL = head->input_sample_rate;
 OUTPUT:
        RETVAL
 
+int
+output_gain(head)
+       Audio::Opusfile::Head head;
+CODE:
+       RETVAL = head->output_gain;
+OUTPUT:
+       RETVAL
+
 int
 mapping_family(head)
-       const OpusHead* head;
+       Audio::Opusfile::Head head;
 CODE:
        RETVAL = head->mapping_family;
 OUTPUT:
@@ -239,7 +274,7 @@ OUTPUT:
 
 int
 stream_count(head)
-       const OpusHead* head;
+       Audio::Opusfile::Head head;
 CODE:
        RETVAL = head->stream_count;
 OUTPUT:
@@ -247,7 +282,7 @@ OUTPUT:
 
 int
 coupled_count(head)
-       const OpusHead* head;
+       Audio::Opusfile::Head head;
 CODE:
        RETVAL = head->coupled_count;
 OUTPUT:
@@ -255,9 +290,11 @@ OUTPUT:
 
 int
 mapping(head, k)
-       const OpusHead* head;
-       int k;
+       Audio::Opusfile::Head head;
+       unsigned k;
 CODE:
+       if(k >= OPUS_CHANNEL_COUNT_MAX)
+               croak("k must be less than %d\n", (int)OPUS_CHANNEL_COUNT_MAX);
        RETVAL = (int) head->mapping[k];
 OUTPUT:
        RETVAL
This page took 0.034517 seconds and 4 git commands to generate.