1 /**************************************************************************
2 copyright : (C) 2007 by Lukáš Lalinský
3 email : lalinsky@gmail.com
4 **************************************************************************/
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. *
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. *
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 *
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 ***************************************************************************/
36 using namespace TagLib;
38 class MP4::File::FilePrivate
41 FilePrivate() : tag(0), atoms(0), properties(0)
63 MP4::Properties *properties;
66 MP4::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle audioPropertiesStyle)
70 read(readProperties, audioPropertiesStyle);
79 MP4::File::tag() const
85 MP4::File::audioProperties() const
91 MP4::File::checkValid(const MP4::AtomList &list)
93 for(uint i = 0; i < list.size(); i++) {
94 if(list[i]->length == 0)
96 if(!checkValid(list[i]->children))
103 MP4::File::read(bool readProperties, Properties::ReadStyle audioPropertiesStyle)
108 d->atoms = new Atoms(this);
109 if (!checkValid(d->atoms->atoms)) {
114 // must have a moov atom, otherwise consider it invalid
115 MP4::Atom *moov = d->atoms->find("moov");
121 d->tag = new Tag(this, d->atoms);
123 d->properties = new Properties(this, d->atoms, audioPropertiesStyle);
133 return d->tag->save();