Project

General

Profile

Bug #334

[PATCH] file writer flac does not write tags

Added by James Buren over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Minor
Assignee:
-
Category:
plugins/filewriter
Target version:
Start date:
August 24, 2013
Due date:
% Done:

100%

Estimated time:
Affects version:

Description

Due to how this is written, the tags do not get written to the FLAC file that is
created by the plugin. The attached patch fixes 5 issues.

1) A switch case in insert_vorbis_comment() did not include a break statement, so
string tags would not be inserted because the default case has a return statement.

2) The metadata object is allocated on the stack and is not managed by libFLAC,
resulting in a memory leak. It is now a static global variable.

3) The encoder and metadata objects are both handled properly now when the file is
closed. Pointers are NULL checked, freed, and reset to NULL now.

4) FLAC__stream_encoder_init_stream() must be called after the metadata is set.
Otherwise the call will fail.

5) FLAC vorbis comments should be in uppercase, as that is what the official encoder
does.

Also, the compression level is now set to 8, the maximum. Please apply this patch.

filewriter-flac.patch (3.22 KB) filewriter-flac.patch James Buren, August 24, 2013 01:05

History

#1 Updated by John Lindgren over 10 years ago

This is a good start, but making flac_metadata static introduces another leak. See if you can figure out why.

Edit: Never mind, the leak I'm thinking of shouldn't happen in normal operation.

#3 Updated by John Lindgren over 10 years ago

James Buren wrote:

Also, the compression level is now set to 8, the maximum.

DO NOT EVER add arbitrary changes like this to an otherwise legitimate bug-fix patch.

#4 Updated by John Lindgren over 10 years ago

James Buren wrote:

5) FLAC vorbis comments should be in uppercase, as that is what the official encoder
does.

Actually, Vorbis comments are case-insensitive, so either way is fine.

Also available in: Atom PDF