diff --git a/build/config.mk b/build/config.mk
index aa80afa6..2dbf799d 100644
--- a/build/config.mk
+++ b/build/config.mk
@@ -42,7 +42,7 @@ all default: $(DEFAULT_BUILD)
VERSION=\"1.1.1\"
-CONFIG_CFLAGS=-D_GNU_SOURCE -DHAVE_INTTYPES_H -DHAVE_WCSDUP -DHAVE_WCSCASECMP -DFLAC__HAS_OGG
+CONFIG_CFLAGS=-D_GNU_SOURCE -DHAVE_INTTYPES_H -DFLAC__HAS_OGG
OGG_INCLUDE_DIR=$(HOME)/local/include
OGG_LIB_DIR=$(HOME)/local/lib
diff --git a/configure.in b/configure.in
index 29cad22d..ad35ae80 100644
--- a/configure.in
+++ b/configure.in
@@ -21,9 +21,6 @@
AC_INIT(src/flac/main.c)
AM_INIT_AUTOMAKE(flac, 1.1.1)
-dnl In order to have access to any available wcsdup() and wcscasecmp()
-AC_GNU_SOURCE
-
# Don't automagically regenerate autoconf/automake generated files unless
# explicitly requested. Eases autobuilding -mdz
AM_MAINTAINER_MODE
@@ -43,9 +40,6 @@ dnl check for getopt in standard library
dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
AC_CHECK_FUNCS(getopt_long, [], [])
-dnl Check for uncommon wide char functions
-AC_CHECK_FUNCS(wcsdup, wcscasecmp, [], [])
-
AC_CANONICAL_HOST
case "$host_cpu" in
i*86) cpu_ia32=true ; AC_DEFINE(FLAC__CPU_IA32) ;;
diff --git a/include/FLAC/format.h b/include/FLAC/format.h
index d4e6bcac..96bbbe04 100644
--- a/include/FLAC/format.h
+++ b/include/FLAC/format.h
@@ -585,13 +585,8 @@ typedef struct {
/** Vorbis comment entry structure used in VORBIS_COMMENT blocks. (c.f. format specification)
*
* For convenience, the APIs maintain a trailing NUL character at the end of
- * \a entry which is not counted toward \a length or stored in the stream,
- * i.e.
+ * \a entry which is not counted toward \a length, i.e.
* \code strlen(entry) == length \endcode
- *
- * It's recommended but not required for users to follow this convention as
- * well when dealing directly with FLAC__StreamMetadata_VorbisComment_Entry
- * as it makes dealing with plain strings easier.
*/
typedef struct {
FLAC__uint32 length;
diff --git a/src/plugin_common/Makefile.am b/src/plugin_common/Makefile.am
index 4c287ca5..5bf78ac6 100644
--- a/src/plugin_common/Makefile.am
+++ b/src/plugin_common/Makefile.am
@@ -23,18 +23,16 @@ noinst_LTLIBRARIES = libplugin_common.la
noinst_HEADERS = \
all.h \
- canonical_tag.h \
charset.h \
defs.h \
dither.h \
locale_hack.h \
- vorbiscomment.h
+ tags.h
libplugin_common_la_SOURCES = \
- canonical_tag.c \
charset.c \
dither.c \
- vorbiscomment.c
+ tags.c
EXTRA_DIST = \
Makefile.lite \
diff --git a/src/plugin_common/Makefile.lite b/src/plugin_common/Makefile.lite
index b23f9e5f..49a8b478 100644
--- a/src/plugin_common/Makefile.lite
+++ b/src/plugin_common/Makefile.lite
@@ -26,10 +26,9 @@ INCLUDES = -I$(topdir)/include -I$(HOME)/local/include
DEFINES =
SRCS_C = \
- canonical_tag.c \
charset.c \
dither.c \
- vorbiscomment.c
+ tags.c
include $(topdir)/build/lib.mk
diff --git a/src/plugin_common/all.h b/src/plugin_common/all.h
index 503736c1..559f802e 100644
--- a/src/plugin_common/all.h
+++ b/src/plugin_common/all.h
@@ -19,10 +19,9 @@
#ifndef FLAC__PLUGIN_COMMON__ALL_H
#define FLAC__PLUGIN_COMMON__ALL_H
-#include "canonical_tag.h"
#include "charset.h"
#include "dither.h"
#include "locale_hack.h"
-#include "vorbiscomment.h"
+#include "tags.h"
#endif
diff --git a/src/plugin_common/plugin_common_static.dsp b/src/plugin_common/plugin_common_static.dsp
index c62c7195..8f8689a3 100644
--- a/src/plugin_common/plugin_common_static.dsp
+++ b/src/plugin_common/plugin_common_static.dsp
@@ -85,10 +85,6 @@ LIB32=link.exe -lib
# PROP Default_Filter "cpp"
# Begin Source File
-SOURCE=.\canonical_tag.c
-# End Source File
-# Begin Source File
-
SOURCE=.\charset.c
# End Source File
# Begin Source File
@@ -97,7 +93,7 @@ SOURCE=.\dither.c
# End Source File
# Begin Source File
-SOURCE=.\vorbiscomment.c
+SOURCE=.\tags.c
# End Source File
# End Group
# Begin Group "Public Header Files"
@@ -109,10 +105,6 @@ SOURCE=.\all.h
# End Source File
# Begin Source File
-SOURCE=.\canonical_tag.h
-# End Source File
-# Begin Source File
-
SOURCE=.\charset.h
# End Source File
# Begin Source File
@@ -125,7 +117,7 @@ SOURCE=.\locale_hack.h
# End Source File
# Begin Source File
-SOURCE=.\vorbiscomment.h
+SOURCE=.\tags.h
# End Source File
# End Group
# End Target
diff --git a/src/plugin_winamp2/in_flac.c b/src/plugin_winamp2/in_flac.c
index 3ba942a1..4cb2297f 100644
--- a/src/plugin_winamp2/in_flac.c
+++ b/src/plugin_winamp2/in_flac.c
@@ -267,20 +267,20 @@ static DWORD WINAPI DecodeThread(void *unused)
static const T_CHAR *get_tag(const T_CHAR *tag, void *param)
{
- FLAC_Plugin__CanonicalTag *t = (FLAC_Plugin__CanonicalTag*)param;
- const T_CHAR *val = FLAC_plugin__canonical_get(t, tag);
+ FLAC__StreamMetadata *tags = (FLAC__StreamMetadata*)param;
+ const T_CHAR *val = FLAC_plugin__tags_get_tag_ucs2(tags, tag);
/* some "user friendly cheavats" */
if (!val)
{
if (!wcsicmp(tag, L"ARTIST"))
{
- val = FLAC_plugin__canonical_get(t, L"PERFORMER");
- if (!val) val = FLAC_plugin__canonical_get(t, L"COMPOSER");
+ val = FLAC_plugin__tags_get_tag_ucs2(tags, "PERFORMER");
+ if (!val) val = FLAC_plugin__tags_get_tag_ucs2(tags, L"COMPOSER");
}
else if (!wcsicmp(tag, L"YEAR") || !wcsicmp(tag, L"DATE"))
{
- val = FLAC_plugin__canonical_get(t, L"YEAR_RECORDED");
- if (!val) val = FLAC_plugin__canonical_get(t, L"YEAR_PERFORMED");
+ val = FLAC_plugin__tags_get_tag_ucs2(tags, L"YEAR_RECORDED");
+ if (!val) val = FLAC_plugin__tags_get_tag_ucs2(tags, L"YEAR_PERFORMED");
}
}
@@ -289,13 +289,13 @@ static const T_CHAR *get_tag(const T_CHAR *tag, void *param)
static void format_title(const char *filename, WCHAR *title, unsigned max_size)
{
- FLAC_Plugin__CanonicalTag tag;
+ FLAC__StreamMetadata *tags;
- ReadTags(filename, &tag, true);
+ ReadTags(filename, &tags, /*forDisplay=*/true);
- tagz_format(flac_cfg.title.tag_format_w, get_tag, NULL, &tag, title, max_size);
+ tagz_format(flac_cfg.title.tag_format_w, get_tag, free, tags, title, max_size);
- FLAC_plugin__canonical_tag_clear(&tag);
+ FLAC_plugin__tags_destroy(&tags);
}
static void getfileinfo(char *filename, char *title, int *length_in_msec)
diff --git a/src/plugin_winamp2/infobox.c b/src/plugin_winamp2/infobox.c
index 26a0d4b3..88900892 100644
--- a/src/plugin_winamp2/infobox.c
+++ b/src/plugin_winamp2/infobox.c
@@ -28,10 +28,10 @@
typedef struct
{
char filename[MAX_PATH];
- FLAC_Plugin__CanonicalTag tag;
+ FLAC__StreamMetadata tags;
} LOCALDATA;
-static char buffer[1024];
+static char buffer[8192];
static char *genres = NULL;
static DWORD genresSize = 0, genresCount = 0;
static BOOL genresChanged = FALSE, isNT;
@@ -174,27 +174,46 @@ static void DeinitGenres(HWND hwnd, BOOL final)
}
}
+static wchar_t *AnsiToWide(const char *src)
+{
+ int len;
+ wchar_t *dest;
+
+ FLAC__ASSERT(0 != src);
+
+ len = strlen(src) + 1;
+ /* copy */
+ dest = malloc(len*sizeof(wchar_t));
+ if (dest) mbstowcs(dest, src, len);
+ return dest;
+}
+
/*
* Infobox helpers
*/
-#define SetText(x,y) WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, FLAC_plugin__canonical_get(&data->tag, y), -1, buffer, sizeof(buffer), NULL, NULL); \
+#define SetText(x,y) ucs2 = FLAC_plugin__tags_get_tag_ucs2(data->tags, y); \
+ WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, ucs2, -1, buffer, sizeof(buffer), NULL, NULL); \
+ if(ucs2) free(ucs2); \
SetDlgItemText(hwnd, x, buffer)
#define GetText(x,y) GetDlgItemText(hwnd, x, buffer, sizeof(buffer)); \
- if (*buffer) FLAC_plugin__canonical_set_ansi(&data->tag, y, buffer); \
- else FLAC_plugin__canonical_remove_all(&data->tag, y)
+ if (*buffer) { ucs2 = AnsiToWide(buffer); FLAC_plugin__tags_set_tag_ucs2(data->tags, y, ucs2, /*replace_all=*/false); free(ucs2); } \
+ else FLAC_plugin__tags_delete_tag(data->tags, y)
-#define SetTextW(x,y) SetDlgItemTextW(hwnd, x, FLAC_plugin__canonical_get(&data->tag, y))
+#define SetTextW(x,y) ucs2 = FLAC_plugin__tags_get_tag_ucs2(data->tags, y)); \
+ SetDlgItemTextW(hwnd, x, ucs2); \
+ free(ucs2)
#define GetTextW(x,y) GetDlgItemTextW(hwnd, x, (WCHAR*)buffer, sizeof(buffer)/2); \
- if (*(WCHAR*)buffer) FLAC_plugin__canonical_set(&data->tag, y, (WCHAR*)buffer); \
- else FLAC_plugin__canonical_remove_all(&data->tag, y)
+ if (*(WCHAR*)buffer) FLAC_plugin__tags_set_tag_ucs2(data->tags, y, (WCHAR*)buffer, /*replace_all=*/false); \
+ else FLAC_plugin__tags_delete_tag(data->tags, y)
static BOOL InitInfoboxInfo(HWND hwnd, const char *file)
{
LOCALDATA *data = LocalAlloc(LPTR, sizeof(LOCALDATA));
+ wchar_t *ucs2;
FLAC__StreamMetadata streaminfo;
DWORD length, bps, ratio, rg;
LONGLONG filesize;
@@ -208,13 +227,13 @@ static BOOL InitInfoboxInfo(HWND hwnd, const char *file)
if (!filesize) return FALSE;
if (!FLAC__metadata_get_streaminfo(file, &streaminfo))
return FALSE;
- ReadTags(file, &data->tag, false);
+ ReadTags(file, &data->tags, false);
length = (DWORD)(streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate);
bps = (DWORD)(filesize / (125*streaminfo.data.stream_info.total_samples/streaminfo.data.stream_info.sample_rate));
ratio = bps*1000000 / (streaminfo.data.stream_info.sample_rate*streaminfo.data.stream_info.channels*streaminfo.data.stream_info.bits_per_sample);
- rg = FLAC_plugin__canonical_get(&data->tag, L"REPLAYGAIN_TRACK_GAIN") ? 1 : 0;
- rg |= FLAC_plugin__canonical_get(&data->tag, L"REPLAYGAIN_ALBUM_GAIN") ? 2 : 0;
+ rg = FLAC_plugin__tags_get_tag_utf8(data->tags, L"REPLAYGAIN_TRACK_GAIN") ? 1 : 0;
+ rg |= FLAC_plugin__tags_get_tag_utf8(data->tags, L"REPLAYGAIN_ALBUM_GAIN") ? 2 : 0;
sprintf(buffer, "Sample rate: %d Hz\nChannels: %d\nBits per sample: %d\nMin block size: %d\nMax block size: %d\n"
"File size: %I64d bytes\nTotal samples: %I64d\nLength: %d:%02d\nAvg. bitrate: %d\nCompression ratio: %d.%d%%\n"
@@ -228,33 +247,33 @@ static BOOL InitInfoboxInfo(HWND hwnd, const char *file)
/* tag */
if (isNT)
{
- SetTextW(IDC_TITLE, L"TITLE");
- SetTextW(IDC_ARTIST, L"ARTIST");
- SetTextW(IDC_ALBUM, L"ALBUM");
- SetTextW(IDC_COMMENT, L"COMMENT");
- SetTextW(IDC_YEAR, L"DATE");
- SetTextW(IDC_TRACK, L"TRACKNUMBER");
- SetTextW(IDC_GENRE, L"GENRE");
+ SetTextW(IDC_TITLE, "TITLE");
+ SetTextW(IDC_ARTIST, "ARTIST");
+ SetTextW(IDC_ALBUM, "ALBUM");
+ SetTextW(IDC_COMMENT, "COMMENT");
+ SetTextW(IDC_YEAR, "DATE");
+ SetTextW(IDC_TRACK, "TRACKNUMBER");
+ SetTextW(IDC_GENRE, "GENRE");
}
else
{
- SetText(IDC_TITLE, L"TITLE");
- SetText(IDC_ARTIST, L"ARTIST");
- SetText(IDC_ALBUM, L"ALBUM");
- SetText(IDC_COMMENT, L"COMMENT");
- SetText(IDC_YEAR, L"DATE");
- SetText(IDC_TRACK, L"TRACKNUMBER");
- SetText(IDC_GENRE, L"GENRE");
+ SetText(IDC_TITLE, "TITLE");
+ SetText(IDC_ARTIST, "ARTIST");
+ SetText(IDC_ALBUM, "ALBUM");
+ SetText(IDC_COMMENT, "COMMENT");
+ SetText(IDC_YEAR, "DATE");
+ SetText(IDC_TRACK, "TRACKNUMBER");
+ SetText(IDC_GENRE, "GENRE");
}
return TRUE;
}
-static void __inline SetTag(HWND hwnd, const char *filename, FLAC_Plugin__CanonicalTag *tag)
+static void __inline SetTag(HWND hwnd, const char *filename, FLAC__StreamMetadata *tags)
{
strcpy(buffer, infoTitle);
- if (FLAC_plugin__vorbiscomment_set(filename, tag))
+ if (FLAC_plugin__tags_set(filename, tags))
strcat(buffer, " [Updated]");
else strcat(buffer, " [Failed]");
@@ -264,42 +283,45 @@ static void __inline SetTag(HWND hwnd, const char *filename, FLAC_Plugin__Canoni
static void UpdateTag(HWND hwnd)
{
LOCALDATA *data = (LOCALDATA*)GetWindowLong(hwnd, GWL_USERDATA);
+ wchar_t *ucs2;
/* get fields */
if (isNT)
{
- GetTextW(IDC_TITLE, L"TITLE");
- GetTextW(IDC_ARTIST, L"ARTIST");
- GetTextW(IDC_ALBUM, L"ALBUM");
- GetTextW(IDC_COMMENT, L"COMMENT");
- GetTextW(IDC_YEAR, L"DATE");
- GetTextW(IDC_TRACK, L"TRACKNUMBER");
- GetTextW(IDC_GENRE, L"GENRE");
+ GetTextW(IDC_TITLE, "TITLE");
+ GetTextW(IDC_ARTIST, "ARTIST");
+ GetTextW(IDC_ALBUM, "ALBUM");
+ GetTextW(IDC_COMMENT, "COMMENT");
+ GetTextW(IDC_YEAR, "DATE");
+ GetTextW(IDC_TRACK, "TRACKNUMBER");
+ GetTextW(IDC_GENRE, "GENRE");
- WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, FLAC_plugin__canonical_get(&data->tag, L"GENRE"), -1, buffer, sizeof(buffer), NULL, NULL);
+ ucs2 = FLAC_plugin__tags_get_tag_ucs2(data->tags, "GENRE");
+ WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, ucs2, -1, buffer, sizeof(buffer), NULL, NULL);
+ free(ucs2);
}
else
{
- GetText(IDC_TITLE, L"TITLE");
- GetText(IDC_ARTIST, L"ARTIST");
- GetText(IDC_ALBUM, L"ALBUM");
- GetText(IDC_COMMENT, L"COMMENT");
- GetText(IDC_YEAR, L"DATE");
- GetText(IDC_TRACK, L"TRACKNUMBER");
- GetText(IDC_GENRE, L"GENRE");
+ GetText(IDC_TITLE, "TITLE");
+ GetText(IDC_ARTIST, "ARTIST");
+ GetText(IDC_ALBUM, "ALBUM");
+ GetText(IDC_COMMENT, "COMMENT");
+ GetText(IDC_YEAR, "DATE");
+ GetText(IDC_TRACK, "TRACKNUMBER");
+ GetText(IDC_GENRE, "GENRE");
}
/* update genres list (buffer should contain genre) */
if (buffer[0]) AddGenre(hwnd, buffer);
/* write tag */
- SetTag(hwnd, data->filename, &data->tag);
+ SetTag(hwnd, data->filename, data->tags);
}
static void RemoveTag(HWND hwnd)
{
LOCALDATA *data = (LOCALDATA*)GetWindowLong(hwnd, GWL_USERDATA);
- FLAC_plugin__canonical_tag_clear(&data->tag);
+ FLAC_plugin__tags_delete_all(data->tags);
SetDlgItemText(hwnd, IDC_TITLE, "");
SetDlgItemText(hwnd, IDC_ARTIST, "");
@@ -309,7 +331,7 @@ static void RemoveTag(HWND hwnd)
SetDlgItemText(hwnd, IDC_TRACK, "");
SetDlgItemText(hwnd, IDC_GENRE, "");
- SetTag(hwnd, data->filename, &data->tag);
+ SetTag(hwnd, data->filename, data->tags);
}
@@ -329,7 +351,7 @@ static INT_PTR CALLBACK InfoProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
case WM_DESTROY:
{
LOCALDATA *data = (LOCALDATA*)GetWindowLong(hwnd, GWL_USERDATA);
- FLAC_plugin__canonical_tag_clear(&data->tag);
+ FLAC_plugin__tags_destroy(&data->tags);
LocalFree(data);
DeinitGenres(hwnd, FALSE);
}
@@ -390,20 +412,25 @@ static __inline char *GetFileName(const char *fullname)
return (char*)c;
}
-void ReadTags(const char *fileName, FLAC_Plugin__CanonicalTag *tag, BOOL forDisplay)
+void ReadTags(const char *fileName, FLAC__StreamMetadata **tags, BOOL forDisplay)
{
- FLAC_plugin__canonical_tag_init(tag);
- FLAC_plugin__vorbiscomment_get(fileName, tag, forDisplay ? flac_cfg.title.sep : NULL);
+ if(FLAC_plugin__tags_get(fileName, tags, forDisplay ? flac_cfg.title.sep : NULL)) {
- /* add file name */
- if (forDisplay)
- {
- char *c;
- FLAC_plugin__canonical_set_ansi(tag, L"filepath", fileName);
+ /* add file name */
+ if (forDisplay)
+ {
+ char *c;
+ wchar_t *ucs2;
+ ucs2 = AnsiToWide(fileName);
+ FLAC_plugin__tags_set_tag_ucs2(*tags, "filepath", ucs2);
+ free(ucs2);
- strcpy(buffer, GetFileName(fileName));
- if (c = strrchr(buffer, '.')) *c = 0;
- FLAC_plugin__canonical_set_ansi(tag, L"filename", buffer);
+ strcpy(buffer, GetFileName(fileName));
+ if (c = strrchr(buffer, '.')) *c = 0;
+ ucs2 = AnsiToWide(buffer);
+ FLAC_plugin__tags_set_tag_ucs2(*tags, "filename", ucs2);
+ free(ucs2);
+ }
}
}
diff --git a/src/plugin_xmms/fileinfo.c b/src/plugin_xmms/fileinfo.c
index 12c808c2..cc5ea30e 100644
--- a/src/plugin_xmms/fileinfo.c
+++ b/src/plugin_xmms/fileinfo.c
@@ -29,7 +29,7 @@
#include "FLAC/metadata.h"
#include "charset.h"
#include "configure.h"
-#include "plugin_common/vorbiscomment.h"
+#include "plugin_common/tags.h"
#include "plugin_common/locale_hack.h"
static GtkWidget *window = NULL;
@@ -40,7 +40,7 @@ static GtkWidget *genre_combo;
static GtkWidget *flac_samplerate, *flac_channels, *flac_bits_per_sample, *flac_blocksize, *flac_filesize, *flac_samples, *flac_bitrate;
static gchar *current_filename = NULL;
-static FLAC_Plugin__CanonicalTag *canonical_tag = NULL;
+static FLAC__StreamMetadata *tags_ = NULL;
static const gchar *vorbis_genres[] =
{
@@ -102,20 +102,16 @@ static void label_set_text(GtkWidget * label, char *str, ...)
g_free(tempstr);
}
-static void set_entry_tag(GtkEntry * entry, const wchar_t * tag)
+static void set_entry_tag(GtkEntry * entry, const char * utf8)
{
-
- if(tag) {
- char *utf8 = FLAC_plugin__convert_ucs2_to_utf8(tag);
+ if(utf8) {
if(flac_cfg.title.convert_char_set) {
char *text = convert_from_utf8_to_user(utf8);
gtk_entry_set_text(entry, text);
free(text);
}
- else {
+ else
gtk_entry_set_text(entry, utf8);
- }
- free(utf8);
}
else
gtk_entry_set_text(entry, "");
@@ -134,7 +130,7 @@ static void get_entry_tag(GtkEntry * entry, const char *name)
else
utf8 = text;
- FLAC_plugin__canonical_add_utf8(canonical_tag, name, utf8, (unsigned)(-1), (unsigned)(-1), /*sep=*/0);
+ FLAC_plugin__tags_add_tag_utf8(tags_, name, utf8, /*separator=*/0);
if(flac_cfg.title.convert_char_set)
free(utf8);
@@ -142,13 +138,13 @@ static void get_entry_tag(GtkEntry * entry, const char *name)
static void show_tag()
{
- set_entry_tag(GTK_ENTRY(title_entry) , FLAC_plugin__canonical_get(canonical_tag, L"TITLE"));
- set_entry_tag(GTK_ENTRY(artist_entry) , FLAC_plugin__canonical_get(canonical_tag, L"ARTIST"));
- set_entry_tag(GTK_ENTRY(album_entry) , FLAC_plugin__canonical_get(canonical_tag, L"ALBUM"));
- set_entry_tag(GTK_ENTRY(date_entry) , FLAC_plugin__canonical_get(canonical_tag, L"DATE"));
- set_entry_tag(GTK_ENTRY(tracknum_entry) , FLAC_plugin__canonical_get(canonical_tag, L"TRACKNUMBER"));
- set_entry_tag(GTK_ENTRY(comment_entry) , FLAC_plugin__canonical_get(canonical_tag, L"DESCRIPTION"));
- set_entry_tag(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), FLAC_plugin__canonical_get(canonical_tag, L"GENRE"));
+ set_entry_tag(GTK_ENTRY(title_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "TITLE"));
+ set_entry_tag(GTK_ENTRY(artist_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "ARTIST"));
+ set_entry_tag(GTK_ENTRY(album_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "ALBUM"));
+ set_entry_tag(GTK_ENTRY(date_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "DATE"));
+ set_entry_tag(GTK_ENTRY(tracknum_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "TRACKNUMBER"));
+ set_entry_tag(GTK_ENTRY(comment_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "DESCRIPTION"));
+ set_entry_tag(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), FLAC_plugin__tags_get_tag_utf8(tags_, "GENRE"));
}
static void save_tag(GtkWidget * w, gpointer data)
@@ -156,13 +152,13 @@ static void save_tag(GtkWidget * w, gpointer data)
(void)w;
(void)data;
- while (FLAC_plugin__canonical_remove(canonical_tag, L"TITLE")) ;
- while (FLAC_plugin__canonical_remove(canonical_tag, L"ARTIST")) ;
- while (FLAC_plugin__canonical_remove(canonical_tag, L"ALBUM")) ;
- while (FLAC_plugin__canonical_remove(canonical_tag, L"DATE")) ;
- while (FLAC_plugin__canonical_remove(canonical_tag, L"TRACKNUMBER")) ;
- while (FLAC_plugin__canonical_remove(canonical_tag, L"DESCRIPTION")) ;
- while (FLAC_plugin__canonical_remove(canonical_tag, L"GENRE")) ;
+ FLAC_plugin__tags_delete_tag(tags_, "TITLE");
+ FLAC_plugin__tags_delete_tag(tags_, "ARTIST");
+ FLAC_plugin__tags_delete_tag(tags_, "ALBUM");
+ FLAC_plugin__tags_delete_tag(tags_, "DATE");
+ FLAC_plugin__tags_delete_tag(tags_, "TRACKNUMBER");
+ FLAC_plugin__tags_delete_tag(tags_, "DESCRIPTION");
+ FLAC_plugin__tags_delete_tag(tags_, "GENRE");
get_entry_tag(GTK_ENTRY(title_entry) , "TITLE");
get_entry_tag(GTK_ENTRY(artist_entry) , "ARTIST");
@@ -172,7 +168,7 @@ static void save_tag(GtkWidget * w, gpointer data)
get_entry_tag(GTK_ENTRY(comment_entry) , "DESCRIPTION");
get_entry_tag(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), "GENRE");
- FLAC_plugin__vorbiscomment_set(current_filename, canonical_tag);
+ FLAC_plugin__tags_set(current_filename, tags_);
gtk_widget_destroy(window);
}
@@ -181,15 +177,15 @@ static void remove_tag(GtkWidget * w, gpointer data)
(void)w;
(void)data;
- while (FLAC_plugin__canonical_remove(canonical_tag, L"TITLE")) ;
- while (FLAC_plugin__canonical_remove(canonical_tag, L"ARTIST")) ;
- while (FLAC_plugin__canonical_remove(canonical_tag, L"ALBUM")) ;
- while (FLAC_plugin__canonical_remove(canonical_tag, L"DATE")) ;
- while (FLAC_plugin__canonical_remove(canonical_tag, L"TRACKNUMBER")) ;
- while (FLAC_plugin__canonical_remove(canonical_tag, L"DESCRIPTION")) ;
- while (FLAC_plugin__canonical_remove(canonical_tag, L"GENRE")) ;
+ FLAC_plugin__tags_delete_tag(tags_, "TITLE");
+ FLAC_plugin__tags_delete_tag(tags_, "ARTIST");
+ FLAC_plugin__tags_delete_tag(tags_, "ALBUM");
+ FLAC_plugin__tags_delete_tag(tags_, "DATE");
+ FLAC_plugin__tags_delete_tag(tags_, "TRACKNUMBER");
+ FLAC_plugin__tags_delete_tag(tags_, "DESCRIPTION");
+ FLAC_plugin__tags_delete_tag(tags_, "GENRE");
- FLAC_plugin__vorbiscomment_set(current_filename, canonical_tag);
+ FLAC_plugin__tags_set(current_filename, tags_);
gtk_widget_destroy(window);
}
@@ -416,12 +412,10 @@ void FLAC_XMMS__file_info_box(char *filename)
gtk_entry_set_text(GTK_ENTRY(filename_entry), filename);
gtk_editable_set_position(GTK_EDITABLE(filename_entry), -1);
- if(canonical_tag)
- FLAC_plugin__canonical_tag_clear(canonical_tag);
- else
- canonical_tag = FLAC_plugin__canonical_tag_new();
+ if(tags_)
+ FLAC_plugin__tags_destroy(&tags_);
- FLAC_plugin__vorbiscomment_get(current_filename, canonical_tag, /*sep=*/0);
+ FLAC_plugin__tags_get(current_filename, &tags_);
show_tag();
show_file_info();
diff --git a/src/plugin_xmms/tag.c b/src/plugin_xmms/tag.c
index b9a1085f..d7695ecf 100644
--- a/src/plugin_xmms/tag.c
+++ b/src/plugin_xmms/tag.c
@@ -29,8 +29,7 @@
#include
#include "FLAC/metadata.h"
-#include "plugin_common/canonical_tag.h"
-#include "plugin_common/vorbiscomment.h"
+#include "plugin_common/tags.h"
#include "charset.h"
#include "configure.h"
@@ -65,21 +64,19 @@ static int local__getnum(char* str)
return 0;
}
-static char *local__getfield(FLAC_Plugin__CanonicalTag *tag, const wchar_t *name)
+static char *local__getfield(const FLAC__StreamMetadata *tags, const char *name)
{
- const wchar_t *ucs2 = FLAC_plugin__canonical_get(tag, name);
- if (0 != ucs2) {
- char *utf8 = FLAC_plugin__convert_ucs2_to_utf8(FLAC_plugin__canonical_get(tag, name));
- if(flac_cfg.title.convert_char_set) {
- char *user = convert_from_utf8_to_user(utf8);
- free(utf8);
- return user;
+ if (0 != tags) {
+ const char *utf8 = FLAC_plugin__tags_get_tag_utf8(tags, name);
+ if (0 != utf8) {
+ if(flac_cfg.title.convert_char_set)
+ return convert_from_utf8_to_user(utf8);
+ else
+ return strdup(utf8);
}
- else
- return utf8;
}
- else
- return 0;
+
+ return 0;
}
static void local__safe_free(char *s)
@@ -99,21 +96,19 @@ char *flac_format_song_title(char *filename)
{
char *ret = NULL;
TitleInput *input = NULL;
- FLAC_Plugin__CanonicalTag tag;
+ FLAC__StreamMetadata *tags;
char *title, *artist, *performer, *album, *date, *tracknumber, *genre, *description;
- FLAC_plugin__canonical_tag_init(&tag);
+ FLAC_plugin__tags_get(filename, &tags);
- FLAC_plugin__vorbiscomment_get(filename, &tag, /*sep=*/0);
-
- title = local__getfield(&tag, L"TITLE");
- artist = local__getfield(&tag, L"ARTIST");
- performer = local__getfield(&tag, L"PERFORMER");
- album = local__getfield(&tag, L"ALBUM");
- date = local__getfield(&tag, L"DATE");
- tracknumber = local__getfield(&tag, L"TRACKNUMBER");
- genre = local__getfield(&tag, L"GENRE");
- description = local__getfield(&tag, L"DESCRIPTION");
+ title = local__getfield(tags, "TITLE");
+ artist = local__getfield(tags, "ARTIST");
+ performer = local__getfield(tags, "PERFORMER");
+ album = local__getfield(tags, "ALBUM");
+ date = local__getfield(tags, "DATE");
+ tracknumber = local__getfield(tags, "TRACKNUMBER");
+ genre = local__getfield(tags, "GENRE");
+ description = local__getfield(tags, "DESCRIPTION");
XMMS_NEW_TITLEINPUT(input);
@@ -142,7 +137,7 @@ char *flac_format_song_title(char *filename)
*(local__extname(ret) - 1) = '\0'; /* removes period */
}
- FLAC_plugin__canonical_tag_clear(&tag);
+ FLAC_plugin__tags_destroy(&tags);
local__safe_free(title);
local__safe_free(artist);
local__safe_free(performer);