void MP4::Tag::parseFreeForm(const MP4::Atom *atom) { AtomDataList data = parseData2(atom, -1, true); if(data.size() > 2) { String name = "----:" + String(data[0].data, String::UTF8) + ':' + String(data[1].data, String::UTF8); AtomDataType type = data[2].type; for(uint i = 2; i < data.size(); i++) { if(data[i].type != type) { debug("MP4: We currently don't support values with multiple types"); break; } } if(type == TypeUTF8) { StringList value; for(uint i = 2; i < data.size(); i++) { value.append(String(data[i].data, String::UTF8)); } Item item(value); item.setAtomDataType(type); addItem(name, item); } else { ByteVectorList value; for(uint i = 2; i < data.size(); i++) { value.append(data[i].data); } Item item(value); item.setAtomDataType(type); addItem(name, item); } } }
ByteVectorList MP4::Tag::parseData(const MP4::Atom *atom, int expectedFlags, bool freeForm) { AtomDataList data = parseData2(atom, expectedFlags, freeForm); ByteVectorList result; for(uint i = 0; i < data.size(); i++) { result.append(data[i].data); } return result; }
void MP4::Tag::parseFreeForm(const MP4::Atom *atom) { AtomDataList data = parseData2(atom, -1, true); if(data.size() > 2) { AtomDataList::ConstIterator itBegin = data.begin(); String name = "----:"; name += String((itBegin++)->data, String::UTF8); // data[0].data name += ':'; name += String((itBegin++)->data, String::UTF8); // data[1].data AtomDataType type = itBegin->type; // data[2].type for(AtomDataList::ConstIterator it = itBegin; it != data.end(); ++it) { if(it->type != type) { debug("MP4: We currently don't support values with multiple types"); break; } } if(type == TypeUTF8) { StringList value; for(AtomDataList::ConstIterator it = itBegin; it != data.end(); ++it) { value.append(String(it->data, String::UTF8)); } Item item(value); item.setAtomDataType(type); addItem(name, item); } else { ByteVectorList value; for(AtomDataList::ConstIterator it = itBegin; it != data.end(); ++it) { value.append(it->data); } Item item(value); item.setAtomDataType(type); addItem(name, item); } } }