Added TagLib (with AUTORS and COPYING files)
[someplayer] / src / taglib / ogg / flac / oggflacfile.h
1 /***************************************************************************
2     copyright            : (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
19  *   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_OGGFLACFILE_H
27 #define TAGLIB_OGGFLACFILE_H
28
29 #include "taglib_export.h"
30 #include "oggfile.h"
31 #include "xiphcomment.h"
32
33 #include "flacproperties.h"
34
35 namespace TagLib {
36
37   class Tag;
38
39   namespace Ogg {
40
41   //! An implementation of Ogg FLAC metadata
42
43   /*!
44    * This is implementation of FLAC metadata for Ogg FLAC files.  For "pure"
45    * FLAC files look under the FLAC hiearchy.
46    *
47    * Unlike "pure" FLAC-files, Ogg FLAC only supports Xiph-comments,
48    * while the audio-properties are the same.
49    */
50   namespace FLAC {
51
52     using TagLib::FLAC::Properties;
53
54     //! An implementation of TagLib::File with Ogg/FLAC specific methods
55
56     /*!
57      * This implements and provides an interface for Ogg/FLAC files to the
58      * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
59      * the abstract TagLib::File API as well as providing some additional
60      * information specific to Ogg FLAC files.
61      */
62
63     class TAGLIB_EXPORT File : public Ogg::File
64     {
65     public:
66       /*!
67        * Contructs an Ogg/FLAC file from \a file.  If \a readProperties is true
68        * the file's audio properties will also be read using \a propertiesStyle.
69        * If false, \a propertiesStyle is ignored.
70        */
71       File(FileName file, bool readProperties = true,
72            Properties::ReadStyle propertiesStyle = Properties::Average);
73
74       /*!
75        * Destroys this instance of the File.
76        */
77       virtual ~File();
78
79       /*!
80        * Returns the Tag for this file.  This will always be a XiphComment.
81        */
82       virtual XiphComment *tag() const;
83
84       /*!
85        * Returns the FLAC::Properties for this file.  If no audio properties
86        * were read then this will return a null pointer.
87        */
88       virtual Properties *audioProperties() const;
89
90       /*!
91        * Save the file.  This will primarily save and update the XiphComment.
92        * Returns true if the save is successful.
93        */
94       virtual bool save();
95
96       /*!
97        * Returns the length of the audio-stream, used by FLAC::Properties for
98        * calculating the bitrate.
99        */
100       long streamLength();
101
102     private:
103       File(const File &);
104       File &operator=(const File &);
105
106       void read(bool readProperties, Properties::ReadStyle propertiesStyle);
107       void scan();
108       ByteVector streamInfoData();
109       ByteVector xiphCommentData();
110
111       class FilePrivate;
112       FilePrivate *d;
113     };
114   } // namespace FLAC
115   } // namespace Ogg
116 } // namespace TagLib
117
118 #endif