Some ugly hacks to make compiling against a newer external version of libass work.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30107 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2009-12-24 10:51:24 +00:00
parent 1414f844c5
commit 6023874828
8 changed files with 26 additions and 4 deletions

View File

@ -27,10 +27,7 @@
#include "mp_msg.h" #include "mp_msg.h"
#include "get_path.h" #include "get_path.h"
#include "ass.h"
#include "ass_utils.h"
#include "ass_mp.h" #include "ass_mp.h"
#include "ass_library.h"
#ifdef CONFIG_FONTCONFIG #ifdef CONFIG_FONTCONFIG
#include <fontconfig/fontconfig.h> #include <fontconfig/fontconfig.h>
@ -243,10 +240,14 @@ void ass_configure_fonts(ass_renderer_t* priv) {
else if (font_fontconfig >= 0 && font_name) family = strdup(font_name); else if (font_fontconfig >= 0 && font_name) family = strdup(font_name);
else family = 0; 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) if (font_fontconfig >= 0)
ass_set_fonts(priv, path, family); ass_set_fonts(priv, path, family);
else else
ass_set_fonts_nofc(priv, path, family); ass_set_fonts_nofc(priv, path, family);
#endif
free(dir); free(dir);
free(path); free(path);

View File

@ -29,6 +29,15 @@
#else #else
#include <ass/ass.h> #include <ass/ass.h>
#endif #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 ass_library_t* ass_library;
extern int ass_enabled; extern int ass_enabled;

View File

@ -94,7 +94,11 @@ static int config(struct vf_instance_s* vf,
if (vf->priv->ass_priv) { if (vf->priv->ass_priv) {
ass_configure(vf->priv->ass_priv, vf->priv->outw, vf->priv->outh, 0); 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); 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); return vf_next_config(vf, vf->priv->outw, vf->priv->outh, d_width, d_height, flags, outfmt);

View File

@ -132,7 +132,11 @@ static int control(struct vf_instance_s* vf, int request, void* data)
if (video_out->control(VOCTRL_GET_EOSD_RES, &res) == VO_TRUE) { 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_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); 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); 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); images.imgs = ass_mp_render_frame(vf->priv->ass_priv, ass_track, (pts+sub_delay) * 1000 + .5, &images.changed);

View File

@ -74,6 +74,7 @@
#define VOCTRL_GET_EOSD_RES 29 #define VOCTRL_GET_EOSD_RES 29
typedef struct { typedef struct {
int w, h; // screen dimensions, including black borders int w, h; // screen dimensions, including black borders
int srcw, srch; // unscaled source dimensions
int mt, mb, ml, mr; // borders (top, bottom, left, right) int mt, mb, ml, mr; // borders (top, bottom, left, right)
} mp_eosd_res_t; } mp_eosd_res_t;

View File

@ -1156,6 +1156,7 @@ static int control(uint32_t request, void *data, ...)
{ {
mp_eosd_res_t *r = data; mp_eosd_res_t *r = data;
r->w = vo_dwidth; r->h = vo_dheight; 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; r->mt = r->mb = r->ml = r->mr = 0;
if (scaled_osd) {r->w = image_width; r->h = image_height;} if (scaled_osd) {r->w = image_width; r->h = image_height;}
else if (aspect_scaling()) { else if (aspect_scaling()) {

View File

@ -1400,6 +1400,7 @@ static int control(uint32_t request, void *data, ...)
case VOCTRL_GET_EOSD_RES: { case VOCTRL_GET_EOSD_RES: {
mp_eosd_res_t *r = data; mp_eosd_res_t *r = data;
r->mt = r->mb = r->ml = r->mr = 0; r->mt = r->mb = r->ml = r->mr = 0;
r->srcw = vid_width; r->srch = vid_height;
if (vo_fs) { if (vo_fs) {
r->w = vo_screenwidth; r->w = vo_screenwidth;
r->h = vo_screenheight; r->h = vo_screenheight;

View File

@ -4,9 +4,10 @@
#include "subreader.h" #include "subreader.h"
#include "libmpdemux/demuxer.h" #include "libmpdemux/demuxer.h"
#include "libmpdemux/stheader.h" #include "libmpdemux/stheader.h"
#include "libass/ass_mp.h"
extern double sub_last_pts; extern double sub_last_pts;
extern struct ass_track_s *ass_track; extern ass_track_t *ass_track;
extern subtitle *vo_sub_last; extern subtitle *vo_sub_last;
void print_version(const char* name); void print_version(const char* name);