Bump version and update Changes
[audio-opusfile.git] / Opusfile.xs
1 #define PERL_NO_GET_CONTEXT
2 #include "EXTERN.h"
3 #include "perl.h"
4 #include "XSUB.h"
5
6 #include "ppport.h"
7
8 /* op_free is both Perl_op_free and a function in opusfile */
9 #undef op_free
10 #include <opus/opusfile.h>
11
12 #include "const-c.inc"
13
14 MODULE = Audio::Opusfile PACKAGE = Audio::Opusfile PREFIX = op_
15
16 PROTOTYPES: ENABLE
17 INCLUDE: const-xs.inc
18
19 OggOpusFile*
20 op_open_file(path)
21 const char *path;
22 PREINIT:
23 int err;
24 CODE:
25 RETVAL = op_open_file(path, &err);
26 if(err)
27 croak("op_open_file returned error %d\n", err);
28 OUTPUT:
29 RETVAL
30
31 void
32 DESTROY(of)
33 OggOpusFile *of;
34 CODE:
35 op_free(of);
36
37 const OpusHead*
38 op_head(of, li = -1)
39 OggOpusFile *of;
40 int li;
41
42 const OpusTags*
43 op_tags(of, li = -1)
44 OggOpusFile *of;
45 int li;
46
47 MODULE = Audio::Opusfile PACKAGE = Audio::Opusfile::Tags PREFIX = opus_tags_
48
49 int
50 opus_tags_query_count(tags, tag)
51 const OpusTags* tags;
52 const char* tag;
53
54 const char*
55 opus_tags_query(tags, tag, count = 0)
56 const OpusTags* tags;
57 const char* tag;
58 int count;
59
60 MODULE = Audio::Opusfile PACKAGE = Audio::Opusfile::PictureTag PREFIX = opus_picture_tag_
61
62 const OpusPictureTag*
63 opus_picture_tag_parse(tag)
64 const char *tag;
65 PREINIT:
66 OpusPictureTag *pic;
67 int err;
68 CODE:
69 Newx(pic, 1, OpusPictureTag);
70 if(err = opus_picture_tag_parse(pic, tag))
71 croak("opus_picture_tag_parse returned error %d\n", err);
72 RETVAL = pic;
73 OUTPUT:
74 RETVAL
75
76 void
77 DESTROY(pic)
78 const OpusPictureTag* pic
79 CODE:
80 Safefree(pic);
81
82 int
83 type(pic)
84 const OpusPictureTag *pic;
85 CODE:
86 RETVAL = pic->type;
87 OUTPUT:
88 RETVAL
89
90 const char*
91 mime_type(pic)
92 const OpusPictureTag *pic;
93 CODE:
94 RETVAL = pic->mime_type;
95 OUTPUT:
96 RETVAL
97
98 const char*
99 description(pic)
100 const OpusPictureTag *pic;
101 CODE:
102 RETVAL = pic->description;
103 OUTPUT:
104 RETVAL
105
106 int
107 width(pic)
108 const OpusPictureTag *pic;
109 CODE:
110 RETVAL = pic->width;
111 OUTPUT:
112 RETVAL
113
114 int
115 height(pic)
116 const OpusPictureTag *pic;
117 CODE:
118 RETVAL = pic->height;
119 OUTPUT:
120 RETVAL
121
122 int
123 depth(pic)
124 const OpusPictureTag *pic;
125 CODE:
126 RETVAL = pic->depth;
127 OUTPUT:
128 RETVAL
129
130 int
131 colors(pic)
132 const OpusPictureTag *pic;
133 CODE:
134 RETVAL = pic->colors;
135 OUTPUT:
136 RETVAL
137
138 int
139 data_length(pic)
140 const OpusPictureTag *pic;
141 CODE:
142 RETVAL = pic->data_length;
143 OUTPUT:
144 RETVAL
145
146 SV*
147 data(pic)
148 const OpusPictureTag *pic;
149 CODE:
150 RETVAL = newSVpvn(pic->data, pic->data_length);
151 OUTPUT:
152 RETVAL
153
154 int
155 format(pic)
156 const OpusPictureTag *pic;
157 CODE:
158 RETVAL = pic->format;
159 OUTPUT:
160 RETVAL
161
162 MODULE = Audio::Opusfile PACKAGE = Audio::Opusfile::Head
163
164 int
165 version(head)
166 const OpusHead* head;
167 CODE:
168 RETVAL = head->version;
169 OUTPUT:
170 RETVAL
171
172 int
173 channel_count(head)
174 const OpusHead* head;
175 CODE:
176 RETVAL = head->channel_count;
177 OUTPUT:
178 RETVAL
179
180 unsigned
181 pre_skip(head)
182 const OpusHead* head;
183 CODE:
184 RETVAL = head->pre_skip;
185 OUTPUT:
186 RETVAL
187
188 unsigned
189 input_sample_rate(head)
190 const OpusHead* head;
191 CODE:
192 RETVAL = head->input_sample_rate;
193 OUTPUT:
194 RETVAL
195
196 int
197 mapping_family(head)
198 const OpusHead* head;
199 CODE:
200 RETVAL = head->mapping_family;
201 OUTPUT:
202 RETVAL
203
204 int
205 stream_count(head)
206 const OpusHead* head;
207 CODE:
208 RETVAL = head->stream_count;
209 OUTPUT:
210 RETVAL
211
212 int
213 coupled_count(head)
214 const OpusHead* head;
215 CODE:
216 RETVAL = head->coupled_count;
217 OUTPUT:
218 RETVAL
219
220 int
221 mapping(head, k)
222 const OpusHead* head;
223 int k;
224 CODE:
225 RETVAL = (int) head->mapping[k];
226 OUTPUT:
227 RETVAL
This page took 0.02884 seconds and 4 git commands to generate.