I can remember whether I have submitted this patch before but I've had it knocking around for while.
The patch is against 0.15.1b in debian/sid.
It works for me and I would like to get it included in libid3tag as the current version will silently fail to write updated tags that are not the same size as the original.
I've made rather crude use of malloc to handle moving the audio data to accommodate the new tag. If you'd rather I can rewrite it to use iteration and a fixed size buffer.
It also relies on ftruncate for the case when a tag shrinks which i'm guessing will require a windows alternative.
cheers, sam
Sam, first: good work! This is much needed.
On Sat, 30 Oct 2004, Sam Clegg wrote:
It works for me and I would like to get it included in libid3tag as the current version will silently fail to write updated tags that are not the same size as the original.
Don't you mean taht it will fail of the updated tags are larger than the original?
I found a way to work around it by adding some unused padding zeroes to the tag. (This is mentioned in the ID3v2 spec.) As long as the modified tag do not exceed the padding buffer, everything works OK.
Will the patch also handle adding tags to files that do not have any tag at all?
Will it also handle adding ID3v1 tags if such do not exist?
Linus Walleij
On Sat, Oct 30, 2004 at 04:24:57PM +0200, Linus Walleij wrote:
Sam, first: good work! This is much needed.
On Sat, 30 Oct 2004, Sam Clegg wrote:
It works for me and I would like to get it included in libid3tag as the current version will silently fail to write updated tags that are not the same size as the original.
Don't you mean taht it will fail of the updated tags are larger than the original?
No, the current code also fails if they are smaller, although in practice I have never seen libi3dtag shrink a tag.
I found a way to work around it by adding some unused padding zeroes to the tag. (This is mentioned in the ID3v2 spec.) As long as the modified tag do not exceed the padding buffer, everything works OK.
Yes but we need to handle the case when the tag grows. Think embedded JPEG images.
Will the patch also handle adding tags to files that do not have any tag at all?
I think this would require API changes. This patch doesn't do that but I would like to see the file interface handle adding and removing v2 and v2 tags.
Will it also handle adding ID3v1 tags if such do not exist?
IIRC think you cas do this already.