Exemplo n.º 1
0
ByteVectorList
MP4::Tag::parseData(const MP4::Atom *atom, int expectedFlags, bool freeForm)
{
  AtomDataList data = parseData2(atom, expectedFlags, freeForm);
  ByteVectorList result;
  for(AtomDataList::ConstIterator it = data.begin(); it != data.end(); ++it) {
    result.append(it->data);
  }
  return result;
}
Exemplo n.º 2
0
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);
    }
  }
}