[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],
], [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, [
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
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;
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
#include <errno.h>
#include <math.h>
-#ifdef CONFIG_ENCA
-#include <enca.h>
-#endif
-
#include "ass.h"
#ifndef SIZE_MAX
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);