POE::Component::Enc::Ogg - POE component to wrap Ogg Vorbis encoder oggenc
use POE qw(Component::Enc::Ogg); $encoder1 = POE::Component::Enc::Ogg->new(); $encoder1->enc(input => "/tmp/track03.wav"); $encoder2 = POE::Component::Enc::Ogg->new( parent => 'MainSession', priority => 10, quality => 6, status => 'oggStatus', error => 'oggError', warning => 'oggWarning', done => 'oggDone', album => 'Flood', genre => 'Alternative' ); $encoder2->enc( artist => 'They Might be Giants', title => 'Birdhouse in your Soul', input => "/tmp/track02.wav", output => "/tmp/02.ogg", tracknumber => 'Track 2', date => '1990', comment => ['origin=CD', 'loudness=medium'] ); POE::Kernel->run();
POE is a multitasking framework for Perl. Ogg Vorbis is an open standard for compressed audio and oggenc is an encoder for this standard. This module wraps oggenc into the POE framework, simplifying its use in, for example, a CD music ripper and encoder application.
This POE component encodes wav and flac audio files into Ogg Vorbis format. It's merely a wrapper for the oggenc program. For flac files, the flac(1) program is also required.
The module provides an object oriented interface as follows.
Used to create an encoder instance. The following parameters are available. All of these are optional.
This is the delta priority for the encoder relative to the caller, default is 0. A positive value lowers the encoder's priority. See POE::Wheel:Run(3pm) and nice(1).
0
Names the session to which events are posted. By default this is main.
main
Sets the encoding quality to the given value, between -1 (low) and 10 (high). If unspecified, the default quality level is 3. Fractional quality levels such as 2.5 are permitted.
3
These parameters specify the events that are posted to the main session. By default the events are status, error, warning and done respectively.
status
error
warning
done
These parameters are used to pass information to the encoder.
Encodes the given file, naming the result with a .ogg extension. The only mandatory parameter is the name of the file to encode.
.ogg
The input file to be encoded. This must be a .wav file or a .flac file.
The output file to encode to. This will be a .ogg file. This parameter is optional, and if unspecied the output file name will be formed by replacing the extension of the input file name with .ogg.
A true value for this parameter indicates that the original input file should be deleted after encoding.
These parameters are used to pass information to the encoder. They all all optional.
For the comment parameter, the encoder expects tag-value pairs separated with an equals sign ('tag=value'). Multiple pairs can be specified because this parameter is a list. Note that this parameter must always be passed as a list even if it has only one element. This parameter is optional.
'tag=value'
You can use this parameter as a generic way to specify all the specific parameters listed above (i.e. album, genre, tracknumber, title, artist & date), and you can name your own tags. For example, the following two statements are equivalent.
$encoder2->enc( input => "/tmp/track02.wav"), artist => 'They Might be Giants', title => 'Birdhouse in your Soul', comment => ['source=CD'], # my non-'standard' tag ); $encoder2->enc( input => "/tmp/track02.wav"), comment => [ 'artist=They Might be Giants', 'title=Birdhouse in your Soul', 'source=CD', # my non-'standard' tag ], );
Events are passed to the session specified to the new() method to indicate progress, completion, warnings and errors. These events are described below, with their default names; alternative names may be specified when calling new().
new()
The first argument (ARG0) passed with these events is always the instance of the encoder as returned by new(). ARG1 and ARG2 are always the input and output file names respectively.
ARG0
Sent during encoding to indicate progress. ARG3 is the percentage of completion so far, and ARG4 is the estimated number of seconds remaining to completion.
Sent when the encoder emits a warning. ARG3 is the warning message.
Sent in the event of an error from the encoder. ARG3 is the error code from the encoder and ARG4 is the error message if provided, otherwise ''.
This event is sent upon completion of encoding.
Vorbis Tools oggenc(1), POE::Component::Enc::Flac, POE::Component::Enc::Mp3, POE::Component::CD::Detect, POE::Component::CD::Rip.
http://www.ambrosia.plus.com/perl/modules/POE-Component-Enc-Ogg/
Steve James <steATcpanDOTorg>
This module was inspired by Erick Calder's POE::Component::Enc::Mp3
$Date: 2004/05/31 08:10:55 $
$Revision: 1.5 $
Copyright (c) 2004 Steve James
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install POE::Component::Enc::Ogg, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Component::Enc::Ogg
CPAN shell
perl -MCPAN -e shell install POE::Component::Enc::Ogg
For more information on module installation, please visit the detailed CPAN module installation guide.