[MPlayer-cvslog] r34430 - in trunk: configure libass/ass_shaper.c libass/ass_shaper.h

reimar subversion at mplayerhq.hu
Sun Dec 11 16:13:39 CET 2011


Author: reimar
Date: Sun Dec 11 16:13:39 2011
New Revision: 34430

Log:
Allow compiling libass without fribidi again.

Modified:
   trunk/configure
   trunk/libass/ass_shaper.c
   trunk/libass/ass_shaper.h

Modified: trunk/configure
==============================================================================
--- trunk/configure	Sun Dec 11 15:54:56 2011	(r34429)
+++ trunk/configure	Sun Dec 11 16:13:39 2011	(r34430)
@@ -5963,8 +5963,8 @@ echores "$_fribidi"
 
 
 echocheck "SSA/ASS support"
-# libass depends on FreeType and FriBiDi
-if test "$_freetype" = no || test "$_fribidi" = no ; then
+# libass depends on FreeType
+if test "$_freetype" = no ; then
     _ass=no
     ass_internal=no
     res_comment="FreeType and FriBiDi support needed"

Modified: trunk/libass/ass_shaper.c
==============================================================================
--- trunk/libass/ass_shaper.c	Sun Dec 11 15:54:56 2011	(r34429)
+++ trunk/libass/ass_shaper.c	Sun Dec 11 16:13:39 2011	(r34430)
@@ -18,7 +18,9 @@
 
 #include "config.h"
 
+#ifdef CONFIG_FRIBIDI
 #include <fribidi/fribidi.h>
+#endif
 
 #include "ass_shaper.h"
 #include "ass_render.h"
@@ -43,9 +45,11 @@ struct ass_shaper {
 
     // FriBidi log2vis
     int n_glyphs;
+#ifdef CONFIG_FRIBIDI
     FriBidiChar *event_text;
     FriBidiCharType *ctypes;
     FriBidiLevel *emblevels;
+#endif
     FriBidiStrIndex *cmap;
     FriBidiParType base_direction;
 
@@ -79,8 +83,10 @@ struct ass_shaper_font_data {
  */
 void ass_shaper_info(ASS_Library *lib)
 {
-    ass_msg(lib, MSGL_V, "Shaper: FriBidi "
-            FRIBIDI_VERSION " (SIMPLE)"
+    ass_msg(lib, MSGL_V, "Shaper:"
+#ifdef CONFIG_FRIBIDI
+            " FriBidi " FRIBIDI_VERSION " (SIMPLE)"
+#endif
 #ifdef CONFIG_HARFBUZZ
             " HarfBuzz-ng %s (COMPLEX)", hb_version_string()
 #endif
@@ -94,9 +100,11 @@ void ass_shaper_info(ASS_Library *lib)
 static void check_allocations(ASS_Shaper *shaper, size_t new_size)
 {
     if (new_size > shaper->n_glyphs) {
+#ifdef CONFIG_FRIBIDI
         shaper->event_text = realloc(shaper->event_text, sizeof(FriBidiChar) * new_size);
         shaper->ctypes     = realloc(shaper->ctypes, sizeof(FriBidiCharType) * new_size);
         shaper->emblevels  = realloc(shaper->emblevels, sizeof(FriBidiLevel) * new_size);
+#endif
         shaper->cmap       = realloc(shaper->cmap, sizeof(FriBidiStrIndex) * new_size);
     }
 }
@@ -110,9 +118,11 @@ void ass_shaper_free(ASS_Shaper *shaper)
     ass_cache_done(shaper->metrics_cache);
     free(shaper->features);
 #endif
+#ifdef CONFIG_FRIBIDI
     free(shaper->event_text);
     free(shaper->ctypes);
     free(shaper->emblevels);
+#endif
     free(shaper->cmap);
     free(shaper);
 }
@@ -493,6 +503,7 @@ static void shape_harfbuzz(ASS_Shaper *s
 }
 #endif
 
+#ifdef CONFIG_FRIBIDI
 /**
  * \brief Shape event text with FriBidi. Does mirroring and simple
  * Arabic shaping.
@@ -519,6 +530,7 @@ static void shape_fribidi(ASS_Shaper *sh
 
     free(joins);
 }
+#endif
 
 /**
  * \brief Toggle kerning for HarfBuzz shaping.
@@ -595,6 +607,9 @@ void ass_shaper_set_level(ASS_Shaper *sh
  */
 void ass_shaper_shape(ASS_Shaper *shaper, TextInfo *text_info)
 {
+#ifndef CONFIG_FRIBIDI
+    check_allocations(shaper, text_info->length);
+#else
     int i, last_break;
     FriBidiParType dir;
     GlyphInfo *glyphs = text_info->glyphs;
@@ -645,6 +660,7 @@ void ass_shaper_shape(ASS_Shaper *shaper
             glyphs[i].skip++;
         }
     }
+#endif
 }
 
 /**
@@ -655,7 +671,9 @@ ASS_Shaper *ass_shaper_new(size_t preall
 {
     ASS_Shaper *shaper = calloc(sizeof(*shaper), 1);
 
+#ifdef CONFIG_FRIBIDI
     shaper->base_direction = FRIBIDI_PAR_ON;
+#endif
     check_allocations(shaper, prealloc);
 
 #ifdef CONFIG_HARFBUZZ
@@ -697,6 +715,7 @@ FriBidiStrIndex *ass_shaper_reorder(ASS_
     for (i = 0; i < text_info->length; i++)
         shaper->cmap[i] = i;
 
+#ifdef CONFIG_FRIBIDI
     // Create reorder map line-by-line
     for (i = 0; i < text_info->n_lines; i++) {
         LineInfo *line = text_info->lines + i;
@@ -708,6 +727,7 @@ FriBidiStrIndex *ass_shaper_reorder(ASS_
                 shaper->emblevels + line->offset, NULL,
                 shaper->cmap + line->offset);
     }
+#endif
 
     return shaper->cmap;
 }
@@ -721,6 +741,7 @@ FriBidiStrIndex *ass_shaper_reorder(ASS_
  */
 FriBidiParType resolve_base_direction(int enc)
 {
+#ifdef CONFIG_FRIBIDI
     switch (enc) {
         case 1:
             return FRIBIDI_PAR_ON;
@@ -730,4 +751,7 @@ FriBidiParType resolve_base_direction(in
         default:
             return FRIBIDI_PAR_LTR;
     }
+#else
+    return 0;
+#endif
 }

Modified: trunk/libass/ass_shaper.h
==============================================================================
--- trunk/libass/ass_shaper.h	Sun Dec 11 15:54:56 2011	(r34429)
+++ trunk/libass/ass_shaper.h	Sun Dec 11 16:13:39 2011	(r34430)
@@ -21,7 +21,12 @@
 
 #include "config.h"
 
+#ifdef CONFIG_FRIBIDI
 #include <fribidi/fribidi.h>
+#else
+typedef int FriBidiParType;
+typedef int FriBidiStrIndex;
+#endif
 #include "ass_render.h"
 
 void ass_shaper_info(ASS_Library *lib);


More information about the MPlayer-cvslog mailing list