609e614c99756db05c1c1cc5e4523018c842c35d
1 package Audio
::Opusfile
::PictureTag
;
2 # Don't load this module directly, load Audio::Opusfile instead
9 sub new
{ parse
$_[1] }
18 Audio::Opusfile::PictureTag - A parsed METADATA_BLOCK_PICTURE tag
23 my $of = Audio::Opusfile->new_from_file('file.opus');
24 my @pic_tags = $of->tags->query_all('METADATA_BLOCK_PICTURE');
25 my @pictures = map { Audio::Opusfile::PictureTag->parse($_) } @pic_tags;
26 my $pic = $pictures[0];
27 say $pic->type; # Prints "3", which means Cover (front)
28 say $pic->mime_type; # Prints "image/png"
29 say $pic->description;
34 say $pic->data_length; # The image size
35 my $data = $pic->data; # The contents of the image
36 say $pic->format; # One of the OP_PIC_* constants
40 This module represents a METADATA_BLOCK_PICTURE tag. It has the
41 following methods (descriptions taken from the libopusfile
46 =item Audio::Opusfile::PictureTag->B<new>(I<$tag>)
48 Takes the contents of a METADATA_BLOCK_PICTURE tag (optionally
49 prefixed by the string C<METADATA_BLOCK_PICTURE=>) and returns a new
50 Audio::Opusfile::PictureTag object.
54 The picture type according to the ID3v2 APIC frame
57 1. 32x32 pixels 'file icon' (PNG only)
62 6. Media (e.g. label side of CD)
63 7. Lead artist/lead performer/soloist
68 12. Lyricist/text writer
69 13. Recording Location
71 15. During performance
72 16. Movie/video screen capture
73 17. A bright colored fish
75 19. Band/artist logotype
76 20. Publisher/Studio logotype
78 Others are reserved and should not be used. There may only be one each
79 of picture type 1 and 2 in a file.
81 =item $pic->B<mime_type>
83 The MIME type of the picture, in printable ASCII characters 0x20-0x7E.
85 The MIME type may also be "-->" to signify that the data part is a URL
86 pointing to the picture instead of the picture data itself. In this
87 case, a terminating NUL is appended to the URL string in data, but
88 data_length is set to the length of the string excluding that
91 =item $pic->B<description>
93 The description of the picture, in UTF-8.
97 The width of the picture in pixels.
101 The height of the picture in pixels.
105 The color depth of the picture in bits-per-pixel (not
108 =item $pic->B<colors>
110 For indexed-color pictures (e.g., GIF), the number of colors used, or
111 0 for non-indexed pictures.
113 =item $pic->B<data_length>
115 The length of the picture data in bytes. Equivalent to C<< length ($pic->data) >>.
119 The binary picture data.
121 =item $pic->B<format>
123 The format of the picture data, if known. One of:
124 OP_PIC_FORMAT_UNKNOWN, OP_PIC_FORMAT_URL, OP_PIC_FORMAT_JPEG,
125 OP_PIC_FORMAT_PNG, or OP_PIC_FORMAT_GIF.
132 L<http://opus-codec.org/>,
133 L<http://opus-codec.org/docs/opusfile_api-0.7/index.html>,
134 L<https://www.opus-codec.org/docs/opusfile_api-0.7/structOpusPictureTag.html>
138 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
140 =head1 COPYRIGHT AND LICENSE
142 Copyright (C) 2016 by Marius Gavrilescu
144 This library is free software; you can redistribute it and/or modify
145 it under the same terms as Perl itself, either Perl version 5.24.0 or,
146 at your option, any later version of Perl 5 you may have available.
This page took 0.028894 seconds and 3 git commands to generate.