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


Audio-TagLib documentation Contained in the Audio-TagLib distribution.

Index


Code Index:

NAME

Top

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

SYNOPSIS

Top

  use Audio::TagLib::ID3v2::FrameFactory;

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

DESCRIPTION

Top

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

Top

Audio::TagLib

AUTHOR

Top

Dongxu Ma, <dongxu@cpan.org>

COPYRIGHT AND LICENSE

Top


Audio-TagLib documentation Contained in the Audio-TagLib distribution.

package Audio::TagLib::ID3v2::FrameFactory;

use 5.008003;
use strict;
use warnings;

our $VERSION = '1.41';

use Audio::TagLib;

# Preloaded methods go here.

1;
__END__
# Below is stub documentation for your module. You'd better edit it!