Very long time of parsing of tags (mp3, mp4, ...)

Vladimir Skuzovatkin skzvlad at gmail.com
Sat Mar 5 13:00:35 CET 2011


Hi!

Please forget about this problem ("Very long time of parsing of tags").
After some changes I can not reproduce it.
Sorry for the trouble.


I have another question about the attached image.
I found that the file size does not decrease after removal of the picture.
For example,
    mp3 file without picture have size: 2 078 346 bytes,
    size of jpg file to attach: 314 225 bytes,
    size of this mp3 file after attaching the picture: 2 390 164 bytes,
    and size of this mp3 file after deleting of all attached pictures: 2 390
164 bytes.

Why file size does not decrease after removal of the picture?

For example, I use the next code to delete all pictures from mp3 file:

        TagLib::MPEG::File* pFile = ...;
        ...
        TagLib::ID3v2::Tag* pID3v2Tag = pFile->ID3v2Tag();
        if (pID3v2Tag)
        {
            TagLib::ID3v2::FrameList frameList=
pID3v2Tag->frameList("APIC");
            {
                if (!frameList.isEmpty())
                {
                    std::list<TagLib::ID3v2::Frame*>::const_iterator it =
frameList.begin();
                    while (it != frameList.end())
                    {
                        std::list<TagLib::ID3v2::Frame*>::const_iterator
nextIt = it;
                        nextIt++;
                        pID3v2Tag->removeFrame(*it, true);
                        it = nextIt;
                    }
                }
            }
        }
        ....
        pFile->save();

After performing of this code all pictures are detached, but size of file is
not decreased.
Probably, I did not correctly use the library?



2011/3/5 Scott Wheeler <wheeler at kde.org>

> On Mar 5, 2011, at 8:53 AM, Vladimir Skuzovatkin wrote:
>
> > 1) Small (~10Kb) PNG image was written into media file. Time of
> > opening file (after writing of image) is equal to ~4 milliseconds.
> > 2) Small PNG image was deleted from media file and big (~400Kb) PNG
> > image was written into media file. Time of opening file is equal to
> > ~30 seconds.
>
> It could be that there's > 10k of padding available, but not > 400k,
> so it has to rewrite the file, which, while it shouldn't take 30
> seconds on average, it could on a large file.
>
> -Scott
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel
>



-- 
Thanks,
Vladimir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20110305/03d8264b/attachment.htm 


More information about the taglib-devel mailing list