Bug 268854 - taglib only stores first of multiple values for the same tag in XiphComments inside FLAC files
Summary: taglib only stores first of multiple values for the same tag in XiphComments ...
Status: RESOLVED FIXED
Alias: None
Product: taglib
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 1.7
Platform: Compiled Sources Linux
: NOR major
Target Milestone: ---
Assignee: Scott Wheeler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-18 23:07 UTC by Michael Helmling
Modified: 2011-03-19 07:39 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Helmling 2011-03-18 23:07:12 UTC
Version:           1.7 (using KDE 4.5.1) 
OS:                Linux

If I try to save multiple string values for the same tag (say "artist") in the Xiph comment of a TagLib::FLAC file, using addField("ARTIST", "value", false), only
the first value exists in the file after a call to save().

Strangely, if I try the same with an Ogg::Vorbis file instead of a FLAC file, it works, though both rely on the same XiphComment class.

Reproducible: Didn't try

Steps to Reproduce:
Compile the following minimal C++ program, provide an arbitrary file empty.flac in the same directory, and run the program twice.

#include <tag.h>
#include <vorbisfile.h>
#include <flacfile.h>
#include <iostream>

using namespace TagLib;
using namespace std;
int main() {
	FLAC::File f("empty.flac");
	Ogg::XiphComment* c = f.xiphComment(true);
	Ogg::FieldListMap m = c->fieldListMap();
	cout << m["ARTIST"].toString() << endl;
	c->addField("ARTIST", "artist 1", true);
	c->addField("ARTIST", "artist 2", false);
	m = c->fieldListMap();
	cout << m["ARTIST"].toString() << endl;
	f.save();	
}


Actual Results:  
The output of the second run is

artist 1
artist 1 artist 2

indicating that only the first string was stored (this can also be virified with a tagging program that supports multiple values, e.g. exfalso).

Expected Results:  
Both values should be stored, so the second run should output

artist 1 artist 2
artist 1 artist 2

as happens with ogg files.

Testet  with both Taglib 1.6.3 (current in ubuntu 10.10) and 1.7 (compiled from source).
Comment 1 Lukáš Lalinský 2011-03-19 07:39:56 UTC
Fixed in https://github.com/taglib/taglib/commit/71e224fed