The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Audio::TagLib::ID3v2::FrameFactory - A factory for creating ID3v2 frames

SYNOPSIS

  use Audio::TagLib::ID3v2::FrameFactory;
  
  my $i = Audio::TagLib::ID3v2::FrameFactory->instance();
  $i->setDefaultTextEncoding("UTF8");
  print $i->defaultTextEncoding(), "\n"; # got "UTF8"

DESCRIPTION

This factory abstracts away the frame creation process and instantiates the appropriate ID3v2::Frame subclasses based on the contents of the data.

Reimplementing this factory is the key to adding support for frame types not directly supported by Audio::TagLib to your application. To do so you would subclass this factory reimplement createFrame(). Then by setting your factory to be the default factory in ID3v2::Tag constructor or with MPEG::File::setID3v2FrameFactory() you can implement behavior that will allow for new ID3v2::Frame subclasses (also provided by you) to be used.

This implements both abstract factory and singleton patterns of which more information is available on the web and in software design textbooks (Notably Design Patterns).

FrameFactory instance() [static]

Returns an instance of FrameFactory.

Frame createFrame(Bytevector $data, BOOL $synchSafeInts)

Create a frame based on $data. $synchSafeInts should only be set false if we are parsing an old tag (v2.3 or older) that does not support synchsafe ints.

Please use the method below that accepts an ID3 version number in new code.

Frame createFrame(ByteVector $data, UV $version = 4)

Create a frame based on $data. $version should indicate the ID3v2 version of the tag. As ID3v2.4 is the most current version of the standard 4 is the default.

PV defaultTextEncoding()

Returns the default text encoding for text frames. If setTextEncoding() has not been explicitly called this will only be used for new text frames. However, if this value has been set explicitly all frames will be converted to this type (unless it's explitly set differently for the individual frame) when being rendered.

see setDefaultTextEncoding()

void setDefaultTextEncoding(PV $encoding)

Set the default text encoding for all text frames that are created to $encoding. If no value is set the frames with either default to the encoding type that was parsed and new frames default to Latin1.

EXPORT

None by default.

SEE ALSO

Audio::TagLib

AUTHOR

Dongxu Ma, <dongxu@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2005 by Dongxu Ma

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.