[flac-dev] FLAC__metadata_get_picture always return false

Pierre Boué pierre at videoactivity.com
Fri Apr 15 16:19:17 UTC 2016

I am using a libFLAC8.dylib that I have compiled with the original Makefile of flac 1.3.1 distribution, in a project with a custom flac.h header file which is an amalgamation of all the flac header files.
I can get this pair ( flac.h & libFLAC8.dylib ) working fine to convert flac file to other supported audio file formats both ways. It work also fine to get Vorbis Comment and other metadata ( like "bits per sample" for instance ).
But when I use the following code, FLAC__metadata_get_picture() always return false :

    FLAC__StreamMetadata *smet= NULL;
    const char *filename="/[...]/musicfile.flac";
    for (FLAC__StreamMetadata_Picture_Type pic_type = FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER;
         pic_type < FLAC__STREAM_METADATA_PICTURE_TYPE_UNDEFINED; pic_type++)
        if (FLAC__metadata_get_picture(filename, &smet, pic_type, NULL, NULL,  (unsigned)(-1) ,  (unsigned)(-1),  (unsigned)(-1), (unsigned)(-1)) )
            FLAC__StreamMetadata_Picture pict = smet->data.picture;
            if ( pict.data_length )
                printf("found image %s : %s", pict.mime_type, pict.description);
            } else  printf(« no data %s : %s\n", pict.mime_type, pict.description);
        } else printf("get_picture %u returned false\n", pic_type );

I have tried to use -1 instead of pic_type as 3rd argument on a single call to FLAC__metadata_get_picture()
I have tried different flac files which all returns a valid image file when I use the command line tool metaflac --export-picture-to=
The command line tools had been successfully compiled at the same time than the dylib library
( on Mac OS 10.11, intel x86_64 )

in my project FLAC__metadata_get_picture always return false !!!

Anyone has an idea what could be going wrong ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xiph.org/pipermail/flac-dev/attachments/20160415/f296ae20/attachment.html>

More information about the flac-dev mailing list