]> iEval git - audio-opusfile.git/blobdiff - Opusfile.xs
Use regular T_PTROBJ and typedefs instead of a complex typemap
[audio-opusfile.git] / Opusfile.xs
index c1f6353e51b25437fc90033f47c3103e5f55ef0b..7779aa979526305cb509b379cb3d29682ee96be4 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:
        int err;
-CODE:
-       RETVAL = op_open_file(path, &err);
+C_ARGS:
+       path, &err
+POSTCALL:
        if(err)
                croak("op_open_file returned error %d\n", err);
+
+Audio::Opusfile
+op_open_memory(const char *data, size_t length(data))
+PREINIT:
+       int err;
+C_ARGS:
+       data, XSauto_length_of_data, &err
+POSTCALL:
+       if(err)
+               croak("op_open_memory returned error %d\n", err);
+
+bool
+op_test(const char *data, size_t length(data))
+PROTOTYPE: $
+PREINIT:
+       int ret;
+CODE:
+       ret = op_test (NULL, data, XSauto_length_of_data);
+       if(ret < 0 && ret != OP_ENOTFORMAT && ret != OP_EBADHEADER)
+               croak("op_test returned error %d\n", RETVAL);
+       RETVAL = !ret;
 OUTPUT:
        RETVAL
 
+
 void
 DESTROY(of)
-       OggOpusFile *of;
+       Audio::Opusfile of;
 CODE:
        op_free(of);
 
-const OpusHead*
+bool
+op_seekable(of)
+       Audio::Opusfile of;
+
+int
+op_link_count(of)
+       Audio::Opusfile of;
+
+int
+op_serialno(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;
 
 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_
+
+Audio::Opusfile::PictureTag
+opus_picture_tag_parse(tag)
+       const char *tag;
+PREINIT:
+       OpusPictureTag *pic;
+       int err;
+CODE:
+       Newx(pic, 1, OpusPictureTag);
+       if(err = opus_picture_tag_parse(pic, tag))
+               croak("opus_picture_tag_parse returned error %d\n", err);
+       RETVAL = pic;
+OUTPUT:
+       RETVAL
+
+void
+DESTROY(pic)
+       Audio::Opusfile::PictureTag pic
+CODE:
+       Safefree(pic);
+
+int
+type(pic)
+       Audio::Opusfile::PictureTag pic;
+CODE:
+       RETVAL = pic->type;
+OUTPUT:
+       RETVAL
+
+const char*
+mime_type(pic)
+       Audio::Opusfile::PictureTag pic;
+CODE:
+       RETVAL = pic->mime_type;
+OUTPUT:
+       RETVAL
+
+const char*
+description(pic)
+       Audio::Opusfile::PictureTag pic;
+CODE:
+       RETVAL = pic->description;
+OUTPUT:
+       RETVAL
+
+int
+width(pic)
+       Audio::Opusfile::PictureTag pic;
+CODE:
+       RETVAL = pic->width;
+OUTPUT:
+       RETVAL
+
+int
+height(pic)
+       Audio::Opusfile::PictureTag pic;
+CODE:
+       RETVAL = pic->height;
+OUTPUT:
+       RETVAL
+
+int
+depth(pic)
+       Audio::Opusfile::PictureTag pic;
+CODE:
+       RETVAL = pic->depth;
+OUTPUT:
+       RETVAL
+
+int
+colors(pic)
+       Audio::Opusfile::PictureTag pic;
+CODE:
+       RETVAL = pic->colors;
+OUTPUT:
+       RETVAL
+
+int
+data_length(pic)
+       Audio::Opusfile::PictureTag pic;
+CODE:
+       RETVAL = pic->data_length;
+OUTPUT:
+       RETVAL
+
+SV*
+data(pic)
+       Audio::Opusfile::PictureTag pic;
+CODE:
+       RETVAL = newSVpvn(pic->data, pic->data_length);
+OUTPUT:
+       RETVAL
+
+int
+format(pic)
+       Audio::Opusfile::PictureTag pic;
+CODE:
+       RETVAL = pic->format;
+OUTPUT:
+       RETVAL
+
+MODULE = Audio::Opusfile               PACKAGE = Audio::Opusfile::Head
+
+int
+version(head)
+       Audio::Opusfile::Head head;
+CODE:
+       RETVAL = head->version;
+OUTPUT:
+       RETVAL
+
+int
+channel_count(head)
+       Audio::Opusfile::Head head;
+CODE:
+       RETVAL = head->channel_count;
+OUTPUT:
+       RETVAL
+
+unsigned
+pre_skip(head)
+       Audio::Opusfile::Head head;
+CODE:
+       RETVAL = head->pre_skip;
+OUTPUT:
+       RETVAL
+
+unsigned
+input_sample_rate(head)
+       Audio::Opusfile::Head head;
+CODE:
+       RETVAL = head->input_sample_rate;
+OUTPUT:
+       RETVAL
+
+int
+mapping_family(head)
+       Audio::Opusfile::Head head;
+CODE:
+       RETVAL = head->mapping_family;
+OUTPUT:
+       RETVAL
+
+int
+stream_count(head)
+       Audio::Opusfile::Head head;
+CODE:
+       RETVAL = head->stream_count;
+OUTPUT:
+       RETVAL
+
+int
+coupled_count(head)
+       Audio::Opusfile::Head head;
+CODE:
+       RETVAL = head->coupled_count;
+OUTPUT:
+       RETVAL
+
+int
+mapping(head, k)
+       Audio::Opusfile::Head head;
+       int k;
+CODE:
+       RETVAL = (int) head->mapping[k];
+OUTPUT:
+       RETVAL
This page took 0.029915 seconds and 4 git commands to generate.