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