changeset 1241:924181beaa91 trunk

[svn] - flac_get_tuple()
author nenolod
date Wed, 14 Jun 2006 23:08:51 -0700
parents 9c299205e7e7
children 0f89ebbf890a
files ChangeLog Plugins/Input/flac/plugin.c Plugins/Input/flac/tag.c Plugins/Input/flac/tag.h
diffstat 4 files changed, 26 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jun 14 23:01:39 2006 -0700
+++ b/ChangeLog	Wed Jun 14 23:08:51 2006 -0700
@@ -1,3 +1,12 @@
+2006-06-15 06:01:39 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [1394]
+  - some fixes
+  
+
+  Changes:        Modified:
+  +11 -42         trunk/Plugins/Input/vorbis/vorbis.c  
+
+
 2006-06-15 05:41:42 +0000  William Pitcock <nenolod@nenolod.net>
   revision [1392]
   - remove metatag references
--- a/Plugins/Input/flac/plugin.c	Wed Jun 14 23:01:39 2006 -0700
+++ b/Plugins/Input/flac/plugin.c	Wed Jun 14 23:08:51 2006 -0700
@@ -157,7 +157,8 @@
 	NULL,
 	FLAC_XMMS__get_song_info,
 	FLAC_XMMS__file_info_box,
-	NULL
+	NULL,
+	flac_get_tuple
 };
 
 #define SAMPLES_PER_WRITE 512
--- a/Plugins/Input/flac/tag.c	Wed Jun 14 23:01:39 2006 -0700
+++ b/Plugins/Input/flac/tag.c	Wed Jun 14 23:08:51 2006 -0700
@@ -78,12 +78,6 @@
 	return 0;
 }
 
-static void local__safe_free(char *s)
-{
-	if (0 != s)
-		free(s);
-}
-
 /*
  * Function flac_format_song_title (tag, filename)
  *
@@ -91,9 +85,8 @@
  *    return it.  The title must be subsequently freed using g_free().
  *
  */
-char *flac_format_song_title(char *filename)
+TitleInput *flac_get_tuple(char *filename)
 {
-	char *ret = NULL;
 	TitleInput *input = NULL;
 	FLAC__StreamMetadata *tags;
 	char *title, *artist, *performer, *album, *date, *tracknumber, *genre, *description;
@@ -109,7 +102,7 @@
 	genre       = local__getfield(tags, "GENRE");
 	description = local__getfield(tags, "DESCRIPTION");
 
-	XMMS_NEW_TITLEINPUT(input);
+	input = bmp_title_input_new();
 
 	input->performer = local__getstr(performer);
 	if(!input->performer)
@@ -124,8 +117,16 @@
 	input->file_name = g_path_get_basename(filename);
 	input->file_path = filename;
 	input->file_ext = local__extname(filename);
-	ret = xmms_get_titlestring(flac_cfg.title.tag_override ? flac_cfg.title.tag_format : xmms_get_gentitle_format(), input);
-	g_free(input);
+
+	return input;
+}
+
+gchar *flac_format_song_title(gchar *filename)
+{
+	gchar *ret = NULL;
+	TitleInput *tuple = flac_get_tuple(filename);
+
+	ret = xmms_get_titlestring(flac_cfg.title.tag_override ? flac_cfg.title.tag_format : xmms_get_gentitle_format(), tuple);
 
 	if (!ret) {
 		/*
@@ -136,14 +137,7 @@
 			*(local__extname(ret) - 1) = '\0';	/* removes period */
 	}
 
-	FLAC_plugin__tags_destroy(&tags);
-	local__safe_free(title);
-	local__safe_free(artist);
-	local__safe_free(performer);
-	local__safe_free(album);
-	local__safe_free(date);
-	local__safe_free(tracknumber);
-	local__safe_free(genre);
-	local__safe_free(description);
+	bmp_title_input_free(tuple);
+
 	return ret;
 }
--- a/Plugins/Input/flac/tag.h	Wed Jun 14 23:01:39 2006 -0700
+++ b/Plugins/Input/flac/tag.h	Wed Jun 14 23:08:51 2006 -0700
@@ -19,6 +19,7 @@
 #ifndef __FLAC__PLUGIN_XMMS__TAG_H__
 #define __FLAC__PLUGIN_XMMS__TAG_H__
 
+TitleInput *flac_get_tuple(gchar * filename);
 gchar *flac_format_song_title(gchar * filename);
 
 #endif