FLAC Slow Header

Andrew Gatt a.gatt at btinternet.com
Wed Sep 10 16:28:58 CEST 2008

>> Hi,
>> I'm using taglib 1.5 to set the tags up on some files. ID3s seem to work 
>> fine, however FLAC headers seems very slow (around 5 seconds) to 
>> complete. The below code snippet is inside a loop to re tag all the 
>> tracks in an album, as i've mentioned this functions fine for mp3 files, 
>> but FLAC files are very slow and seems to be happening in the save function.
>>                TagLib::FileRef tag_file(track_path.c_str());
>>                if(!tag_file.isNull() && tag_file.tag()) {
>>                        tag_file.tag()->setAlbum(album_info.at(0));
>>                        tag_file.tag()->setGenre(album_info.at(1));
>> tag_file.tag()->setYear(atoi(album_info.at(2).c_str()));
>>                        tag_file.save();
>>                }
>> Anyone got any ideas on what i might be doing wrong or if there is a 
>> work around?
>> Thanks
>> Andrew

> After a bit more digging i found this bug filed 
> http://bugs.kde.org/show_bug.cgi?id=107659
> which seems to describe the problem exactly. In there is a patch which 
> says its fixes this problem (if padding is available straight away, 
> otherwise on subsequent writes). I've looked at the source file of 
> flacfile.cpp in taglib1.5 and it doesn't seem to include the changes. 
> Can anyone tell me if this patch is applied or if it was rejected for 
> some reason?
> Thanks
> Andrew

OK after convincing myself that the above mentioned patch wasn't added i 
decided to get it into shape against v1.5 of the flacfile.cpp. All 
credit still goes to Toby Dickenson, all i did was change the variable 
names to ones used in 1.5 and it worked as advertised, after initially 
creating the padding tag writing is *much* faster. As i use taglib to 
initially create the headers on the FLAC files this should work very well.

Attached are the two file diffs required. Could anyone else verify that 
the patch works on their FLAC files and does not create any problems? If 
we can prove this works reliably it is a good feature to have in the 


P.S. Sorry about the previous top posting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flacfile.cpp.diff
Type: text/x-diff
Size: 3209 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/taglib-devel/attachments/20080910/9df6b33c/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flacfile.h.diff
Type: text/x-diff
Size: 358 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/taglib-devel/attachments/20080910/9df6b33c/attachment-0001.bin 

More information about the taglib-devel mailing list