ID3 unsynchronization: how it works

谁说我不能喝 提交于 2019-12-13 05:36:08

问题


According the documentation, ID3 tags have an unsynchronization flag. As I understood, it should only be applied to ID3 frames (not headers or footer).

But how exactly should I process the frames before parsing (for reading, not writing)? Should I just replace all '11111111 111xxxxx' sequences for '11111111 00000000 111xxxxx'?


回答1:


No, that's what you do when WRITING the tag (and don't forget, in this case you also need to replace any "0xff,0x00" with "0xff,0x00,0x00", as stated in the spec).

When you are READING the tag, you can simply replace any "0xff,0x00" sequence with "0xff". It's easiest to do this at once while you're reading the file, by keeping track of the last byte read and discarding any single 0x00 byte which follows an 0xff.

It's not really so easy to figure this out because the spec only describes what to do in the way of unsynchronisation when you're writing the tag, not what you do when reading it.



来源:https://stackoverflow.com/questions/19671469/id3-unsynchronization-how-it-works

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!