summaryrefslogtreecommitdiffstats
path: root/sub/subreader.c
diff options
context:
space:
mode:
Diffstat (limited to 'sub/subreader.c')
-rw-r--r--sub/subreader.c83
1 files changed, 0 insertions, 83 deletions
diff --git a/sub/subreader.c b/sub/subreader.c
index b22dfd1620..6c12ba08a4 100644
--- a/sub/subreader.c
+++ b/sub/subreader.c
@@ -47,12 +47,6 @@
#include <iconv.h>
char *sub_cp=NULL;
#endif
-#ifdef CONFIG_FRIBIDI
-#include <fribidi/fribidi.h>
-char *fribidi_charset = NULL; ///character set that will be passed to FriBiDi
-int flip_hebrew = 1; ///flip subtitles using fribidi
-int fribidi_flip_commas = 0; ///flip comma when fribidi is used
-#endif
int suboverlap_enabled = 1;
@@ -1276,71 +1270,6 @@ subtitle* subcp_recode (subtitle *sub)
}
#endif
-#ifdef CONFIG_FRIBIDI
-/**
- * Do conversion necessary for right-to-left language support via fribidi.
- * @param sub subtitle to convert
- * @param sub_utf8 whether the subtitle is encoded in UTF-8
- * @param from first new subtitle, all lines before this are assumed to be already converted
- */
-static subtitle* sub_fribidi (subtitle *sub, int sub_utf8, int from)
-{
- FriBidiChar logical[LINE_LEN+1], visual[LINE_LEN+1]; // Hopefully these two won't smash the stack
- char *ip = NULL, *op = NULL;
- size_t len,orig_len;
- int l=sub->lines;
- int char_set_num;
- fribidi_boolean log2vis;
- if (!flip_hebrew)
- return sub;
- fribidi_set_mirroring(1);
- fribidi_set_reorder_nsm(0);
-
- if( sub_utf8 == 0 ) {
- char_set_num = fribidi_parse_charset (fribidi_charset?fribidi_charset:"ISO8859-8");
- }else {
- char_set_num = fribidi_parse_charset ("UTF-8");
- }
- while (l > from) {
- ip = sub->text[--l];
- orig_len = len = strlen( ip ); // We assume that we don't use full unicode, only UTF-8 or ISO8859-x
- if(len > LINE_LEN) {
- mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: sub->text is longer than LINE_LEN.\n");
- l++;
- break;
- }
- len = fribidi_charset_to_unicode (char_set_num, ip, len, logical);
-#if FRIBIDI_INTERFACE_VERSION < 3
- FriBidiCharType base = fribidi_flip_commas?FRIBIDI_TYPE_ON:FRIBIDI_TYPE_L;
-#else
- FriBidiParType base = fribidi_flip_commas?FRIBIDI_TYPE_ON:FRIBIDI_TYPE_L;
-#endif
- log2vis = fribidi_log2vis (logical, len, &base,
- /* output */
- visual, NULL, NULL, NULL);
- if(log2vis) {
- len = fribidi_remove_bidi_marks (visual, len, NULL, NULL,
- NULL);
- if((op = malloc((FFMAX(2*orig_len,2*len) + 1))) == NULL) {
- mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: error allocating mem.\n");
- l++;
- break;
- }
- fribidi_unicode_to_charset ( char_set_num, visual, len,op);
- free (ip);
- sub->text[l] = op;
- }
- }
- if (!from && l){
- for (l = sub->lines; l;)
- free (sub->text[--l]);
- return ERR;
- }
- return sub;
-}
-
-#endif
-
static void adjust_subs_time(subtitle* sub, float subtime, float fps, int block,
int sub_num, int sub_uses_time) {
int n,m;
@@ -1564,12 +1493,6 @@ sub_data* sub_read_file(char *filename, float fps, struct MPOpts *opts)
#ifdef CONFIG_ICONV
if ((sub!=ERR) && sub_utf8 == 2) sub=subcp_recode(sub);
#endif
-#ifdef CONFIG_FRIBIDI
- /* Libass has its own BiDi handling now, and running this before
- * giving the subtitle to libass would only break things. */
- if (sub != ERR && !opts->ass_enabled)
- sub = sub_fribidi(sub, sub_utf8, 0);
-#endif
if ( sub == ERR )
{
#ifdef CONFIG_ICONV
@@ -2157,9 +2080,6 @@ void sub_add_text(subtitle *sub, const char *txt, int len, double endpts) {
int double_newline = 1; // ignore newlines at the beginning
int i, pos;
char *buf;
-#ifdef CONFIG_FRIBIDI
- int orig_lines = sub->lines;
-#endif
if (sub->lines >= SUB_MAX_TEXT) return;
pos = 0;
buf = malloc(MAX_SUBLINE + 1);
@@ -2204,9 +2124,6 @@ void sub_add_text(subtitle *sub, const char *txt, int len, double endpts) {
if (sub->lines < SUB_MAX_TEXT &&
strlen(sub->text[sub->lines]))
sub->lines++;
-#ifdef CONFIG_FRIBIDI
- sub = sub_fribidi(sub, sub_utf8, orig_lines);
-#endif
}
/**