NEWS update.
[paraslash.git] / ogg_afh.c
index 11214c8938622023157110f117c1c06a03f89837..4b44ea16664948da6cd52adca357b5cb037c3223 100644 (file)
--- a/ogg_afh.c
+++ b/ogg_afh.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004-2009 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2004-2010 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -9,6 +9,7 @@
 #include <inttypes.h>
 #include <ogg/ogg.h>
 #include <vorbis/codec.h>
+#include <regex.h>
 
 #include "para.h"
 #include "afh.h"
@@ -60,7 +61,6 @@ static int read_vorbis_info(ogg_sync_state *oss, struct afh_info *afhi)
        ogg_stream_state stream;
        ogg_page page;
        int ret;
-       char *taginfo;
 
        vorbis_info_init(&vi);
        vorbis_comment_init(&vc);
@@ -93,17 +93,11 @@ static int read_vorbis_info(ogg_sync_state *oss, struct afh_info *afhi)
        ret = read_vorbis_comment(oss, &stream, &vi, &vc);
        if (ret < 0)
                goto out;
-       taginfo = make_taginfo(
-               vorbis_comment_query(&vc, "title", 0),
-               vorbis_comment_query(&vc, "artist", 0),
-               vorbis_comment_query(&vc, "album", 0),
-               vorbis_comment_query(&vc, "year", 0),
-               vorbis_comment_query(&vc, "comment", 0)
-       );
-       PARA_DEBUG_LOG("tag info: %s\n", taginfo);
-       afhi->info_string = make_message("%s:\n%s",
-               status_item_list[SI_AUDIO_FILE_INFO], taginfo);
-       free(taginfo);
+       afhi->tags.artist = para_strdup(vorbis_comment_query(&vc, "artist", 0));
+       afhi->tags.title = para_strdup(vorbis_comment_query(&vc, "title", 0));
+       afhi->tags.album = para_strdup(vorbis_comment_query(&vc, "album", 0));
+       afhi->tags.year = para_strdup(vorbis_comment_query(&vc, "year", 0));
+       afhi->tags.comment = para_strdup(vorbis_comment_query(&vc, "comment", 0));
 
        afhi->header_offset = 0;
        afhi->header_len = oss->returned;
@@ -111,7 +105,7 @@ static int read_vorbis_info(ogg_sync_state *oss, struct afh_info *afhi)
 out:
        vorbis_info_clear(&vi);
        vorbis_comment_clear(&vc);
-       ogg_stream_clear(&stream);
+       //ogg_stream_clear(&stream);
        return ret;
 }
 
@@ -138,7 +132,6 @@ static int ogg_get_file_info(char *map, size_t numbytes, __a_unused int fd,
        int ret, i, j, frames_per_chunk, ct_size;
        long long unsigned num_frames = 0;
 
-       afhi->info_string = NULL;
        ogg_sync_init(&oss);
        ret = -E_OGG_SYNC;
        buf = ogg_sync_buffer(&oss, len);
@@ -187,7 +180,6 @@ static int ogg_get_file_info(char *map, size_t numbytes, __a_unused int fd,
        }
        afhi->chunks_total = j;
        set_chunk_tv(num_frames, j, afhi->frequency, &afhi->chunk_tv);
-       tv_scale(3, &afhi->chunk_tv, &afhi->eof_tv);
        ret = 0;
 out:
        ogg_sync_clear(&oss);