Accepting request 151276 from multimedia:libs

Fix ruxmmms patch to work with non-russian locales.
MUST go to 12.3!

OBS-URL: https://build.opensuse.org/request/show/151276
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/taglib?expand=0&rev=37
This commit is contained in:
Stephan Kulow 2013-02-05 14:47:01 +00:00 committed by Git OBS Bridge
commit f33ec4b6aa
3 changed files with 154 additions and 124 deletions

View File

@ -1,20 +1,6 @@
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index e4a6d1f..324c502 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -14,6 +14,8 @@ else()
set(HAVE_ZLIB 0)
endif()
+set(HAVE_LIBRCC 1)
+
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
find_package(CppUnit)
if(NOT CppUnit_FOUND AND BUILD_TESTS)
diff --git a/config-taglib.h.cmake b/config-taglib.h.cmake
index 9c2f487..8e445c7 100644
--- a/config-taglib.h.cmake
+++ b/config-taglib.h.cmake
diff -dPNur taglib-1.8/config-taglib.h.cmake taglib-1.8-ds/config-taglib.h.cmake
--- taglib-1.8/config-taglib.h.cmake 2012-09-06 20:03:15.000000000 +0200
+++ taglib-1.8-ds/config-taglib.h.cmake 2013-01-29 12:45:48.000000000 +0100
@@ -3,6 +3,8 @@
/* Define if you have libz */
#cmakedefine HAVE_ZLIB 1
@ -24,11 +10,22 @@ index 9c2f487..8e445c7 100644
#cmakedefine NO_ITUNES_HACKS 1
#cmakedefine WITH_ASF 1
#cmakedefine WITH_MP4 1
diff --git a/taglib/CMakeLists.txt b/taglib/CMakeLists.txt
index 61bcb49..49fbb62 100644
--- a/taglib/CMakeLists.txt
+++ b/taglib/CMakeLists.txt
@@ -35,6 +35,7 @@ set(tag_HDRS
diff -dPNur taglib-1.8/ConfigureChecks.cmake taglib-1.8-ds/ConfigureChecks.cmake
--- taglib-1.8/ConfigureChecks.cmake 2012-09-06 20:03:15.000000000 +0200
+++ taglib-1.8-ds/ConfigureChecks.cmake 2013-01-29 12:45:48.000000000 +0100
@@ -14,6 +14,8 @@
set(HAVE_ZLIB 0)
endif()
+SET(HAVE_LIBRCC 1)
+
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
find_package(CppUnit)
if(NOT CppUnit_FOUND AND BUILD_TESTS)
diff -dPNur taglib-1.8/taglib/CMakeLists.txt taglib-1.8-ds/taglib/CMakeLists.txt
--- taglib-1.8/taglib/CMakeLists.txt 2012-09-06 20:03:15.000000000 +0200
+++ taglib-1.8-ds/taglib/CMakeLists.txt 2013-01-29 12:45:48.000000000 +0100
@@ -35,6 +35,7 @@
audioproperties.h
taglib_export.h
${CMAKE_BINARY_DIR}/taglib_config.h
@ -36,7 +33,7 @@ index 61bcb49..49fbb62 100644
toolkit/taglib.h
toolkit/tstring.h
toolkit/tlist.h
@@ -269,6 +270,7 @@ set(xm_SRCS
@@ -269,6 +270,7 @@
)
set(toolkit_SRCS
@ -44,20 +41,19 @@ index 61bcb49..49fbb62 100644
toolkit/tstring.cpp
toolkit/tstringlist.cpp
toolkit/tbytevector.cpp
@@ -295,6 +297,8 @@ set(tag_LIB_SRCS
@@ -296,7 +298,7 @@
add_library(tag ${tag_LIB_SRCS} ${tag_HDRS})
+target_link_libraries(tag rcc)
+
if(ZLIB_FOUND)
target_link_libraries(tag ${ZLIB_LIBRARIES})
- target_link_libraries(tag ${ZLIB_LIBRARIES})
+ target_link_libraries(tag rcc ${ZLIB_LIBRARIES})
endif()
diff --git a/taglib/mpeg/id3v1/id3v1tag.cpp b/taglib/mpeg/id3v1/id3v1tag.cpp
index e9eb47b..08650a1 100644
--- a/taglib/mpeg/id3v1/id3v1tag.cpp
+++ b/taglib/mpeg/id3v1/id3v1tag.cpp
@@ -64,17 +64,18 @@ StringHandler::StringHandler()
set_target_properties(tag PROPERTIES
diff -dPNur taglib-1.8/taglib/mpeg/id3v1/id3v1tag.cpp taglib-1.8-ds/taglib/mpeg/id3v1/id3v1tag.cpp
--- taglib-1.8/taglib/mpeg/id3v1/id3v1tag.cpp 2012-09-06 20:03:15.000000000 +0200
+++ taglib-1.8-ds/taglib/mpeg/id3v1/id3v1tag.cpp 2013-01-29 12:45:48.000000000 +0100
@@ -64,17 +64,18 @@
String ID3v1::StringHandler::parse(const ByteVector &data) const
{
@ -78,7 +74,7 @@ index e9eb47b..08650a1 100644
}
////////////////////////////////////////////////////////////////////////////////
@@ -247,7 +248,7 @@ void ID3v1::Tag::parse(const ByteVector &data)
@@ -247,7 +248,7 @@
d->track = uchar(data[offset + 29]);
}
else
@ -87,11 +83,10 @@ index e9eb47b..08650a1 100644
offset += 30;
diff --git a/taglib/mpeg/id3v2/frames/commentsframe.cpp b/taglib/mpeg/id3v2/frames/commentsframe.cpp
index deaa9d9..9d0df07 100644
--- a/taglib/mpeg/id3v2/frames/commentsframe.cpp
+++ b/taglib/mpeg/id3v2/frames/commentsframe.cpp
@@ -150,10 +150,10 @@ void CommentsFrame::parseFields(const ByteVector &data)
diff -dPNur taglib-1.8/taglib/mpeg/id3v2/frames/commentsframe.cpp taglib-1.8-ds/taglib/mpeg/id3v2/frames/commentsframe.cpp
--- taglib-1.8/taglib/mpeg/id3v2/frames/commentsframe.cpp 2012-09-06 20:03:15.000000000 +0200
+++ taglib-1.8-ds/taglib/mpeg/id3v2/frames/commentsframe.cpp 2013-01-29 12:45:48.000000000 +0100
@@ -150,10 +150,10 @@
return;
}
@ -100,11 +95,11 @@ index deaa9d9..9d0df07 100644
d->language = data.mid(1, 3);
- int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2;
+ int byteAlign = d->textEncoding == (String::Latin1 || String::Latin1ID3 || String::Latin1ID3V2 || d->textEncoding == String::UTF8) ? 1 : 2;
+ int byteAlign = (d->textEncoding == String::Latin1 || d->textEncoding == String::Latin1ID3 || d->textEncoding == String::Latin1ID3V2 || d->textEncoding == String::UTF8) ? 1 : 2;
ByteVectorList l = ByteVectorList::split(data.mid(4), textDelimiter(d->textEncoding), byteAlign, 2);
@@ -174,10 +174,12 @@ ByteVector CommentsFrame::renderFields() const
@@ -174,10 +174,12 @@
String::Type encoding = d->textEncoding;
@ -112,18 +107,52 @@ index deaa9d9..9d0df07 100644
+
encoding = checkTextEncoding(d->description, encoding);
encoding = checkTextEncoding(d->text, encoding);
-
- v.append(char(encoding));
+
+ v.append(char(String::ID3RealType(encoding)));
v.append(d->language.size() == 3 ? d->language : "XXX");
v.append(d->description.data(encoding));
v.append(textDelimiter(encoding));
diff --git a/taglib/toolkit/rccpatch.cpp b/taglib/toolkit/rccpatch.cpp
new file mode 100644
index 0000000..eadbcb1
--- /dev/null
+++ b/taglib/toolkit/rccpatch.cpp
@@ -0,0 +1,198 @@
diff -dPNur taglib-1.8/taglib/mpeg/id3v2/frames/textidentificationframe.cpp taglib-1.8-ds/taglib/mpeg/id3v2/frames/textidentificationframe.cpp
--- taglib-1.8/taglib/mpeg/id3v2/frames/textidentificationframe.cpp 2012-09-06 20:03:15.000000000 +0200
+++ taglib-1.8-ds/taglib/mpeg/id3v2/frames/textidentificationframe.cpp 2013-01-29 12:45:48.000000000 +0100
@@ -187,12 +187,12 @@
// read the string data type (the first byte of the field data)
- d->textEncoding = String::Type(data[0]);
+ d->textEncoding = String::ID3Type(data[0]);
// split the byte array into chunks based on the string type (two byte delimiter
// for unicode encodings)
- int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2;
+ int byteAlign = (d->textEncoding == String::Latin1 || d->textEncoding == String::Latin1ID3 || d->textEncoding == String::Latin1ID3V2 || d->textEncoding == String::UTF8) ? 1 : 2;
// build a small counter to strip nulls off the end of the field
@@ -223,11 +223,14 @@
ByteVector TextIdentificationFrame::renderFields() const
{
- String::Type encoding = checkTextEncoding(d->fieldList, d->textEncoding);
+ String::Type encoding = d->textEncoding;
+
+ encoding = String::ID3WType(encoding);
+ encoding = checkTextEncoding(d->fieldList, encoding);
ByteVector v;
- v.append(char(encoding));
+ v.append(char(String::ID3RealType(encoding)));
for(StringList::ConstIterator it = d->fieldList.begin(); it != d->fieldList.end(); it++) {
diff -dPNur taglib-1.8/taglib/toolkit/rccpatch.cpp taglib-1.8-ds/taglib/toolkit/rccpatch.cpp
--- taglib-1.8/taglib/toolkit/rccpatch.cpp 1970-01-01 01:00:00.000000000 +0100
+++ taglib-1.8-ds/taglib/toolkit/rccpatch.cpp 2013-01-29 12:35:45.000000000 +0100
@@ -0,0 +1,192 @@
+#include <stdlib.h>
+
+#include <string>
@ -182,8 +211,8 @@ index 0000000..eadbcb1
+void rccPatchSetContext(void *newctx) {
+#ifdef HAVE_LIBRCC
+ if (newctx) {
+ ctx = (rcc_context)newctx;
+ rcc_initialized = 1;
+ ctx = (rcc_context)newctx;
+ rcc_initialized = 1;
+ }
+#endif /* HAVE_LIBRCC */
+}
@ -191,8 +220,8 @@ index 0000000..eadbcb1
+static void rccPatchTryInit() {
+#ifdef HAVE_LIBRCC
+ if (!rcc_initialized) {
+ rccPatchInit();
+ if (rcc_initialized) atexit(rccPatchFree);
+ rccPatchInit();
+ if (rcc_initialized) atexit(rccPatchFree);
+ }
+#endif /* HAVE_LIBRCC */
+}
@ -213,7 +242,7 @@ index 0000000..eadbcb1
+ return v;
+#else
+ v.setData("", 0);
+
+
+ return v;
+#endif /* HAVE_LIBRCC */
+}
@ -233,7 +262,7 @@ index 0000000..eadbcb1
+ return v;
+#else
+ v.setData("", 0);
+
+
+ return v;
+#endif /* HAVE_LIBRCC */
+}
@ -248,14 +277,11 @@ index 0000000..eadbcb1
+
+ res = rccSizedRecode(ctx, OUT_CLASS, UTF_CLASS, s.c_str(), s.length(), &rlen);
+ if (res) v.setData(res, rlen);
+ else v.setData(s.c_str(), s.length());
+
+ return v;
+#else
+ v.setData("", 0);
+
+ return v;
+ else
+#endif /* HAVE_LIBRCC */
+ v.setData("", 0);
+
+ return v;
+}
+
+TagLib::ByteVector rccPatchRecodeInputID3(const std::string &s, bool v2 = false) {
@ -268,14 +294,11 @@ index 0000000..eadbcb1
+
+ res = rccSizedRecode(ctx, v2?ID3V2_CLASS:ID3_CLASS, UTF_CLASS, s.c_str(), s.length(), &rlen);
+ if (res) v.setData(res, rlen);
+ else v.setData(s.c_str(), s.length());
+
+ return v;
+#else
+ else
+#endif /* HAVE_LIBRCC */
+ v.setData("", 0);
+
+ return v;
+#endif /* HAVE_LIBRCC */
+}
+
+TagLib::String::Type rccPatchGetLocaleType() {
@ -284,17 +307,17 @@ index 0000000..eadbcb1
+ char charset[32];
+
+ rccPatchTryInit();
+
+
+ if (!rccLocaleGetCharset(charset, NULL, 31)) {
+ if (!strncmp(charset, "UTF", 3)) {
+ len = strlen(charset);
+
+ if (charset[len-1]=='8') return TagLib::String::UTF8;
+ if (!strcmp(charset+(len-2),"16")) return TagLib::String::UTF16;
+ if (!strcmp(charset+(len-4),"16LE")) return TagLib::String::UTF16LE;
+ if (!strcmp(charset+(len-4),"16BE")) return TagLib::String::UTF16BE;
+ }
+ return TagLib::String::Latin1;
+ if (!strncmp(charset, "UTF", 3)) {
+ len = strlen(charset);
+
+ if (charset[len-1]=='8') return TagLib::String::UTF8;
+ if (!strcmp(charset+(len-2),"16")) return TagLib::String::UTF16;
+ if (!strcmp(charset+(len-4),"16LE")) return TagLib::String::UTF16LE;
+ if (!strcmp(charset+(len-4),"16BE")) return TagLib::String::UTF16BE;
+ }
+ return TagLib::String::Latin1;
+ }
+#endif /* HAVE_LIBRCC */
+ return TagLib::String::UTF8;
@ -306,27 +329,25 @@ index 0000000..eadbcb1
+ const char *charset;
+
+ rccPatchTryInit();
+
+
+ charset = rccGetCurrentCharsetName(ctx, ID3V2_CLASS);
+ if (charset) {
+ if (!strncmp(charset, "UTF", 3)) {
+ len = strlen(charset);
+
+ if (charset[len-1]=='8') return TagLib::String::UTF8;
+ if (!strcmp(charset+(len-2),"16")) return TagLib::String::UTF16;
+ if (!strcmp(charset+(len-4),"16LE")) return TagLib::String::UTF16LE;
+ if (!strcmp(charset+(len-4),"16BE")) return TagLib::String::UTF16BE;
+ }
+ return TagLib::String::Latin1ID3V2;
+ if (!strncmp(charset, "UTF", 3)) {
+ len = strlen(charset);
+
+ if (charset[len-1]=='8') return TagLib::String::UTF8;
+ if (!strcmp(charset+(len-2),"16")) return TagLib::String::UTF16;
+ if (!strcmp(charset+(len-4),"16LE")) return TagLib::String::UTF16LE;
+ if (!strcmp(charset+(len-4),"16BE")) return TagLib::String::UTF16BE;
+ }
+ return TagLib::String::Latin1ID3V2;
+ }
+#endif /* HAVE_LIBRCC */
+ return TagLib::String::Latin1;
+}
diff --git a/taglib/toolkit/rccpatch.h b/taglib/toolkit/rccpatch.h
new file mode 100644
index 0000000..9484a93
--- /dev/null
+++ b/taglib/toolkit/rccpatch.h
diff -dPNur taglib-1.8/taglib/toolkit/rccpatch.h taglib-1.8-ds/taglib/toolkit/rccpatch.h
--- taglib-1.8/taglib/toolkit/rccpatch.h 1970-01-01 01:00:00.000000000 +0100
+++ taglib-1.8-ds/taglib/toolkit/rccpatch.h 2013-01-29 12:45:48.000000000 +0100
@@ -0,0 +1,20 @@
+#ifndef _RCC_PATCH_H
+#define _RCC_PATCH_H
@ -348,10 +369,9 @@ index 0000000..9484a93
+TagLib::String::Type rccPatchGetID3Type();
+
+#endif /* _RCC_PATCH_H */
diff --git a/taglib/toolkit/tstring.cpp b/taglib/toolkit/tstring.cpp
index 292f353..45b7d03 100644
--- a/taglib/toolkit/tstring.cpp
+++ b/taglib/toolkit/tstring.cpp
diff -dPNur taglib-1.8/taglib/toolkit/tstring.cpp taglib-1.8-ds/taglib/toolkit/tstring.cpp
--- taglib-1.8/taglib/toolkit/tstring.cpp 2012-09-06 20:03:15.000000000 +0200
+++ taglib-1.8-ds/taglib/toolkit/tstring.cpp 2013-01-29 12:46:14.000000000 +0100
@@ -23,6 +23,7 @@
* http://www.mozilla.org/MPL/ *
***************************************************************************/
@ -360,7 +380,7 @@ index 292f353..45b7d03 100644
#include "tstring.h"
#include "unicode.h"
#include "tdebug.h"
@@ -168,7 +169,7 @@ String::String(const ByteVector &v, Type t)
@@ -168,7 +169,7 @@
if(v.isEmpty())
return;
@ -369,7 +389,7 @@ index 292f353..45b7d03 100644
int length = 0;
d->data.resize(v.size());
@@ -397,10 +398,21 @@ ByteVector String::data(Type t) const
@@ -397,10 +398,21 @@
{
ByteVector v;
@ -388,11 +408,11 @@ index 292f353..45b7d03 100644
+ else /* if (t == Latin1(Locale) */ v = rccPatchRecodeOutput(s);
+
+ if (v.size()) return v;
+
+
for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++)
v.append(char(*it));
break;
@@ -750,6 +762,31 @@ void String::detach()
@@ -750,6 +762,30 @@
void String::prepare(Type t)
{
@ -405,26 +425,25 @@ index 292f353..45b7d03 100644
+ if (t == Latin1ID3) v = rccPatchRecodeInputID3(s, false);
+ else if (t == Latin1ID3V2) v = rccPatchRecodeInputID3(s, true);
+ else /* Latin1 converted from Locale */ v = rccPatchRecodeInput(s);
+
+
+ if (v.size()) {
+ int length = 0;
+ d->data.resize(v.size());
+ wstring::iterator targetIt = d->data.begin();
+ for(ByteVector::ConstIterator it = v.begin(); it != v.end() && (*it); ++it) {
+ *targetIt = uchar(*it);
+ ++targetIt;
+ ++length;
+ }
+ d->data.resize(length);
+ int length = 0;
+ d->data.resize(v.size());
+ wstring::iterator targetIt = d->data.begin();
+ for(ByteVector::ConstIterator it = v.begin(); it != v.end() && (*it); ++it) {
+ *targetIt = uchar(*it);
+ ++targetIt;
+ ++length;
+ }
+ d->data.resize(length);
+ t = UTF8;
+ }
+
+ t = UTF8;
+ }
+
switch(t) {
case UTF16:
{
@@ -839,6 +876,27 @@ const TagLib::String operator+(const TagLib::String &s1, const char *s2)
@@ -839,6 +875,27 @@
std::ostream &operator<<(std::ostream &s, const String &str)
{
@ -435,17 +454,17 @@ index 292f353..45b7d03 100644
}
+
+String::Type String::ID3Type(int i) {
+ if (i == Latin1) return Latin1ID3V2;
+ return Type(i);
+ if (i == Latin1) return Latin1ID3V2;
+ return Type(i);
+};
+
+String::Type String::ID3WType(Type type) {
+ Type rcc_type = rccPatchGetID3Type();
+ if ((rcc_type == Latin1ID3)||(rcc_type == Latin1ID3V2)) {
+ if (type == Latin1) return rcc_type;
+ return type;
+ if (type == Latin1) return rcc_type;
+ return type;
+ }
+
+
+ return rcc_type;
+};
+
@ -453,11 +472,10 @@ index 292f353..45b7d03 100644
+ if ((type == Latin1ID3)||(type == Latin1ID3V2)) return Latin1;
+ return type;
+}
diff --git a/taglib/toolkit/tstring.h b/taglib/toolkit/tstring.h
index 759a175..af38090 100644
--- a/taglib/toolkit/tstring.h
+++ b/taglib/toolkit/tstring.h
@@ -90,6 +90,18 @@ namespace TagLib {
diff -dPNur taglib-1.8/taglib/toolkit/tstring.h taglib-1.8-ds/taglib/toolkit/tstring.h
--- taglib-1.8/taglib/toolkit/tstring.h 2012-09-06 20:03:15.000000000 +0200
+++ taglib-1.8-ds/taglib/toolkit/tstring.h 2013-01-29 12:45:48.000000000 +0100
@@ -90,6 +90,18 @@
*/
enum Type {
/*!
@ -476,7 +494,7 @@ index 759a175..af38090 100644
* IS08859-1, or <i>Latin1</i> encoding. 8 bit characters.
*/
Latin1 = 0,
@@ -112,6 +124,10 @@ namespace TagLib {
@@ -112,6 +124,10 @@
UTF16LE = 4
};

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Mon Feb 4 19:50:45 UTC 2013 - hessijames@gmail.com
- Replace taglib-1.6-ds-rusxmms.patch with
taglib-1.8-ds-rusxmms-r2.patch: Update rusxmms patch to also work
with non-Russian locale (bnc#780256).
-------------------------------------------------------------------
Mon Feb 4 19:50:45 UTC 2013 - hessijames@gmail.com
- Update rusxmms patch to version taglib-1.8-ds-rusxmms-r2 in order to fix bnc#780256
-------------------------------------------------------------------
Fri Feb 1 18:54:07 UTC 2013 - coolo@suse.com

View File

@ -26,7 +26,7 @@ Url: http://ktown.kde.org/~wheeler/taglib/
Source0: https://github.com/downloads/taglib/taglib/%{name}-%{version}.tar.gz
Source1: %{name}.desktop
Source100: baselibs.conf
Patch0: taglib-1.6-ds-rusxmms.patch
Patch0: taglib-1.8-ds-rusxmms-r2.patch
Patch1: taglib-1.7.2-doxygen.patch
# PATCH-FIX-UPSTREAM taglib-1.8-version_fix.patch - fix version defines in taglib.h
Patch2: taglib-1.8-version_fix.patch