namespace
{
- bool checkValid(const MP4::AtomList &list)
+ inline bool checkValid(const MP4::AtomList &list)
{
for(MP4::AtomList::ConstIterator it = list.begin(); it != list.end(); ++it) {
FilePrivate() :
tag(0),
atoms(0),
- properties(0) {}
+ properties(0),
+ hasMP4Tag(false) {}
~FilePrivate()
{
MP4::Tag *tag;
MP4::Atoms *atoms;
MP4::Properties *properties;
+
+ bool hasMP4Tag;
};
MP4::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle) :
}
// must have a moov atom, otherwise consider it invalid
- MP4::Atom *moov = d->atoms->find("moov");
- if(!moov) {
+ if(!d->atoms->find("moov")) {
setValid(false);
return;
}
+ if(d->atoms->find("moov", "udta", "meta", "ilst")) {
+ d->hasMP4Tag = true;
+ }
+
d->tag = new Tag(this, d->atoms);
if(readProperties) {
d->properties = new Properties(this, d->atoms);
return false;
}
- return d->tag->save();
+ const bool success = d->tag->save();
+ if(success) {
+ d->hasMP4Tag = true;
+ }
+
+ return success;
}
+bool
+MP4::File::hasMP4Tag() const
+{
+ return d->hasMP4Tag;
+}
CPPUNIT_ASSERT(!f.isValid());
MP4::File f2(TEST_FILE_PATH_C("has-tags.m4a"));
CPPUNIT_ASSERT(f2.isValid());
+ CPPUNIT_ASSERT(f2.hasMP4Tag());
+ MP4::File f3(TEST_FILE_PATH_C("no-tags.m4a"));
+ CPPUNIT_ASSERT(f3.isValid());
+ CPPUNIT_ASSERT(!f3.hasMP4Tag());
}
void testIsEmpty()