[flac-dev] Patch to stop writing empty vorbiscomment fields

Janne Hyvärinen cse at sci.fi
Sun Sep 14 01:28:41 PDT 2014


Here's a patch that stops the flac binary from writing empty tag fields. 
At least in Windows world these come to files by accident. CD extraction 
programs pass all possible metadata entries they allow setting in the UI 
to flac binary and most of the time most fields are empty when basic 
info like artist, album, title, track number and release date are the 
only fields that are set.
-------------- next part --------------
diff --git a/src/flac/vorbiscomment.c b/src/flac/vorbiscomment.c
index ed9f710..0e99267 100644
--- a/src/flac/vorbiscomment.c
+++ b/src/flac/vorbiscomment.c
@@ -243,7 +243,7 @@ FLAC__bool flac__vorbiscomment_add(FLAC__StreamMetadata *block, const char *comm
 		return false;
 	}
 
-	if(!set_vc_field(block, &parsed, &dummy, raw, violation)) {
+	if(parsed.field_value_length > 0 && !set_vc_field(block, &parsed, &dummy, raw, violation)) {
 		free_field(&parsed);
 		return false;
 	}


More information about the flac-dev mailing list