| Summary: | passed-in UTF-8 in C binding is converted to Latin1 on saving | ||
|---|---|---|---|
| Product: | [Unmaintained] taglib | Reporter: | Derek <bugs> |
| Component: | general | Assignee: | Scott Wheeler <wheeler> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Derek
2006-04-24 19:50:29 UTC
SVN commit 538781 by wheeler:
Add a function to set the default ID3v2 encoding in the C API.
BUG:126192
M +2 -0 Makefile.am
M +31 -7 tag_c.cpp
M +19 -1 tag_c.h
--- trunk/kdesupport/taglib/bindings/c/Makefile.am #538780:538781
@@ -4,8 +4,10 @@
-I$(top_srcdir)/taglib/mpeg \
-I$(top_srcdir)/taglib/ogg \
-I$(top_srcdir)/taglib/ogg/vorbis \
+ -I$(top_srcdir)/taglib/ogg/flac \
-I$(top_srcdir)/taglib/flac \
-I$(top_srcdir)/taglib/mpc \
+ -I$(top_srcdir)/taglib/mpeg/id3v2 \
$(all_includes)
lib_LTLIBRARIES = libtag_c.la
--- trunk/kdesupport/taglib/bindings/c/tag_c.cpp #538780:538781
@@ -26,18 +26,17 @@
#include <vorbisfile.h>
#include <mpegfile.h>
#include <flacfile.h>
+#include <oggflacfile.h>
#include <mpcfile.h>
#include <tag.h>
+#include <id3v2framefactory.h>
-namespace TagLib
-{
- static List<char *> strings;
- static bool unicodeStrings = true;
- static bool stringManagementEnabled = true;
-}
-
using namespace TagLib;
+static List<char *> strings;
+static bool unicodeStrings = true;
+static bool stringManagementEnabled = true;
+
void taglib_set_strings_unicode(BOOL unicode)
{
unicodeStrings = bool(unicode);
@@ -68,6 +67,8 @@
return reinterpret_cast<TagLib_File *>(new FLAC::File(filename));
case TagLib_File_MPC:
return reinterpret_cast<TagLib_File *>(new MPC::File(filename));
+ case TagLib_File_OggFlac:
+ return reinterpret_cast<TagLib_File *>(new Ogg::FLAC::File(filename));
}
return 0;
@@ -235,3 +236,26 @@
const AudioProperties *p = reinterpret_cast<const AudioProperties *>(audioProperties);
return p->channels();
}
+
+void taglib_id3v2_set_default_text_encoding(TagLib_ID3v2_Encoding encoding)
+{
+ String::Type type = String::Latin1;
+
+ switch(encoding)
+ {
+ case TagLib_ID3v2_Latin1:
+ type = String::Latin1;
+ break;
+ case TagLib_ID3v2_UTF16:
+ type = String::UTF16;
+ break;
+ case TagLib_ID3v2_UTF16BE:
+ type = String::UTF16BE;
+ break;
+ case TagLib_ID3v2_UTF8:
+ type = String::UTF8;
+ break;
+ }
+
+ ID3v2::FrameFactory::instance()->setDefaultTextEncoding(type);
+}
--- trunk/kdesupport/taglib/bindings/c/tag_c.h #538780:538781
@@ -75,7 +75,8 @@
TagLib_File_MPEG,
TagLib_File_OggVorbis,
TagLib_File_FLAC,
- TagLib_File_MPC
+ TagLib_File_MPC,
+ TagLib_File_OggFlac,
} TagLib_File_Type;
/*!
@@ -243,6 +244,23 @@
*/
int taglib_audioproperties_channels(const TagLib_AudioProperties *audioProperties);
+/*******************************************************************************
+ * Special convenience ID3v2 functions
+ *******************************************************************************/
+
+typedef enum {
+ TagLib_ID3v2_Latin1,
+ TagLib_ID3v2_UTF16,
+ TagLib_ID3v2_UTF16BE,
+ TagLib_ID3v2_UTF8
+} TagLib_ID3v2_Encoding;
+
+/*!
+ * This sets the default encoding for ID3v2 frames that are written to tags.
+ */
+
+void taglib_id3v2_set_default_text_encoding(TagLib_ID3v2_Encoding encoding);
+
#ifdef __cplusplus
}
#endif
|