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