(11-05-2022, 12:12 AM)Tim Curtis Wrote:(11-04-2022, 10:58 PM)Nutul Wrote: @Gerardus , @Tim Curtis , @TheOldPresbyope
Ok, we're covered for ID3v2 tags also for DSD files.
Just positioning the ID3 tag reader at the beginning of the tag makes things work:
if the first 4 chars of the file are "DSD ", then read 8 bytes at offset 20 and assume the tag begins at that offset; otherwise assume the tag is at offset 0 (default behavior).
from here on the behavior of the Zend library is exactly the same.
Cheers, Al.
Are you referring to the reader in Zend?
Exactly.
and this is the dsd special case fix:
Code:
if ($this->_reader->read(4) != 'DSD ') {
$this->_reader->setOffset(0);
} else {
/*
The first chunk in a DSD file is the DSD Chunk:
0 4 bytes: "DSD "
4 8 bytes: size of the DSD chunk
12 8 bytes: total file size
20 8 bytes: pointer to metadata chunk
*/
$this->_reader->setOffset(20);
$DSD_ID3_TAG_OFFSET = $this->_reader->readInt64LE();
$this->_reader->setOffset($DSD_ID3_TAG_OFFSET);
}
$startOffset = $this->_reader->getOffset();
I'll prepare a PR tomorrow, sometime.