示例#1
0
void ASF::File::FilePrivate::HeaderExtensionObject::parse(ASF::File *file, unsigned int /*size*/)
{
  file->d->headerExtensionObject = this;
  file->seek(18, File::Current);
  long long dataSize = readDWORD(file);
  long long dataPos = 0;
  while(dataPos < dataSize) {
    ByteVector guid = file->readBlock(16);
    if(guid.size() != 16) {
      file->setValid(false);
      break;
    }
    bool ok;
    long long size = readQWORD(file, &ok);
    if(!ok) {
      file->setValid(false);
      break;
    }
    BaseObject *obj;
    if(guid == metadataGuid) {
      obj = new MetadataObject();
    }
    else if(guid == metadataLibraryGuid) {
      obj = new MetadataLibraryObject();
    }
    else {
      obj = new UnknownObject(guid);
    }
    obj->parse(file, (unsigned int)size);
    objects.append(obj);
    dataPos += size;
  }
}
示例#2
0
void
ASF::File::HeaderExtensionObject::parse(ASF::File *file, uint /*size*/)
{
  file->d->headerExtensionObject = this;
  file->seek(18, File::Current);
  long long dataSize = file->readDWORD();
  long long dataPos = 0;
  while(dataPos < dataSize) {
    ByteVector guid = file->readBlock(16);
    long long size = file->readQWORD();
    BaseObject *obj;
    if(guid == metadataGuid) {
      obj = new MetadataObject();
    }
    else if(guid == metadataLibraryGuid) {
      obj = new MetadataLibraryObject();
    }
    else {
      obj = new UnknownObject(guid);
    }
    obj->parse(file, size);
    objects.append(obj);
    dataPos += size;
  }
}
示例#3
0
void ASF::File::read(bool /*readProperties*/, Properties::ReadStyle /*propertiesStyle*/)
{
  if(!isValid())
    return;

  ByteVector guid = readBlock(16);
  if(guid != headerGuid) {
    debug("ASF: Not an ASF file.");
    return;
  }

  d->tag = new ASF::Tag();
  d->properties = new ASF::Properties();

  d->size = readQWORD();
  int numObjects = readDWORD();
  seek(2, Current);

  for(int i = 0; i < numObjects; i++) {
    ByteVector guid = readBlock(16);
    long size = (long)readQWORD();
    BaseObject *obj;
    if(guid == filePropertiesGuid) {
      obj = new FilePropertiesObject();
    }
    else if(guid == streamPropertiesGuid) {
      obj = new StreamPropertiesObject();
    }
    else if(guid == contentDescriptionGuid) {
      obj = new ContentDescriptionObject();
    }
    else if(guid == extendedContentDescriptionGuid) {
      obj = new ExtendedContentDescriptionObject();
    }
    else if(guid == headerExtensionGuid) {
      obj = new HeaderExtensionObject();
    }
    else {
      obj = new UnknownObject(guid);
    }
    obj->parse(this, size);
    d->objects.append(obj);
  }
}