changeset 30065:d5d20b8256b7

Some ugly hacks to make compiling against a newer external version of libass work.
author reimar
date Thu, 24 Dec 2009 10:51:24 +0000
parents 73a32da1ef18
children a2e4fd61dc4a
files libass/ass_mp.c libass/ass_mp.h libmpcodecs/vf_ass.c libmpcodecs/vf_vo.c libvo/video_out.h libvo/vo_gl.c libvo/vo_vdpau.c mpcommon.h
diffstat 8 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass_mp.c	Thu Dec 24 10:45:05 2009 +0000
+++ b/libass/ass_mp.c	Thu Dec 24 10:51:24 2009 +0000
@@ -27,10 +27,7 @@
 #include "mp_msg.h"
 #include "get_path.h"
 
-#include "ass.h"
-#include "ass_utils.h"
 #include "ass_mp.h"
-#include "ass_library.h"
 
 #ifdef CONFIG_FONTCONFIG
 #include <fontconfig/fontconfig.h>
@@ -243,10 +240,14 @@
 	else if (font_fontconfig >= 0 && font_name) family = strdup(font_name);
 	else family = 0;
 
+#if defined(LIBASS_VERSION) && LIBASS_VERSION >= 0x00908000
+        ass_set_fonts(priv, path, family, font_fontconfig, NULL, 1);
+#else
 	if (font_fontconfig >= 0)
 		ass_set_fonts(priv, path, family);
 	else
 		ass_set_fonts_nofc(priv, path, family);
+#endif
 
 	free(dir);
 	free(path);
--- a/libass/ass_mp.h	Thu Dec 24 10:45:05 2009 +0000
+++ b/libass/ass_mp.h	Thu Dec 24 10:51:24 2009 +0000
@@ -29,6 +29,15 @@
 #else
 #include <ass/ass.h>
 #endif
+#if defined(LIBASS_VERSION) && LIBASS_VERSION >= 0x00908000
+#define ass_library_t ASS_Library
+#define ass_track_t ASS_Track
+#define ass_track_s ASS_Track
+#define ass_renderer_t ASS_Renderer
+#define ass_image_t ASS_Image
+#define ass_style_t ASS_Style
+#define ass_event_t ASS_Event
+#endif
 
 extern ass_library_t* ass_library;
 extern int ass_enabled;
--- a/libmpcodecs/vf_ass.c	Thu Dec 24 10:45:05 2009 +0000
+++ b/libmpcodecs/vf_ass.c	Thu Dec 24 10:51:24 2009 +0000
@@ -94,7 +94,11 @@
 
 	if (vf->priv->ass_priv) {
 		ass_configure(vf->priv->ass_priv, vf->priv->outw, vf->priv->outh, 0);
+#if defined(LIBASS_VERSION) && LIBASS_VERSION >= 0x00908000
+		ass_set_aspect_ratio(vf->priv->ass_priv, ((double)d_width) / d_height, ((double)width) / height);
+#else
 		ass_set_aspect_ratio(vf->priv->ass_priv, ((double)d_width) / d_height);
+#endif
 	}
 
 	return vf_next_config(vf, vf->priv->outw, vf->priv->outh, d_width, d_height, flags, outfmt);
--- a/libmpcodecs/vf_vo.c	Thu Dec 24 10:45:05 2009 +0000
+++ b/libmpcodecs/vf_vo.c	Thu Dec 24 10:51:24 2009 +0000
@@ -132,7 +132,11 @@
             if (video_out->control(VOCTRL_GET_EOSD_RES, &res) == VO_TRUE) {
                 ass_set_frame_size(vf->priv->ass_priv, res.w, res.h);
                 ass_set_margins(vf->priv->ass_priv, res.mt, res.mb, res.ml, res.mr);
+#if defined(LIBASS_VERSION) && LIBASS_VERSION >= 0x00908000
+                ass_set_aspect_ratio(vf->priv->ass_priv, (double)res.w / res.h, (double)res.srcw/res.srch);
+#else
                 ass_set_aspect_ratio(vf->priv->ass_priv, (double)res.w / res.h);
+#endif
             }
 
             images.imgs = ass_mp_render_frame(vf->priv->ass_priv, ass_track, (pts+sub_delay) * 1000 + .5, &images.changed);
--- a/libvo/video_out.h	Thu Dec 24 10:45:05 2009 +0000
+++ b/libvo/video_out.h	Thu Dec 24 10:51:24 2009 +0000
@@ -74,6 +74,7 @@
 #define VOCTRL_GET_EOSD_RES 29
 typedef struct {
   int w, h; // screen dimensions, including black borders
+  int srcw, srch; // unscaled source dimensions
   int mt, mb, ml, mr; // borders (top, bottom, left, right)
 } mp_eosd_res_t;
 
--- a/libvo/vo_gl.c	Thu Dec 24 10:45:05 2009 +0000
+++ b/libvo/vo_gl.c	Thu Dec 24 10:51:24 2009 +0000
@@ -1156,6 +1156,7 @@
     {
       mp_eosd_res_t *r = data;
       r->w = vo_dwidth; r->h = vo_dheight;
+      r->srcw = image_width; r->srch = image_height;
       r->mt = r->mb = r->ml = r->mr = 0;
       if (scaled_osd) {r->w = image_width; r->h = image_height;}
       else if (aspect_scaling()) {
--- a/libvo/vo_vdpau.c	Thu Dec 24 10:45:05 2009 +0000
+++ b/libvo/vo_vdpau.c	Thu Dec 24 10:51:24 2009 +0000
@@ -1400,6 +1400,7 @@
     case VOCTRL_GET_EOSD_RES: {
         mp_eosd_res_t *r = data;
         r->mt = r->mb = r->ml = r->mr = 0;
+        r->srcw = vid_width; r->srch = vid_height;
         if (vo_fs) {
             r->w = vo_screenwidth;
             r->h = vo_screenheight;
--- a/mpcommon.h	Thu Dec 24 10:45:05 2009 +0000
+++ b/mpcommon.h	Thu Dec 24 10:51:24 2009 +0000
@@ -4,9 +4,10 @@
 #include "subreader.h"
 #include "libmpdemux/demuxer.h"
 #include "libmpdemux/stheader.h"
+#include "libass/ass_mp.h"
 
 extern double sub_last_pts;
-extern struct ass_track_s *ass_track;
+extern ass_track_t *ass_track;
 extern subtitle *vo_sub_last;
 
 void print_version(const char* name);