[SCM] libgroove/upstream: only use AV_DICT_IGNORE_SUFFIX when listing all entries

andrewrk-guest at users.alioth.debian.org andrewrk-guest at users.alioth.debian.org
Wed Mar 12 18:30:18 UTC 2014


The following commit has been merged in the upstream branch:
commit c22d8d3bb2952beda9c3991978eaf1a5dfe37cad
Author: Andrew Kelley <superjoe30 at gmail.com>
Date:   Wed Mar 12 11:13:47 2014 -0700

    only use AV_DICT_IGNORE_SUFFIX when listing all entries
    
    fixes a bug where accessing "album" metadata would instead
    return the "album_artist".

diff --git a/groove/file.c b/groove/file.c
index bb600f8..da099f0 100644
--- a/groove/file.c
+++ b/groove/file.c
@@ -94,10 +94,7 @@ struct GrooveFile *groove_file_open(char *filename) {
     }
 
     // copy the audio stream metadata to the context metadata
-    AVDictionaryEntry *tag = NULL;
-    while((tag = av_dict_get(f->audio_st->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
-        av_dict_set(&f->ic->metadata, tag->key, tag->value, AV_DICT_IGNORE_SUFFIX);
-    }
+    av_dict_copy(&f->ic->metadata, f->audio_st->metadata, 0);
 
     return file;
 }
@@ -159,7 +156,9 @@ struct GrooveTag *groove_file_metadata_get(struct GrooveFile *file, const char *
 {
     struct GrooveFilePrivate *f = (struct GrooveFilePrivate *) file;
     const AVDictionaryEntry *e = (const AVDictionaryEntry *) prev;
-    return (struct GrooveTag *) av_dict_get(f->ic->metadata, key, e, flags|AV_DICT_IGNORE_SUFFIX);
+    if (key && key[0] == 0)
+        flags |= AV_DICT_IGNORE_SUFFIX;
+    return (struct GrooveTag *) av_dict_get(f->ic->metadata, key, e, flags);
 }
 
 int groove_file_metadata_set(struct GrooveFile *file, const char *key,
@@ -167,7 +166,7 @@ int groove_file_metadata_set(struct GrooveFile *file, const char *key,
 {
     file->dirty = 1;
     struct GrooveFilePrivate *f = (struct GrooveFilePrivate *) file;
-    return av_dict_set(&f->ic->metadata, key, value, flags|AV_DICT_IGNORE_SUFFIX);
+    return av_dict_set(&f->ic->metadata, key, value, flags);
 }
 
 const char *groove_tag_key(struct GrooveTag *tag) {
@@ -333,10 +332,7 @@ int groove_file_save(struct GrooveFile *file) {
     }
 
     // set metadata
-    AVDictionaryEntry *tag = NULL;
-    while((tag = av_dict_get(f->ic->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
-        av_dict_set(&f->oc->metadata, tag->key, tag->value, AV_DICT_IGNORE_SUFFIX);
-    }
+    av_dict_copy(&f->oc->metadata, f->ic->metadata, 0);
 
     if (avformat_write_header(f->oc, NULL) < 0) {
         cleanup_save(file);

-- 
libgroove packaging



More information about the pkg-multimedia-commits mailing list