synchronization of tags in flac's save() method

Алексей Новичков aleksej.novichkov at gmail.com
Tue Jul 31 05:59:19 UTC 2012


Hi! Is it possible to add the switcher that switches off id3v2-to-xiph tags
synchronization when saving flac files?
Right now the corresponding section of bool FLAC::File::save() method looks
like

bool FLAC::File::save()
{
  if(readOnly()) {
    debug("FLAC::File::save() - Cannot save to a read only file.");
    return false;
  }

  if(!isValid()) {
    debug("FLAC::File::save() -- Trying to save invalid file.");
    return false;
  }

  // Create new vorbis comments
  *Tag::duplicate(&d->tag, xiphComment(true), false);* // <-- This line

  d->xiphCommentData = xiphComment()->render(false);

  // Replace metadata blocks

  bool foundVorbisCommentBlock = false;
...


Because of the line *Tag::duplicate(&d->tag, xiphComment(true), false);* I
cannot write TRACKNUMBER field as f.e. "/15" (that is no track number,
total tracks = 15).
I understand that this case is very rare but this format is supported by
many taggers.

In my custom version of TagLib I added a flag *bool synchronizeTags* and
changed FLAC::File interface this way:

virtual bool FLAC::File::save()
{
    save(true);
}

bool FLAC::File::save(bool synchronizeTags)
{
  if(readOnly()) {
    debug("FLAC::File::save() - Cannot save to a read only file.");
    return false;
  }

  if(!isValid()) {
    debug("FLAC::File::save() -- Trying to save invalid file.");
    return false;
  }

  // Create new vorbis comments
 * if (synchronizeTags)*  // <-- This line
    *Tag::duplicate(&d->tag, xiphComment(true), false);*

  d->xiphCommentData = xiphComment()->render(false);

  // Replace metadata blocks

  bool foundVorbisCommentBlock = false;
...


The default behaviour remained intact. Is it possible to add my changes to
the TagLib 1.8 release?

Best regards
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/taglib-devel/attachments/20120731/77a2d2bc/attachment.html>


More information about the taglib-devel mailing list