1 package Audio
::Opusfile
;
8 use parent qw
/Exporter/;
12 qw
/OPUS_CHANNEL_COUNT_MAX
31 OP_GET_SERVER_INFO_REQUEST
34 OP_HTTP_PROXY_HOST_REQUEST
35 OP_HTTP_PROXY_PASS_REQUEST
36 OP_HTTP_PROXY_PORT_REQUEST
37 OP_HTTP_PROXY_USER_REQUEST
43 OP_SSL_SKIP_CERTIFICATE_CHECK_REQUEST
46 our @EXPORT_OK = @constants;
47 our @EXPORT = @constants;
49 our $VERSION = '0.003';
52 # This AUTOLOAD is used to 'autoload' constants from the constant()
57 ($constname = $AUTOLOAD) =~ s/.*:://;
58 croak
"&Audio::Opusfile::constant not defined" if $constname eq 'constant';
59 my ($error, $val) = constant
($constname);
60 if ($error) { croak
$error; }
63 # Fixed between 5.005_53 and 5.005_61
64 #XXX if ($] >= 5.00561) {
65 #XXX *$AUTOLOAD = sub () { $val };
68 *$AUTOLOAD = sub { $val };
75 XSLoader
::load
('Audio::Opusfile', $VERSION);
76 require Audio
::Opusfile
::Head
;
77 require Audio
::Opusfile
::Tags
;
78 require Audio
::Opusfile
::PictureTag
;
80 # Preloaded methods go here.
83 my ($class, $file) = @_;
88 my ($class, $buf) = @_;
99 Audio::Opusfile - Very incomplete interface to the libopusfile Ogg Opus library
104 my $of = Audio::Opusfile->new_from_file('silence.opus');
105 my $tags = $of->tags;
106 say $tags->query('TITLE'); # Cellule
110 Opus is a totally open, royalty-free, highly versatile audio codec.
111 Opus is unmatched for interactive speech and music transmission over
112 the Internet, but is also intended for storage and streaming
113 applications. It is standardized by the Internet Engineering Task
114 Force (IETF) as RFC 6716 which incorporated technology from Skype's
115 SILK codec and Xiph.Org's CELT codec.
117 libopusfile is a library for decoding and basic manipulation of Ogg
120 Audio::Opusfile is an interface to libopusfile. At the moment its only
121 function is reading metadata and tags from an Ogg Opus file or buffer.
122 Future versions will give access to a larger part of the libopusfile
125 Expect the API to change in future versions.
131 =item Audio::Opusfile->B<new_from_file>(I<$file>)
133 Creates a new Audio::Opusfile object from an Ogg Opus file.
135 Dies if the given file does not exist or is not a valid Ogg Opus file.
137 =item Audio::Opusfile->B<new_from_memory>(I<$buffer>)
139 Creates a new Audio::Opusfile object from a buffer containing Ogg Opus
142 Dies if the given buffer does not contain valid data.
144 =item Audio::Opusfile::test(I<$buffer>)
146 Returns true if the given buffer looks like the beginning of a valid
147 Ogg Opus file, false otherwise.
149 Dies if the given buffer does not have sufficient data to tell if it
150 is an Opus stream or if it looks like a Opus stream but parsing it
155 Returns an L<Audio::Opusfile::Head> object corresponding to the file.
159 Returns an L<Audio::Opusfile::Tags> object corresponding to the file.
161 =item B<$of>->seekable
163 Returns whether or not the data source being read is seekable.
165 =item B<$of>->link_count
167 Returns the number of links in this chained stream. Always returns 1
168 for unseekable sources.
170 =item B<$of>->serialno([I<$link_index>])
172 Get the serial number of the given link in a (possibly-chained) Ogg
173 Opus stream. If the given index is greater than the total number of
174 links, this returns the serial number of the last link.
176 If the source is not seekable, I<$link_index> is negative, or
177 I<$link_index> is not given, then this function returns the serial
178 number of the current link.
184 All constants are exported by default:
186 OPUS_CHANNEL_COUNT_MAX
205 OP_GET_SERVER_INFO_REQUEST
208 OP_HTTP_PROXY_HOST_REQUEST
209 OP_HTTP_PROXY_PASS_REQUEST
210 OP_HTTP_PROXY_PORT_REQUEST
211 OP_HTTP_PROXY_USER_REQUEST
215 OP_PIC_FORMAT_UNKNOWN
217 OP_SSL_SKIP_CERTIFICATE_CHECK_REQUEST
223 L<Audio::Opusfile::Head>,
224 L<Audio::Opusfile::Tags>,
225 L<http://opus-codec.org/>,
226 L<http://opus-codec.org/docs/opusfile_api-0.7/index.html>
230 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
232 =head1 COPYRIGHT AND LICENSE
234 Copyright (C) 2016 by Marius Gavrilescu
236 This library is free software; you can redistribute it and/or modify
237 it under the same terms as Perl itself, either Perl version 5.24.0 or,
238 at your option, any later version of Perl 5 you may have available.