1package Ogg::Vorbis;
2
3use strict;
4use Carp;
5
6use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $AUTOLOAD);
7
8require Exporter;
9require DynaLoader;
10require AutoLoader;
11
12BEGIN {
13  $VERSION = '0.04';
14  @ISA = qw(Exporter DynaLoader);
15  # We don't EXPORT anything by default
16  @EXPORT = ();
17  @EXPORT_OK = qw(
18    clear
19    open
20    streams
21    seekable
22    bitrate
23    bitrate_instant
24    serialnumber
25    raw_total
26    pcm_total
27    time_total
28    raw_seek
29    pcm_seek
30    pcm_seek_page
31    time_seek
32    time_seek_page
33    raw_tell
34    pcm_tell
35    time_tell
36    info
37    comment
38    read
39  );
40  %EXPORT_TAGS = (all => \@EXPORT_OK);
41}
42
43sub AUTOLOAD {
44    # This AUTOLOAD is used to 'autoload' constants from the constant()
45    # XS function.  If a constant is not found then control is passed
46    # to the AUTOLOAD in AutoLoader.
47
48    my $constname;
49    ($constname = $AUTOLOAD) =~ s/.*:://;
50    croak "& not defined" if $constname eq 'constant';
51    my $val = constant($constname, @_ ? $_[0] : 0);
52    if ($! != 0) {
53	if ($! =~ /Invalid/) {
54	    $AutoLoader::AUTOLOAD = $AUTOLOAD;
55	    goto &AutoLoader::AUTOLOAD;
56	}
57	else {
58		croak "Your vendor has not defined Ogg::Vorbis macro $constname";
59	}
60    }
61    no strict 'refs';
62    *$AUTOLOAD = sub () { $val };
63    goto &$AUTOLOAD;
64}
65
66bootstrap Ogg::Vorbis $VERSION;
67
681;
69__END__
70
71
72=head1 NAME
73
74Ogg::Vorbis - Perl extension for Ogg Vorbis streams
75
76=head1 SYNOPSIS
77
78  use Ogg::Vorbis;
79  $ogg = Ogg::Vorbis->new;
80  open(INPUT, "< file.ogg");
81  open(OUTPUT, "> file.pcm");
82  $ogg->open(INPUT);
83  $info = $ogg->info;
84  %comments = %{$ogg->comment};
85  $buffer = '-' x 4096;
86  while ($bytes = $ogg->read($buffer,4096,0,2,1,$current_bitstream) > 0) {
87    syswrite(OUTPUT, $buffer, $bytes);
88  }
89  $ogg->clear;
90  close(OUTPUT);
91  close(INPUT);
92
93=head1 DESCRIPTION
94
95This is an object-oriented interface to the Ogg Vorbis libvorbisfile
96convenience library.  To create a vorbisfile object, call
97Ogg::Vorbis->new.  You can then open it on input streams with the
98open() method, read data from it with read() method, and clean up with
99clear().  Other methods for obtaining information are available as in
100libvorbisfile.
101
102The info() method returns an Ogg::Vorbis::Info object.  You can access
103the various fields of the vorbis_info struct with methods of the same
104name.
105
106The comment() method returns a hash of comment name => value entries.
107
108Currently libvorbisfile does not support writing or encoding, so you
109cannot change comment values or encode a new file, but the
110functionality to do so will be added soon.
111
112=head1 AUTHOR
113
114Alex Shinn, foof@debian.org
115
116=head1 SEE ALSO
117
118Ao(3pm), ogg123(1), oggenc(1), perl(1).
119
120=cut
121
122