1 /***************************************************************************
2 copyright : (C) 2002 - 2008 by Scott Wheeler
3 email : wheeler@kde.org
4 ***************************************************************************/
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. *
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. *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
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 ***************************************************************************/
26 #ifndef TAGLIB_ATTACHEDPICTUREFRAME_H
27 #define TAGLIB_ATTACHEDPICTUREFRAME_H
29 #include <id3v2frame.h>
30 #include <id3v2header.h>
31 #include "taglib_export.h"
37 //! An ID3v2 attached picture frame implementation
40 * This is an implementation of ID3v2 attached pictures. Pictures may be
41 * included in tags, one per APIC frame (but there may be multiple APIC
42 * frames in a single tag). These pictures are usually in either JPEG or
46 class TAGLIB_EXPORT AttachedPictureFrame : public Frame
48 friend class FrameFactory;
53 * This describes the function or content of the picture.
56 //! A type not enumerated below
58 //! 32x32 PNG image that should be used as the file icon
60 //! File icon of a different size or format
62 //! Front cover image of the album
64 //! Back cover image of the album
66 //! Inside leaflet page of the album
68 //! Image from the album itself
70 //! Picture of the lead artist or soloist
72 //! Picture of the artist or performer
74 //! Picture of the conductor
76 //! Picture of the band or orchestra
78 //! Picture of the composer
80 //! Picture of the lyricist or text writer
82 //! Picture of the recording location or studio
83 RecordingLocation = 0x0D,
84 //! Picture of the artists during recording
85 DuringRecording = 0x0E,
86 //! Picture of the artists during performance
87 DuringPerformance = 0x0F,
88 //! Picture from a movie or video related to the track
89 MovieScreenCapture = 0x10,
90 //! Picture of a large, coloured fish
92 //! Illustration related to the track
94 //! Logo of the band or performer
96 //! Logo of the publisher (record company)
101 * Constructs an empty picture frame. The description, content and text
102 * encoding should be set manually.
104 AttachedPictureFrame();
107 * Constructs an AttachedPicture frame based on \a data.
109 explicit AttachedPictureFrame(const ByteVector &data);
112 * Destroys the AttahcedPictureFrame instance.
114 virtual ~AttachedPictureFrame();
117 * Returns a string containing the description and mime-type
119 virtual String toString() const;
122 * Returns the text encoding used for the description.
124 * \see setTextEncoding()
127 String::Type textEncoding() const;
130 * Set the text encoding used for the description.
134 void setTextEncoding(String::Type t);
137 * Returns the mime type of the image. This should in most cases be
138 * "image/png" or "image/jpeg".
140 String mimeType() const;
143 * Sets the mime type of the image. This should in most cases be
144 * "image/png" or "image/jpeg".
146 void setMimeType(const String &m);
149 * Returns the type of the image.
157 * Sets the type for the image.
162 void setType(Type t);
165 * Returns a text description of the image.
167 * \see setDescription()
168 * \see textEncoding()
169 * \see setTextEncoding()
172 String description() const;
175 * Sets a textual description of the image to \a desc.
178 * \see textEncoding()
179 * \see setTextEncoding()
182 void setDescription(const String &desc);
185 * Returns the image data as a ByteVector.
187 * \note ByteVector has a data() method that returns a const char * which
188 * should make it easy to export this data to external programs.
193 ByteVector picture() const;
196 * Sets the image data to \a p. \a p should be of the type specified in
197 * this frame's mime-type specification.
203 void setPicture(const ByteVector &p);
206 virtual void parseFields(const ByteVector &data);
207 virtual ByteVector renderFields() const;
210 AttachedPictureFrame(const ByteVector &data, Header *h);
211 AttachedPictureFrame(const AttachedPictureFrame &);
212 AttachedPictureFrame &operator=(const AttachedPictureFrame &);
214 class AttachedPictureFramePrivate;
215 AttachedPictureFramePrivate *d;