[libav-bugs] [Bug 395] New: Wrong value of AVStream.attached_pic.size while reading mp3 file

bugzilla-daemon at aruru.libav.org bugzilla-daemon at aruru.libav.org
Fri Nov 16 17:37:43 CET 2012


           Summary: Wrong value of AVStream.attached_pic.size while
                    reading mp3 file
           Product: Libav
           Version: git HEAD
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: Normal
         Component: libavformat
        AssignedTo: bugzilla at libav.org
        ReportedBy: tomasz.ulinski at gmail.com


Here is my code extracting attached images from a mp3 file:

static void extractAllImages(AVFormatContext* ctx, struct ID3* result) {
    unsigned int i;
    for (i = 0; i < ctx->nb_streams; i++) {
        AVStream* st = ctx->streams[i];

        if (st->disposition & AV_DISPOSITION_ATTACHED_PIC) {

            AVPacket& packet = st->attached_pic; // image

            std::string typeStr = getTagByName(st->metadata, "comment");
            std::string formatStr = getImageFormat(st->codec->codec_id);

            result->images.push_back(Image(typeStr, formatStr,
reinterpret_cast<char*>(packet.data), sizeof(*packet.data) * packet.size));

The input file I use contains single image ("Cover (front)") of size 79345.
However inside my code the value of packet.size is 78983.
This causes output image is corrupted.

The following methods extract the image correctly (size=79345):
1. EasyTAG app
2. $ eyeD3 --write-images=<OUTDIR> 

Could you help?

Best Regards,

Configure bugmail: https://bugzilla.libav.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.

More information about the libav-bugs mailing list