flacfile.h
Go to the documentation of this file.
1 /***************************************************************************
2  copyright : (C) 2003 by Allan Sandfeld Jensen
3  email : kde@carewolf.org
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_FLACFILE_H
27 #define TAGLIB_FLACFILE_H
28 
29 #include "taglib_export.h"
30 #include "tfile.h"
31 #include "tlist.h"
32 #include "tag.h"
33 
34 #include "flacpicture.h"
35 #include "flacproperties.h"
36 
37 namespace TagLib {
38 
39  class Tag;
40  namespace ID3v2 { class FrameFactory; class Tag; }
41  namespace ID3v1 { class Tag; }
42  namespace Ogg { class XiphComment; }
43 
45 
55  namespace FLAC {
56 
58 
67  {
68  public:
77  File(FileName file, bool readProperties = true,
78  Properties::ReadStyle propertiesStyle = Properties::Average);
79 
88  // BIC: merge with the above constructor
89  File(FileName file, ID3v2::FrameFactory *frameFactory,
90  bool readProperties = true,
91  Properties::ReadStyle propertiesStyle = Properties::Average);
92 
104  // BIC: merge with the above constructor
105  File(IOStream *stream, ID3v2::FrameFactory *frameFactory,
106  bool readProperties = true,
107  Properties::ReadStyle propertiesStyle = Properties::Average);
108 
112  virtual ~File();
113 
122  virtual TagLib::Tag *tag() const;
123 
130  PropertyMap properties() const;
131 
132  void removeUnsupportedProperties(const StringList &);
133 
139  PropertyMap setProperties(const PropertyMap &);
140 
145  virtual Properties *audioProperties() const;
146 
154  virtual bool save();
155 
167  ID3v2::Tag *ID3v2Tag(bool create = false);
168 
180  ID3v1::Tag *ID3v1Tag(bool create = false);
181 
193  Ogg::XiphComment *xiphComment(bool create = false);
194 
202  void setID3v2FrameFactory(const ID3v2::FrameFactory *factory);
203 
210  ByteVector streamInfoData(); // BIC: remove
211 
218  long streamLength(); // BIC: remove
219 
223  List<Picture *> pictureList();
224 
229  void removePicture(Picture *picture, bool del = true);
230 
234  void removePictures();
235 
242  void addPicture(Picture *picture);
243 
244  private:
245  File(const File &);
246  File &operator=(const File &);
247 
248  void read(bool readProperties, Properties::ReadStyle propertiesStyle);
249  void scan();
250  long findID3v2();
251  long findID3v1();
252  ByteVector xiphCommentData() const;
253  long findPaddingBreak(long nextPageOffset, long targetOffset, bool *isLast);
254 
255  class FilePrivate;
256  FilePrivate *d;
257  };
258  }
259 }
260 
261 #endif