All pastes #1624003 Raw Edit

Anonymous

public text v1 · immutable
#1624003 ·published 2009-10-16 18:18 UTC
rendered paste body
From 15057665bcc918189b217f38525a0fa95bb4dff6 Mon Sep 17 00:00:00 2001
From: Anton Khirnov <wyskas@gmail.com>
Date: Fri, 16 Oct 2009 20:17:22 +0200
Subject: [PATCH] wv: add support for reading metadata.

---
 libavformat/wv.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/libavformat/wv.c b/libavformat/wv.c
index d46f90d..ea34d2f 100644
--- a/libavformat/wv.c
+++ b/libavformat/wv.c
@@ -21,6 +21,8 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "apetag.h"
+#include "id3v1.h"
 
 // specs say that maximum block size is 1Mb
 #define WV_BLOCK_LIMIT 1047576
@@ -129,6 +131,7 @@ static int wv_read_header(AVFormatContext *s,
     ByteIOContext *pb = s->pb;
     WVContext *wc = s->priv_data;
     AVStream *st;
+    int64_t cur;
 
     if(wv_read_block_header(s, pb) < 0)
         return -1;
@@ -146,6 +149,13 @@ static int wv_read_header(AVFormatContext *s,
     av_set_pts_info(st, 64, 1, wc->rate);
     s->start_time = 0;
     s->duration = (int64_t)wc->samples * AV_TIME_BASE / st->codec->sample_rate;
+
+    cur = url_ftell(s->pb);
+    ff_ape_parse_tag(s);
+    if(!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
+        ff_id3v1_read(s);
+    url_fseek(s->pb, cur, SEEK_SET);
+
     return 0;
 }
 
-- 
1.6.5