summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@chown.ath.cx>2015-09-23 10:34:55 +0200
committerGrigori Goronzy <greg@chown.ath.cx>2015-09-23 10:34:55 +0200
commit3d09c609a4cf987eb5adfa73c6e20151c1345a10 (patch)
tree715888f4f92028f400771b842b14349911b6b4fc
parent0b0ce2cd0bd6448372b8ef7b9b6b18437d264546 (diff)
downloadlibass-3d09c609a4cf987eb5adfa73c6e20151c1345a10.tar.bz2
libass-3d09c609a4cf987eb5adfa73c6e20151c1345a10.tar.xz
Remove ENCA support
There is no real value in it. ENCA only works in some cases and I can't find any information about software that integrates libass which relies on it or users that rely on ENCA support in case the interface is exposed directly (e.g. in MPlayer). If there is still a wish to have charset detection integrated into libass (it is out of scope, IMHO), a better library like uchardet should be used for that.
-rw-r--r--configure.ac14
-rw-r--r--libass/ass.c29
-rw-r--r--libass/ass_utils.c44
-rw-r--r--libass/ass_utils.h9
4 files changed, 5 insertions, 91 deletions
diff --git a/configure.ac b/configure.ac
index 340e209..d090d33 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,8 +31,6 @@ AC_ARG_ENABLE([test], AS_HELP_STRING([--enable-test],
[enable test program (requires libpng) @<:@default=no@:>@]))
AC_ARG_ENABLE([profile], AS_HELP_STRING([--enable-profile],
[enable profiling program @<:@default=no@:>@]))
-AC_ARG_ENABLE([enca], AS_HELP_STRING([--disable-enca],
- [disable enca (charset autodetect) support @<:@default=check@:>@]))
AC_ARG_ENABLE([fontconfig], AS_HELP_STRING([--disable-fontconfig],
[disable fontconfig support @<:@default=enabled@:>@]))
AC_ARG_ENABLE([directwrite], AS_HELP_STRING([--disable-directwrite],
@@ -202,15 +200,6 @@ PKG_CHECK_MODULES([HARFBUZZ], harfbuzz >= 0.9.5, [
], [harfbuzz=false])
fi
-if test x$enable_enca != xno; then
-PKG_CHECK_MODULES([ENCA], enca, [
- CFLAGS="$CFLAGS $ENCA_CFLAGS"
- LIBS="$LIBS $ENCA_LIBS"
- AC_DEFINE(CONFIG_ENCA, 1, [found enca via pkg-config])
- enca=true
- ], [enca=false])
-fi
-
libpng=false
if test x$enable_test = xyes; then
PKG_CHECK_MODULES([LIBPNG], libpng >= 1.2.0, [
@@ -227,9 +216,6 @@ AM_CONDITIONAL([ENABLE_PROFILE], [test x$enable_profile = xyes])
pkg_libs="-lm"
pkg_requires="freetype2 >= 9.10.3"
pkg_requires="fribidi >= 0.19.0, ${pkg_requires}"
-if test x$enca = xtrue; then
- pkg_requires="enca, ${pkg_requires}"
-fi
if test x$fontconfig = xtrue; then
pkg_requires="fontconfig >= 2.4.2, ${pkg_requires}"
fi
diff --git a/libass/ass.c b/libass/ass.c
index e8bc843..0bb678f 100644
--- a/libass/ass.c
+++ b/libass/ass.c
@@ -941,31 +941,12 @@ static char *sub_recode(ASS_Library *library, char *data, size_t size,
char *outbuf;
assert(codepage);
- {
- const char *cp_tmp = codepage;
-#ifdef CONFIG_ENCA
- char enca_lang[3], enca_fallback[100];
- if (sscanf(codepage, "enca:%2s:%99s", enca_lang, enca_fallback) == 2
- || sscanf(codepage, "ENCA:%2s:%99s", enca_lang,
- enca_fallback) == 2) {
- cp_tmp =
- ass_guess_buffer_cp(library, (unsigned char *) data, size,
- enca_lang, enca_fallback);
- }
-#endif
- if ((icdsc = iconv_open(tocp, cp_tmp)) != (iconv_t) (-1)) {
- ass_msg(library, MSGL_V, "Opened iconv descriptor");
- } else
- ass_msg(library, MSGL_ERR, "Error opening iconv descriptor");
-#ifdef CONFIG_ENCA
- if (cp_tmp != codepage) {
- free((void*)cp_tmp);
- }
-#endif
- }
-
- if (icdsc == (iconv_t) (-1))
+ if ((icdsc = iconv_open(tocp, codepage)) != (iconv_t) (-1)) {
+ ass_msg(library, MSGL_V, "Opened iconv descriptor");
+ } else {
+ ass_msg(library, MSGL_ERR, "Error opening iconv descriptor");
return NULL;
+ }
{
size_t osize = size;
diff --git a/libass/ass_utils.c b/libass/ass_utils.c
index aca511b..ab1ea02 100644
--- a/libass/ass_utils.c
+++ b/libass/ass_utils.c
@@ -528,47 +528,3 @@ ASS_Style *lookup_style_strict(ASS_Track *track, char *name, size_t len)
return NULL;
}
-#ifdef CONFIG_ENCA
-void *ass_guess_buffer_cp(ASS_Library *library, unsigned char *buffer,
- int buflen, char *preferred_language,
- char *fallback)
-{
- const char **languages;
- size_t langcnt;
- EncaAnalyser analyser;
- EncaEncoding encoding;
- char *detected_sub_cp = NULL;
- int i;
-
- languages = enca_get_languages(&langcnt);
- ass_msg(library, MSGL_V, "ENCA supported languages");
- for (i = 0; i < langcnt; i++) {
- ass_msg(library, MSGL_V, "lang %s", languages[i]);
- }
-
- for (i = 0; i < langcnt; i++) {
- const char *tmp;
-
- if (ass_strcasecmp(languages[i], preferred_language) != 0)
- continue;
- analyser = enca_analyser_alloc(languages[i]);
- encoding = enca_analyse_const(analyser, buffer, buflen);
- tmp = enca_charset_name(encoding.charset, ENCA_NAME_STYLE_ICONV);
- if (tmp && encoding.charset != ENCA_CS_UNKNOWN) {
- detected_sub_cp = strdup(tmp);
- ass_msg(library, MSGL_INFO, "ENCA detected charset: %s", tmp);
- }
- enca_analyser_free(analyser);
- }
-
- free(languages);
-
- if (!detected_sub_cp) {
- detected_sub_cp = strdup(fallback);
- ass_msg(library, MSGL_INFO,
- "ENCA detection failed: fallback to %s", fallback);
- }
-
- return detected_sub_cp;
-}
-#endif
diff --git a/libass/ass_utils.h b/libass/ass_utils.h
index 867b3e3..c2f5a19 100644
--- a/libass/ass_utils.h
+++ b/libass/ass_utils.h
@@ -28,10 +28,6 @@
#include <errno.h>
#include <math.h>
-#ifdef CONFIG_ENCA
-#include <enca.h>
-#endif
-
#include "ass.h"
#ifndef SIZE_MAX
@@ -98,11 +94,6 @@ void ass_utf16be_to_utf8(char *dst, size_t dst_size, uint8_t *src, size_t src_si
void ass_msg(ASS_Library *priv, int lvl, const char *fmt, ...);
int lookup_style(ASS_Track *track, char *name);
ASS_Style *lookup_style_strict(ASS_Track *track, char *name, size_t len);
-#ifdef CONFIG_ENCA
-void *ass_guess_buffer_cp(ASS_Library *library, unsigned char *buffer,
- int buflen, char *preferred_language,
- char *fallback);
-#endif
/* defined in ass_strtod.c */
double ass_strtod(const char *string, char **endPtr);