Audio-Opusfile
view release on metacpan or search on metacpan
lib/Audio/Opusfile/PictureTag.pm view on Meta::CPAN
package Audio::Opusfile::PictureTag;
# Don't load this module directly, load Audio::Opusfile instead
use 5.014000;
use strict;
use warnings;
use subs qw/parse/;
our $VERSION = '1.000';
sub new { parse $_[1] }
1;
__END__
=encoding utf-8
=head1 NAME
Audio::Opusfile::PictureTag - A parsed METADATA_BLOCK_PICTURE tag
=head1 SYNOPSIS
use Audio::Opusfile;
my $of = Audio::Opusfile->new_from_file('file.opus');
my @pic_tags = $of->tags->query_all('METADATA_BLOCK_PICTURE');
my @pictures = map { Audio::Opusfile::PictureTag->parse($_) } @pic_tags;
my $pic = $pictures[0];
say $pic->type; # Prints "3", which means Cover (front)
say $pic->mime_type; # Prints "image/png"
say $pic->description;
say $pic->width;
say $pic->height;
say $pic->depth;
say $pic->colors;
say $pic->data_length; # The image size
my $data = $pic->data; # The contents of the image
say $pic->format; # One of the OP_PIC_* constants
=head1 DESCRIPTION
This module represents a METADATA_BLOCK_PICTURE tag. It has the
following methods (descriptions taken from the libopusfile
documentation):
=over
=item Audio::Opusfile::PictureTag->B<new>(I<$tag>)
Takes the contents of a METADATA_BLOCK_PICTURE tag (optionally
prefixed by the string C<METADATA_BLOCK_PICTURE=>) and returns a new
Audio::Opusfile::PictureTag object.
=item $pic->B<type>
The picture type according to the ID3v2 APIC frame
0. Other
1. 32x32 pixels 'file icon' (PNG only)
2. Other file icon
3. Cover (front)
4. Cover (back)
5. Leaflet page
6. Media (e.g. label side of CD)
7. Lead artist/lead performer/soloist
8. Artist/performer
9. Conductor
10. Band/Orchestra
11. Composer
12. Lyricist/text writer
13. Recording Location
14. During recording
15. During performance
16. Movie/video screen capture
17. A bright colored fish
18. Illustration
19. Band/artist logotype
20. Publisher/Studio logotype
Others are reserved and should not be used. There may only be one each
of picture type 1 and 2 in a file.
=item $pic->B<mime_type>
The MIME type of the picture, in printable ASCII characters 0x20-0x7E.
The MIME type may also be "-->" to signify that the data part is a URL
pointing to the picture instead of the picture data itself. In this
case, a terminating NUL is appended to the URL string in data, but
data_length is set to the length of the string excluding that
( run in 1.547 second using v1.01-cache-2.11-cpan-302cb4679cc )