]>
iEval git - audio-opusfile.git/blob - lib/Audio/Opusfile/PictureTag.pm
1 package Audio
::Opusfile
::PictureTag
;
2 # Don't load this module directly, load Audio::Opusfile instead
9 our $VERSION = '0.005001';
11 sub new
{ parse
$_[1] }
20 Audio::Opusfile::PictureTag - A parsed METADATA_BLOCK_PICTURE tag
25 my $of = Audio::Opusfile->new_from_file('file.opus');
26 my @pic_tags = $of->tags->query_all('METADATA_BLOCK_PICTURE');
27 my @pictures = map { Audio::Opusfile::PictureTag->parse($_) } @pic_tags;
28 my $pic = $pictures[0];
29 say $pic->type; # Prints "3", which means Cover (front)
30 say $pic->mime_type; # Prints "image/png"
31 say $pic->description;
36 say $pic->data_length; # The image size
37 my $data = $pic->data; # The contents of the image
38 say $pic->format; # One of the OP_PIC_* constants
42 This module represents a METADATA_BLOCK_PICTURE tag. It has the
43 following methods (descriptions taken from the libopusfile
48 =item Audio::Opusfile::PictureTag->B<new>(I<$tag>)
50 Takes the contents of a METADATA_BLOCK_PICTURE tag (optionally
51 prefixed by the string C<METADATA_BLOCK_PICTURE=>) and returns a new
52 Audio::Opusfile::PictureTag object.
56 The picture type according to the ID3v2 APIC frame
59 1. 32x32 pixels 'file icon' (PNG only)
64 6. Media (e.g. label side of CD)
65 7. Lead artist/lead performer/soloist
70 12. Lyricist/text writer
71 13. Recording Location
73 15. During performance
74 16. Movie/video screen capture
75 17. A bright colored fish
77 19. Band/artist logotype
78 20. Publisher/Studio logotype
80 Others are reserved and should not be used. There may only be one each
81 of picture type 1 and 2 in a file.
83 =item $pic->B<mime_type>
85 The MIME type of the picture, in printable ASCII characters 0x20-0x7E.
87 The MIME type may also be "-->" to signify that the data part is a URL
88 pointing to the picture instead of the picture data itself. In this
89 case, a terminating NUL is appended to the URL string in data, but
90 data_length is set to the length of the string excluding that
93 =item $pic->B<description>
95 The description of the picture, in UTF-8.
99 The width of the picture in pixels.
101 =item $pic->B<height>
103 The height of the picture in pixels.
107 The color depth of the picture in bits-per-pixel (not
110 =item $pic->B<colors>
112 For indexed-color pictures (e.g., GIF), the number of colors used, or
113 0 for non-indexed pictures.
115 =item $pic->B<data_length>
117 The length of the picture data in bytes. Equivalent to C<< length ($pic->data) >>.
121 The binary picture data.
123 =item $pic->B<format>
125 The format of the picture data, if known. One of:
126 OP_PIC_FORMAT_UNKNOWN, OP_PIC_FORMAT_URL, OP_PIC_FORMAT_JPEG,
127 OP_PIC_FORMAT_PNG, or OP_PIC_FORMAT_GIF.
134 L<http://opus-codec.org/>,
135 L<http://opus-codec.org/docs/opusfile_api-0.7/index.html>,
136 L<https://www.opus-codec.org/docs/opusfile_api-0.7/structOpusPictureTag.html>
140 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
142 =head1 COPYRIGHT AND LICENSE
144 Copyright (C) 2016-2017 by Marius Gavrilescu
146 This library is free software; you can redistribute it and/or modify
147 it under the same terms as Perl itself, either Perl version 5.24.0 or,
148 at your option, any later version of Perl 5 you may have available.
This page took 0.050535 seconds and 4 git commands to generate.