xref: /MusicPlayer2/MusicPlayer2/taglib/asffile.h (revision 2661106a96494c0a7dfab38bf1ae7b9565882443)
1 /**************************************************************************
2     copyright            : (C) 2005-2007 by Lukáš Lalinský
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_ASFFILE_H
27 #define TAGLIB_ASFFILE_H
28 
29 #include "tag.h"
30 #include "tfile.h"
31 #include "taglib_export.h"
32 #include "asfproperties.h"
33 #include "asftag.h"
34 
35 namespace TagLib {
36 
37   //! An implementation of ASF (WMA) metadata
38   namespace ASF {
39 
40     /*!
41      * This implements and provides an interface for ASF files to the
42      * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
43      * the abstract TagLib::File API as well as providing some additional
44      * information specific to ASF files.
45      */
46     class TAGLIB_EXPORT File : public TagLib::File
47     {
48     public:
49 
50       /*!
51        * Constructs an ASF file from \a file.
52        *
53        * \note In the current implementation, both \a readProperties and
54        * \a propertiesStyle are ignored.  The audio properties are always
55        * read.
56        */
57       File(FileName file, bool readProperties = true,
58            Properties::ReadStyle propertiesStyle = Properties::Average);
59 
60       /*!
61        * Constructs an ASF file from \a stream.
62        *
63        * \note In the current implementation, both \a readProperties and
64        * \a propertiesStyle are ignored.  The audio properties are always
65        * read.
66        *
67        * \note TagLib will *not* take ownership of the stream, the caller is
68        * responsible for deleting it after the File object.
69        */
70       File(IOStream *stream, bool readProperties = true,
71            Properties::ReadStyle propertiesStyle = Properties::Average);
72 
73       /*!
74        * Destroys this instance of the File.
75        */
76       virtual ~File();
77 
78       /*!
79        * Returns a pointer to the ASF tag of the file.
80        *
81        * ASF::Tag implements the tag interface, so this serves as the
82        * reimplementation of TagLib::File::tag().
83        *
84        * \note The Tag <b>is still</b> owned by the ASF::File and should not be
85        * deleted by the user.  It will be deleted when the file (object) is
86        * destroyed.
87        */
88       virtual Tag *tag() const;
89 
90       /*!
91        * Implements the unified property interface -- export function.
92        */
93       PropertyMap properties() const;
94 
95       /*!
96        * Removes unsupported properties. Forwards to the actual Tag's
97        * removeUnsupportedProperties() function.
98        */
99       void removeUnsupportedProperties(const StringList &properties);
100 
101       /*!
102        * Implements the unified property interface -- import function.
103        */
104       PropertyMap setProperties(const PropertyMap &);
105 
106       /*!
107        * Returns the ASF audio properties for this file.
108        */
109       virtual Properties *audioProperties() const;
110 
111       /*!
112        * Save the file.
113        *
114        * This returns true if the save was successful.
115        */
116       virtual bool save();
117 
118       /*!
119        * Returns whether or not the given \a stream can be opened as an ASF
120        * file.
121        *
122        * \note This method is designed to do a quick check.  The result may
123        * not necessarily be correct.
124        */
125       static bool isSupported(IOStream *stream);
126 
127     private:
128       void read();
129 
130       class FilePrivate;
131       FilePrivate *d;
132     };
133 
134   }
135 
136 }
137 
138 #endif
139