diff --git a/libass/ass_mp.c b/libass/ass_mp.c index 3e56ccb295..290f383786 100644 --- a/libass/ass_mp.c +++ b/libass/ass_mp.c @@ -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 @@ -243,10 +240,14 @@ void ass_configure_fonts(ass_renderer_t* priv) { 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); diff --git a/libass/ass_mp.h b/libass/ass_mp.h index fb99386351..47c683c5fd 100644 --- a/libass/ass_mp.h +++ b/libass/ass_mp.h @@ -29,6 +29,15 @@ #else #include #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; diff --git a/libmpcodecs/vf_ass.c b/libmpcodecs/vf_ass.c index 6e524dcd84..3f5d6e352e 100644 --- a/libmpcodecs/vf_ass.c +++ b/libmpcodecs/vf_ass.c @@ -94,7 +94,11 @@ static int config(struct vf_instance_s* vf, 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); diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c index e31e5c545b..7960c3ded2 100644 --- a/libmpcodecs/vf_vo.c +++ b/libmpcodecs/vf_vo.c @@ -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) { 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); diff --git a/libvo/video_out.h b/libvo/video_out.h index b143ff5554..b9380fadf1 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -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; diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 5aa10bf71e..5e35f79f99 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -1156,6 +1156,7 @@ static int control(uint32_t request, void *data, ...) { 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()) { diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c index 6c68210386..2ee7cccf9b 100644 --- a/libvo/vo_vdpau.c +++ b/libvo/vo_vdpau.c @@ -1400,6 +1400,7 @@ static int control(uint32_t request, void *data, ...) 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; diff --git a/mpcommon.h b/mpcommon.h index 486faa7012..6137c72e4f 100644 --- a/mpcommon.h +++ b/mpcommon.h @@ -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);