1 /***************************************************************************
2 copyright : (C) 2006 by Lukáš Lalinský
3 email : lalinsky@gmail.com
5 copyright : (C) 2004 by Allan Sandfeld Jensen
6 email : kde@carewolf.org
7 (original MPC implementation)
8 ***************************************************************************/
10 /***************************************************************************
11 * This library is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU Lesser General Public License version *
13 * 2.1 as published by the Free Software Foundation. *
15 * This library is distributed in the hope that it will be useful, but *
16 * WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
18 * Lesser General Public License for more details. *
20 * You should have received a copy of the GNU Lesser General Public *
21 * License along with this library; if not, write to the Free Software *
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
24 ***************************************************************************/
26 #ifndef TAGLIB_TTAFILE_H
27 #define TAGLIB_TTAFILE_H
29 #include "../tfile_helper.h"
31 #include "ttaproperties.h"
37 namespace ID3v2
{ class Tag
; class FrameFactory
; }
38 namespace ID3v1
{ class Tag
; }
40 //! An implementation of TTA metadata
43 * This is implementation of TTA metadata.
45 * This supports ID3v1 and ID3v2 tags as well as reading stream
46 * properties from the file.
51 //! An implementation of TagLib::File with TTA specific methods
54 * This implements and provides an interface for TTA files to the
55 * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
56 * the abstract TagLib::File API as well as providing some additional
57 * information specific to TTA files.
60 class File
: public TagLib::File
64 * This set of flags is used for various operations and is suitable for
65 * being OR-ed together.
68 //! Empty set. Matches no tag types.
70 //! Matches ID3v1 tags.
72 //! Matches ID3v2 tags.
74 //! Matches all tag types.
79 * Contructs an MPC file from \a file. If \a readProperties is true the
80 * file's audio properties will also be read using \a propertiesStyle. If
81 * false, \a propertiesStyle is ignored.
83 explicit File(TagLibFileName file
, bool readProperties
= true,
84 Properties::ReadStyle propertiesStyle
= Properties::Average
);
87 * Contructs an MPC file from \a file. If \a readProperties is true the
88 * file's audio properties will also be read using \a propertiesStyle. If
89 * false, \a propertiesStyle is ignored. The frames will be created using
92 File(TagLibFileName file
, ID3v2::FrameFactory
*frameFactory
,
93 bool readProperties
= true,
94 Properties::ReadStyle propertiesStyle
= Properties::Average
);
97 * Destroys this instance of the File.
102 * Returns the Tag for this file. This will be an APE tag, an ID3v1 tag
103 * or a combination of the two.
105 virtual TagLib::Tag
*tag() const;
108 * Returns the MPC::Properties for this file. If no audio properties
109 * were read then this will return a null pointer.
111 virtual Properties
*audioProperties() const;
114 * Set the ID3v2::FrameFactory to something other than the default.
116 * \see ID3v2FrameFactory
118 void setID3v2FrameFactory(const ID3v2::FrameFactory
*factory
);
126 * Returns a pointer to the ID3v2 tag of the file.
128 * If \a create is false (the default) this will return a null pointer
129 * if there is no valid ID3v2 tag. If \a create is true it will create
130 * an ID3v1 tag if one does not exist. If there is already an APE tag, the
131 * new ID3v1 tag will be placed after it.
133 * \note The Tag <b>is still</b> owned by the TTA::File and should not be
134 * deleted by the user. It will be deleted when the file (object) is
137 ID3v1::Tag
*ID3v1Tag(bool create
= false);
140 * Returns a pointer to the ID3v1 tag of the file.
142 * If \a create is false (the default) this will return a null pointer
143 * if there is no valid ID3v1 tag. If \a create is true it will create
144 * an ID3v1 tag if one does not exist. If there is already an APE tag, the
145 * new ID3v1 tag will be placed after it.
147 * \note The Tag <b>is still</b> owned by the TTA::File and should not be
148 * deleted by the user. It will be deleted when the file (object) is
151 ID3v2::Tag
*ID3v2Tag(bool create
= false);
154 * This will remove the tags that match the OR-ed together TagTypes from the
155 * file. By default it removes all tags.
157 * \note This will also invalidate pointers to the tags
158 * as their memory will be freed.
159 * \note In order to make the removal permanent save() still needs to be called
161 void remove(int tags
= AllTags
);
165 File
&operator=(const File
&);
167 void read(bool readProperties
, Properties::ReadStyle propertiesStyle
);