1 /************************************************************************** 2 copyright : (C) 2010 by Lukáš Lalinský 3 email : [email protected] 4 **************************************************************************/ 5 6 /*************************************************************************** 7 * This library is free software; you can redistribute it and/or modify * 8 * it under the terms of the GNU Lesser General Public License version * 9 * 2.1 as published by the Free Software Foundation. * 10 * * 11 * This library is distributed in the hope that it will be useful, but * 12 * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 * Lesser General Public License for more details. * 15 * * 16 * You should have received a copy of the GNU Lesser General Public * 17 * License along with this library; if not, write to the Free Software * 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 * 02110-1301 USA * 20 * * 21 * Alternatively, this file is available under the Mozilla Public * 22 * License Version 1.1. You may obtain a copy of the License at * 23 * http://www.mozilla.org/MPL/ * 24 ***************************************************************************/ 25 26 #ifndef TAGLIB_FLACPICTURE_H 27 #define TAGLIB_FLACPICTURE_H 28 29 #include "tlist.h" 30 #include "tstring.h" 31 #include "tbytevector.h" 32 #include "taglib_export.h" 33 #include "flacmetadatablock.h" 34 35 namespace TagLib { 36 37 namespace FLAC { 38 39 class TAGLIB_EXPORT Picture : public MetadataBlock 40 { 41 public: 42 43 /*! 44 * This describes the function or content of the picture. 45 */ 46 enum Type { 47 //! A type not enumerated below 48 Other = 0x00, 49 //! 32x32 PNG image that should be used as the file icon 50 FileIcon = 0x01, 51 //! File icon of a different size or format 52 OtherFileIcon = 0x02, 53 //! Front cover image of the album 54 FrontCover = 0x03, 55 //! Back cover image of the album 56 BackCover = 0x04, 57 //! Inside leaflet page of the album 58 LeafletPage = 0x05, 59 //! Image from the album itself 60 Media = 0x06, 61 //! Picture of the lead artist or soloist 62 LeadArtist = 0x07, 63 //! Picture of the artist or performer 64 Artist = 0x08, 65 //! Picture of the conductor 66 Conductor = 0x09, 67 //! Picture of the band or orchestra 68 Band = 0x0A, 69 //! Picture of the composer 70 Composer = 0x0B, 71 //! Picture of the lyricist or text writer 72 Lyricist = 0x0C, 73 //! Picture of the recording location or studio 74 RecordingLocation = 0x0D, 75 //! Picture of the artists during recording 76 DuringRecording = 0x0E, 77 //! Picture of the artists during performance 78 DuringPerformance = 0x0F, 79 //! Picture from a movie or video related to the track 80 MovieScreenCapture = 0x10, 81 //! Picture of a large, coloured fish 82 ColouredFish = 0x11, 83 //! Illustration related to the track 84 Illustration = 0x12, 85 //! Logo of the band or performer 86 BandLogo = 0x13, 87 //! Logo of the publisher (record company) 88 PublisherLogo = 0x14 89 }; 90 91 Picture(); 92 Picture(const ByteVector &data); 93 ~Picture(); 94 95 /*! 96 * Returns the type of the image. 97 */ 98 Type type() const; 99 100 /*! 101 * Sets the type of the image. 102 */ 103 void setType(Type type); 104 105 /*! 106 * Returns the mime type of the image. This should in most cases be 107 * "image/png" or "image/jpeg". 108 */ 109 String mimeType() const; 110 111 /*! 112 * Sets the mime type of the image. This should in most cases be 113 * "image/png" or "image/jpeg". 114 */ 115 void setMimeType(const String &m); 116 117 /*! 118 * Returns a text description of the image. 119 */ 120 121 String description() const; 122 123 /*! 124 * Sets a textual description of the image to \a desc. 125 */ 126 127 void setDescription(const String &desc); 128 129 /*! 130 * Returns the width of the image. 131 */ 132 int width() const; 133 134 /*! 135 * Sets the width of the image. 136 */ 137 void setWidth(int w); 138 139 /*! 140 * Returns the height of the image. 141 */ 142 int height() const; 143 144 /*! 145 * Sets the height of the image. 146 */ 147 void setHeight(int h); 148 149 /*! 150 * Returns the color depth (in bits-per-pixel) of the image. 151 */ 152 int colorDepth() const; 153 154 /*! 155 * Sets the color depth (in bits-per-pixel) of the image. 156 */ 157 void setColorDepth(int depth); 158 159 /*! 160 * Returns the number of colors used on the image.. 161 */ 162 int numColors() const; 163 164 /*! 165 * Sets the number of colors used on the image (for indexed images). 166 */ 167 void setNumColors(int numColors); 168 169 /*! 170 * Returns the image data. 171 */ 172 ByteVector data() const; 173 174 /*! 175 * Sets the image data. 176 */ 177 void setData(const ByteVector &data); 178 179 /*! 180 * Returns the FLAC metadata block type. 181 */ 182 int code() const; 183 184 /*! 185 * Render the content to the FLAC picture block format. 186 */ 187 ByteVector render() const; 188 189 /*! 190 * Parse the picture data in the FLAC picture block format. 191 */ 192 bool parse(const ByteVector &rawData); 193 194 private: 195 Picture(const Picture &item); 196 Picture &operator=(const Picture &item); 197 198 class PicturePrivate; 199 PicturePrivate *d; 200 }; 201 202 typedef List<Picture> PictureList; 203 204 } 205 206 } 207 208 #endif 209