changeset 1240:9c299205e7e7 trunk

[svn] - some fixes
author nenolod
date Wed, 14 Jun 2006 23:01:39 -0700
parents 8a2d526864c2
children 924181beaa91
files ChangeLog Plugins/Input/vorbis/vorbis.c
diffstat 2 files changed, 22 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jun 14 22:41:42 2006 -0700
+++ b/ChangeLog	Wed Jun 14 23:01:39 2006 -0700
@@ -1,3 +1,14 @@
+2006-06-15 05:41:42 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [1392]
+  - remove metatag references
+  
+
+  Changes:        Modified:
+  +0 -1           trunk/Plugins/General/scrobbler/queue.c  
+  +0 -1           trunk/Plugins/General/scrobbler/scrobbler.c  
+  +0 -2           trunk/Plugins/General/scrobbler/xmms_scrobbler.c  
+
+
 2006-06-15 05:41:05 +0000  William Pitcock <nenolod@nenolod.net>
   revision [1390]
   - remove metatag entirely
--- a/Plugins/Input/vorbis/vorbis.c	Wed Jun 14 22:41:42 2006 -0700
+++ b/Plugins/Input/vorbis/vorbis.c	Wed Jun 14 23:01:39 2006 -0700
@@ -67,8 +67,7 @@
 static void vorbis_seek(int time);
 static int vorbis_time(void);
 static void vorbis_get_song_info(char *filename, char **title, int *length);
-static gchar *vorbis_generate_title(OggVorbis_File * vorbisfile,
-                                    gchar * fn);
+static gchar *vorbis_generate_title(gchar * fn);
 static void vorbis_aboutbox(void);
 static void vorbis_init(void);
 static void vorbis_cleanup(void);
@@ -419,7 +418,7 @@
     samplerate = vi->rate;
     channels = vi->channels;
 
-    title = vorbis_generate_title(&vf, filename);
+    title = vorbis_generate_title(filename);
     use_rg = vorbis_update_replaygain(&rg_scale);
     br = ov_bitrate(&vf, -1);
 
@@ -461,7 +460,7 @@
             if (title)
                 g_free(title);
             g_mutex_lock(vf_mutex);
-            title = vorbis_generate_title(&vf, filename);
+            title = vorbis_generate_title(filename);
             use_rg = vorbis_update_replaygain(&rg_scale);
 
             if (vorbis_is_streaming)
@@ -565,42 +564,15 @@
 static void
 vorbis_get_song_info(char *filename, char **title, int *length)
 {
-    VFSFile *stream;
-    OggVorbis_File vf;          /* avoid thread interaction */
-
-    if (strncasecmp(filename, "http://", 7)) {
-        if ((stream = vfs_fopen(filename, "r")) == NULL)
-            return;
+    TitleInput *tuple = get_song_tuple(filename);
 
-        /*
-         * The open function performs full stream detection and
-         * machine initialization.  If it returns zero, the stream
-         * *is* Vorbis and we're fully ready to decode.
-         */
-        g_mutex_lock(vf_mutex);
-        if (ov_open_callbacks(stream, &vf, NULL, 0, vorbis_callbacks) < 0) {
-            g_mutex_unlock(vf_mutex);
-            vfs_fclose(stream);
-            return;
-        }
-
-        /* Retrieve the length */
-        *length = ov_time_total(&vf, -1) * 1000;
+    *length = tuple->length;
+    *title = xmms_get_titlestring(vorbis_cfg.tag_override ?
+                                  vorbis_cfg.tag_format :
+                                  xmms_get_gentitle_format(),
+                                  tuple);
 
-        *title = NULL;
-        *title = vorbis_generate_title(&vf, filename);
-        /*
-         * once the ov_open succeeds, the stream belongs to
-         * vorbisfile.a.  ov_clear will fclose it
-         */
-        ov_clear(&vf);
-        g_mutex_unlock(vf_mutex);
-    }
-    else {
-        /* streaming song info */
-        *length = -1;
-        *title = (char *) vorbis_http_get_title(filename);
-    }
+    bmp_title_input_free(tuple);
 }
 
 static const gchar *
@@ -736,9 +708,7 @@
          * machine initialization.  If it returns zero, the stream
          * *is* Vorbis and we're fully ready to decode.
          */
-        g_mutex_lock(vf_mutex);
         if (ov_open_callbacks(stream, &vf, NULL, 0, vorbis_callbacks) < 0) {
-            g_mutex_unlock(vf_mutex);
             vfs_fclose(stream);
             return NULL;
         }
@@ -775,7 +745,6 @@
          * vorbisfile.a.  ov_clear will fclose it
          */
         ov_clear(&vf);
-        g_mutex_unlock(vf_mutex);
     }
     else {
 	tuple = bmp_title_input_new();
@@ -787,7 +756,7 @@
 }
 
 static gchar *
-vorbis_generate_title(OggVorbis_File * vorbisfile, gchar * filename)
+vorbis_generate_title(gchar * filename)
 {
     /* Caller should hold vf_mutex */
     gchar *displaytitle = NULL;