xref: /MusicPlayer2/MusicPlayer2/taglib/aifffile.h (revision 2661106a96494c0a7dfab38bf1ae7b9565882443)
1 /***************************************************************************
2     copyright            : (C) 2008 by Scott Wheeler
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_AIFFFILE_H
27 #define TAGLIB_AIFFFILE_H
28 
29 #include "rifffile.h"
30 #include "id3v2tag.h"
31 #include "aiffproperties.h"
32 
33 namespace TagLib {
34 
35   namespace RIFF {
36 
37     //! An implementation of AIFF metadata
38 
39     /*!
40      * This is implementation of AIFF metadata.
41      *
42      * This supports an ID3v2 tag as well as reading stream from the ID3 RIFF
43      * chunk as well as properties from the file.
44      */
45 
46     namespace AIFF {
47 
48       //! An implementation of TagLib::File with AIFF specific methods
49 
50       /*!
51        * This implements and provides an interface for AIFF files to the
52        * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
53        * the abstract TagLib::File API as well as providing some additional
54        * information specific to AIFF files.
55        */
56 
57       class TAGLIB_EXPORT File : public TagLib::RIFF::File
58       {
59       public:
60         /*!
61          * Constructs an AIFF file from \a file.  If \a readProperties is true the
62          * file's audio properties will also be read.
63          *
64          * \note In the current implementation, \a propertiesStyle is ignored.
65          */
66         File(FileName file, bool readProperties = true,
67              Properties::ReadStyle propertiesStyle = Properties::Average);
68 
69         /*!
70          * Constructs an AIFF file from \a stream.  If \a readProperties is true the
71          * file's audio properties will also be read.
72          *
73          * \note TagLib will *not* take ownership of the stream, the caller is
74          * responsible for deleting it after the File object.
75          *
76          * \note In the current implementation, \a propertiesStyle is ignored.
77          */
78         File(IOStream *stream, bool readProperties = true,
79              Properties::ReadStyle propertiesStyle = Properties::Average);
80 
81         /*!
82          * Destroys this instance of the File.
83          */
84         virtual ~File();
85 
86         /*!
87          * Returns the Tag for this file.
88          *
89          * \note This always returns a valid pointer regardless of whether or not
90          * the file on disk has an ID3v2 tag.  Use hasID3v2Tag() to check if the file
91          * on disk actually has an ID3v2 tag.
92          *
93          * \see hasID3v2Tag()
94          */
95         virtual ID3v2::Tag *tag() const;
96 
97         /*!
98          * Implements the unified property interface -- export function.
99          * This method forwards to ID3v2::Tag::properties().
100          */
101         PropertyMap properties() const;
102 
103         void removeUnsupportedProperties(const StringList &properties);
104 
105         /*!
106          * Implements the unified property interface -- import function.
107          * This method forwards to ID3v2::Tag::setProperties().
108          */
109         PropertyMap setProperties(const PropertyMap &);
110 
111         /*!
112          * Returns the AIFF::Properties for this file.  If no audio properties
113          * were read then this will return a null pointer.
114          */
115         virtual Properties *audioProperties() const;
116 
117         /*!
118          * Saves the file.
119          */
120         virtual bool save();
121 
122         /*!
123          * Save using a specific ID3v2 version (e.g. v3)
124          */
125         bool save(ID3v2::Version version);
126 
127         /*!
128          * Returns whether or not the file on disk actually has an ID3v2 tag.
129          *
130          * \see ID3v2Tag()
131          */
132         bool hasID3v2Tag() const;
133 
134         /*!
135          * Check if the given \a stream can be opened as an AIFF file.
136          *
137          * \note This method is designed to do a quick check.  The result may
138          * not necessarily be correct.
139          */
140         static bool isSupported(IOStream *stream);
141 
142       private:
143         File(const File &);
144         File &operator=(const File &);
145 
146         void read(bool readProperties);
147 
148         friend class Properties;
149 
150         class FilePrivate;
151         FilePrivate *d;
152       };
153     }
154   }
155 }
156 
157 #endif
158