Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: No album-covers in DSF-files
#11
Be sure to account for the possibility that the value of the pointer can be zero (when there is no ID3v2 tag present).

Regards,
Kent
Reply
#12
(11-04-2022, 11:25 PM)TheOldPresbyope Wrote: Be sure to account for the possibility that the value of the pointer can be zero (when there is no ID3v2 tag present).

Regards,
Kent

In that case, the beginning of the tag will be assumed to be at offset 0, where there is no "ID3" string ("DSD " is there, instead), and the Zend library will fail as it does now, and produce no picture.
Actually, now it fails exactly because it always looks for "ID3" at offset 0, where it is (seems to be so) supposed to be for the .mp3s

Cheers, Al.
Reply
#13
(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?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#14
(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.
Reply
#15
Nice.

Regards,
Kent
Reply
#16
Whats the scope of the fix?

Does it just address the way cover art is embedded in this particular DSD file?

I don't want to modify Zend for edge cases.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#17
As long as it finds the ID3v2 tag, if any is present, then it should be good. The DSF spec allows only for metadata in an ID3v2 tag in a DSD chunk.

Regards,
Kent
Reply
#18
(11-05-2022, 02:04 AM)Tim Curtis Wrote: Whats the scope of the fix?

Does it just address the way cover art is embedded in this particular DSD file?

I don't want to modify Zend for edge cases.

The fix is exclusively for the ID3v" tag handling.
The fix DOES NOT assume the ID3 tag starts ALWAYS at ZERO_OFFSET (as Zend now does...) instead:

If the FILE_TYPE is DSD, it searches for the location of the tag (which is specified in the file's header) AND starts searching for it THERE.
If the FILE_TYPE is NOT DSD, then proceeds as it has always done, that is, starting to search for the tag at OFFSETY ZERO.

This may allow for further handling of different file types, as long as we know their formats, and therefore might be able to locate the ID3 tag accordingly.

Cheers, Al.
Reply
#19
Ok, that makes sense.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: