[FFmpeg-cvslog] aiffdec:Rewrite get_meta()

Michael Niedermayer git at videolan.org
Sat May 7 00:07:17 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri May  6 17:39:31 2011 +0200| [a565c7b7f2e03a769a821c49818c66474bfaf7fd] | committer: Michael Niedermayer

aiffdec:Rewrite get_meta()
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a565c7b7f2e03a769a821c49818c66474bfaf7fd
---

 libavformat/aiffdec.c |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index cc26314..e691bba 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -68,19 +68,20 @@ static int get_tag(AVIOContext *pb, uint32_t * tag)
 static void get_meta(AVFormatContext *s, const char *key, int size)
 {
     uint8_t *str = av_malloc(size+1);
-    int res;
 
-    if (!str) {
-        avio_skip(s->pb, size);
-        return;
-    }
-
-    res = avio_read(s->pb, str, size);
-    if (res < 0)
-        return;
+    if (str) {
+        int res = avio_read(s->pb, str, size);
+        if (res < 0){
+            av_free(str);
+            return;
+        }
+        size += (size&1)-res;
+        str[res] = 0;
+        av_metadata_set2(&s->metadata, key, str, AV_METADATA_DONT_STRDUP_VAL);
+    }else
+        size+= size&1;
 
-    str[res] = 0;
-    av_metadata_set2(&s->metadata, key, str, AV_METADATA_DONT_STRDUP_VAL);
+    avio_skip(s->pb, size);
 }
 
 /* Returns the number of sound data frames or negative on error */



More information about the ffmpeg-cvslog mailing list