summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-01-30 22:51:08 +0100
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-01-30 22:51:08 +0100
commitced846a5b1accbf66a9e24adf823cad9145edcdb (patch)
tree0c7fbc74cee84539fc3a6b68e8d67458e51b14ae
parente65313e21a31a7e4d2dcf5ee13d15dff82aa5f26 (diff)
flac: don't delete replaygain info (bug #1044)
-rw-r--r--plugins/flac/flac.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c
index 4282220c..96d89b8f 100644
--- a/plugins/flac/flac.c
+++ b/plugins/flac/flac.c
@@ -946,8 +946,21 @@ cflac_write_metadata (DB_playItem_t *it) {
} while (FLAC__metadata_iterator_next (iter));
if (data) {
- // delete all comments
- FLAC__metadata_object_vorbiscomment_resize_comments (data, 0);
+ FLAC__StreamMetadata_VorbisComment *vc = &data->data.vorbis_comment;
+ int vc_comments = vc->num_comments;
+ for (int i = 0; i < vc_comments; i++) {
+ const FLAC__StreamMetadata_VorbisComment_Entry *c = &vc->comments[i];
+ if (c->length > 0) {
+ if (strncasecmp (c->entry, "replaygain_album_gain=", 22)
+ && strncasecmp (c->entry, "replaygain_album_peak=", 22)
+ && strncasecmp (c->entry, "replaygain_track_gain=", 22)
+ && strncasecmp (c->entry, "replaygain_track_peak=", 22)) {
+ FLAC__metadata_object_vorbiscomment_delete_comment (data, i);
+ vc_comments--;
+ i--;
+ }
+ }
+ }
}
else {
// create new and add to chain
@@ -962,6 +975,7 @@ cflac_write_metadata (DB_playItem_t *it) {
}
}
+ deadbeef->pl_lock ();
DB_metaInfo_t *m = deadbeef->pl_get_metadata_head (it);
while (m) {
if (m->key[0] != ':') {
@@ -1001,6 +1015,8 @@ cflac_write_metadata (DB_playItem_t *it) {
m = m->next;
}
+ deadbeef->pl_unlock ();
+
#if 0 // fetching covers is broken, disabling for 0.5.2
// check if we have embedded cover
data = NULL;