Esempio n. 1
0
attachment_t &
attachment_t::parse(KaxAttached &att) {
  size_t k;
  for (k = 0; att.ListSize() > k; ++k) {
    EbmlElement *e = att[k];

    if (EbmlId(*e) == EBML_ID(KaxFileName))
      name = UTFstring_to_cstrutf8(UTFstring(*static_cast<KaxFileName *>(e)));

    else if (EbmlId(*e) == EBML_ID(KaxMimeType))
      type = std::string(*static_cast<KaxMimeType *>(e));

    else if (EbmlId(*e) == EBML_ID(KaxFileUID))
      id = uint32(*static_cast<KaxFileUID *>(e));

    else if (EbmlId(*e) == EBML_ID(KaxFileData)) {
      fdata = (KaxFileData *)e;
      size  = fdata->GetSize();
    }
  }

  valid = (-1 != id) && (-1 != size) && !type.empty();

  return *this;
}
Esempio n. 2
0
attachment_t &
attachment_t::parse(KaxAttached &att) {
    size_t k;
    for (k = 0; att.ListSize() > k; ++k) {
        EbmlElement *e = att[k];

        if (Is<KaxFileName>(e))
            name = static_cast<KaxFileName *>(e)->GetValueUTF8();

        else if (Is<KaxMimeType>(e))
            type = static_cast<KaxMimeType *>(e)->GetValue();

        else if (Is<KaxFileUID>(e))
            id = static_cast<KaxFileUID *>(e)->GetValue();

        else if (Is<KaxFileData>(e)) {
            fdata = static_cast<KaxFileData *>(e);
            size  = fdata->GetSize();
        }
    }

    valid = (std::numeric_limits<uint64_t>::max() != size) && !type.empty();

    return *this;
}