void testMiscellaneous(int fileFormat) { std::string testFileName; ASSERT_TRUE(createTemporaryFile("Miscellaneous", &testFileName)); writeMiscellaneous(fileFormat, testFileName); readMiscellaneous(testFileName); ASSERT_EQ(0, ::unlink(testFileName.c_str())); }
status IFFFile::update() { uint32_t length; writeVHDR(); writeMiscellaneous(); writeBODY(); /* Get the length of the file. */ length = m_fh->length(); length -= 8; /* Set the length of the FORM chunk. */ m_fh->seek(4, File::SeekFromBeginning); writeU32(&length); return AF_SUCCEED; }
status IFFFile::writeInit(AFfilesetup setup) { if (initFromSetup(setup) == AF_FAIL) return AF_FAIL; uint32_t fileSize = 0; m_fh->write("FORM", 4); writeU32(&fileSize); m_fh->write("8SVX", 4); writeVHDR(); writeMiscellaneous(); writeBODY(); return AF_SUCCEED; }
status WAVEFile::writeInit(AFfilesetup setup) { uint32_t zero = 0; if (_af_filesetup_make_handle(setup, this) == AF_FAIL) return AF_FAIL; fh->seek(0, File::SeekFromBeginning); fh->write("RIFF", 4); fh->write(&zero, 4); fh->write("WAVE", 4); writeMiscellaneous(); writeCues(); writeFormat(); writeFrameCount(); writeData(); return AF_SUCCEED; }
status WAVEFile::update() { Track *track = getTrack(); if (track->fpos_first_frame != 0) { uint32_t dataLength, fileLength; /* Update the frame count chunk if present. */ writeFrameCount(); /* Update the length of the data chunk. */ fh->seek(dataSizeOffset, File::SeekFromBeginning); /* We call _af_format_frame_size to calculate the frame size of normal PCM data or compressed data. */ dataLength = (uint32_t) track->data_size; writeU32(&dataLength); /* Update the length of the RIFF chunk. */ fileLength = (uint32_t) fh->length(); fileLength -= 8; fh->seek(4, File::SeekFromBeginning); writeU32(&fileLength); } /* Write the actual data that was set after initializing the miscellaneous IDs. The size of the data will be unchanged. */ writeMiscellaneous(); /* Write the new positions; the size of the data will be unchanged. */ writeCues(); return AF_SUCCEED; }