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 ***************************************************************************/
38 using namespace TagLib;
40 class MP4::File::FilePrivate
43 FilePrivate() : tag(0), atoms(0), properties(0)
65 MP4::Properties *properties;
68 MP4::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle audioPropertiesStyle)
72 read(readProperties, audioPropertiesStyle);
81 MP4::File::tag() const
87 MP4::File::audioProperties() const
93 MP4::File::checkValid(const MP4::AtomList &list)
95 for(uint i = 0; i < list.size(); i++) {
96 if(list[i]->length == 0)
98 if(!checkValid(list[i]->children))
105 MP4::File::read(bool readProperties, Properties::ReadStyle audioPropertiesStyle)
110 d->atoms = new Atoms(this);
111 if (!checkValid(d->atoms->atoms)) {
116 // must have a moov atom, otherwise consider it invalid
117 MP4::Atom *moov = d->atoms->find("moov");
123 d->tag = new Tag(this, d->atoms);
125 d->properties = new Properties(this, d->atoms, audioPropertiesStyle);
135 return d->tag->save();