[Flac-dev] Help upgrading to 1.1.3 (MD5 sum issues, album art corrupts files)

Josh Coalson xflac at yahoo.com
Wed Jan 17 12:49:20 PST 2007


--- "Stephen F. Booth" <me at sbooth.org> wrote:
> Hello all,
> 
> I recently upgraded the libFLAC used in my application Max (http:// 
> sbooth.org/Max/) to 1.1.3 and added preliminary support for album  
> art.  During the upgrade I evidently made some coding mistakes with  
> interesting results.  I've combed everything over and can't quite see
> the problems.  I've become somewhat frustrated because my code didn't
> really change significantly from my usage of the 1.1.2 APIs yet  
> things don't work like they did previously.
> 
> My first issue is this: files generated by my application are  
> reported as having "ERROR, MD5 signature mismatch" when tested with  
> flac -t.  I am at a loss as to why!  When I set  
> FLAC__stream_encoder_set_verify to true no errors are reported during
> the encode.  Has anyone seen anything like this?  The source for my  
> encoder may be viewed at http://macaudiox.svn.sourceforge.net/viewvc/
> macaudiox/trunk/Encoders/FLACEncoder.m?view=markup if anyone is
> curious.

I took a quick look and it seems fine, but I'm assuming some
things about the format of the incoming samples.  the way samples
are passed to the encoder has not changed in flac-1.1.3 so if the
same code worked before it should still work.

when you decode the flac file with the 'bad md5' back to PCM,
does it match the original?  the best way to check is to just
feed it a file of 1 sample, then increase until you trigger
the problem.

a couple other things that are probably not related:
1. you can replace a lot of the settings more reliably and get better
   compression using FLAC__stream_encoder_set_compression_level()  
   instead, see
http://flac.sourceforge.net/api/group__flac__stream__encoder.html#ga20
2. libFLAC does not support 32 bps yet

> The second issue is likely more serious.  When I attempt to add album
> art to one of the FLAC files I've created (using the level 2 metadata
> interface), the files are becoming corrupt (in a sense).  Testing  
> with flac-t indicates "ERROR, --until value is before --skip  
> point".   Interestingly, the file seems to work with metaflac:
> 
> METADATA block #0
>    type: 0 (STREAMINFO)
>    is last: false
>    length: 34
>    minimum blocksize: 4608 samples
>    maximum blocksize: 4608 samples
>    minimum framesize: 893 bytes
>    maximum framesize: 14662 bytes
>    sample_rate: 44100 Hz
>    channels: 2
>    bits-per-sample: 16
>    total samples: 9626736
>    MD5 signature: a9b57ffa2020017504e551c6ded0e092
> METADATA block #1
>    type: 4 (VORBIS_COMMENT)
>    is last: false
>    length: 336
>    vendor string: reference libFLAC 1.1.3 20061120
>    comments: 7
>      comment[0]: ALBUM=Hope Floats
>      comment[1]: ARTIST=Lyle Lovett
>      comment[2]: TITLE=Smile
>      comment[3]: TRACKNUMBER=11
>      comment[4]: TRACKTOTAL=13
>      comment[5]: ENCODER=Max 0.7.1b
>      comment[6]: ENCODING=FLAC settings: exhaustiveModelSearch:0  
> midSideStereo:1 looseMidSideStereo:0 QLPCoeffPrecision:0,  
> minResidualPartitionOrder:0, maxResidualPartitionOrder:4,
> maxLPCOrder:8
> METADATA block #2
>    type: 6 (PICTURE)
>    is last: false
>    length: 32
>    type: 3 (Cover (front))
>    MIME type: image/png
>    description:
>    width: 800
>    height: 600
>    depth: 24
>    colors: 0 (unindexed)
>    data length: 685873
>    data:
>      00000000: 89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44  
> 52 .PNG........IHDR
>      ! <snip> !
>      000A7730: 82 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .
> METADATA block #3
>    type: 1 (PADDING)
>    is last: true
>    length: 7860
> 
> Obviously I am doing something wrong, but again I'm not sure what.   
> The tagging/album art source code is at http:// 
> macaudiox.svn.sourceforge.net/viewvc/macaudiox/trunk/Tasks/ 
> EncoderTasks/FLACEncoderTask.m?view=markup for the curious.

that looks ok too, assuming addVorbisComment works.  the metadata
interface also has not changed in flac-1.1.3

but you should use the FLAC__metadata_object_picture_set_* methods
to set the picture data instead of altering the block directly:
http://flac.sourceforge.net/api/group__flac__metadata__object.html#ga42
http://flac.sourceforge.net/api/group__flac__metadata__object.html#ga43
http://flac.sourceforge.net/api/group__flac__metadata__object.html#ga44
that could be a source of mem corruption or leakage.

that's a wierd error though.  can you send or host one of the bad
FLAC files for me to check out?

also, are you using a libFLAC you built yourself or a prebuilt one
from sourceforge or somewhere else?

Josh



 
____________________________________________________________________________________
Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather


More information about the Flac-dev mailing list