diff options
Diffstat (limited to 'libmpcodecs')
-rw-r--r-- | libmpcodecs/vf.h | 4 | ||||
-rw-r--r-- | libmpcodecs/vf_ass.c | 12 | ||||
-rw-r--r-- | libmpcodecs/vf_vo.c | 14 |
3 files changed, 18 insertions, 12 deletions
diff --git a/libmpcodecs/vf.h b/libmpcodecs/vf.h index 0d10abd6c6..8814ffe11a 100644 --- a/libmpcodecs/vf.h +++ b/libmpcodecs/vf.h @@ -107,8 +107,8 @@ typedef struct vf_seteq_s #define VFCTRL_DRAW_EOSD 16 /* Render EOSD */ #define VFCTRL_SET_DEINTERLACE 18 /* Set deinterlacing status */ #define VFCTRL_GET_DEINTERLACE 19 /* Get deinterlacing status */ -/* Hack to make the OSD state object available to vf_expand which accesses - * the OSD state outside of normal OSD draw time. */ +/* Hack to make the OSD state object available to vf_expand and vf_ass which + * access OSD/subtitle state outside of normal OSD draw time. */ #define VFCTRL_SET_OSD_OBJ 20 #define VFCTRL_REDRAW_OSD 21 /* Change user-visible OSD immediately */ #define VFCTRL_SET_YUV_COLORSPACE 22 diff --git a/libmpcodecs/vf_ass.c b/libmpcodecs/vf_ass.c index 2678986025..f1a43b52bd 100644 --- a/libmpcodecs/vf_ass.c +++ b/libmpcodecs/vf_ass.c @@ -33,6 +33,7 @@ #include "img_format.h" #include "mp_image.h" #include "vf.h" +#include "libvo/sub.h" #include "libvo/fastmemcpy.h" @@ -59,6 +60,7 @@ static const struct vf_priv_s { // 0 = insert always int auto_insert; + struct osd_state *osd; ASS_Renderer *ass_priv; unsigned char *planes[3]; @@ -68,9 +70,7 @@ static const struct vf_priv_s { } *line_limits; } vf_priv_dflt; -extern ASS_Track *ass_track; extern float sub_delay; -extern int sub_visibility; static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, @@ -351,9 +351,10 @@ static int render_frame(struct vf_instance *vf, mp_image_t *mpi, static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { ASS_Image *images = 0; - if (sub_visibility && vf->priv->ass_priv && ass_track + if (sub_visibility && vf->priv->ass_priv && vf->priv->osd->ass_track && (pts != MP_NOPTS_VALUE)) - images = ass_mp_render_frame(vf->priv->ass_priv, ass_track, + images = ass_mp_render_frame(vf->priv->ass_priv, + vf->priv->osd->ass_track, (pts + sub_delay) * 1000 + .5, NULL); prepare_image(vf, mpi); @@ -377,6 +378,9 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) static int control(vf_instance_t *vf, int request, void *data) { switch (request) { + case VFCTRL_SET_OSD_OBJ: + vf->priv->osd = data; + break; case VFCTRL_INIT_EOSD: vf->priv->ass_priv = ass_renderer_init((ASS_Library *)data); if (!vf->priv->ass_priv) diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c index 0e8563d5a6..81dff4cea9 100644 --- a/libmpcodecs/vf_vo.c +++ b/libmpcodecs/vf_vo.c @@ -29,14 +29,11 @@ #include "libvo/video_out.h" -#ifdef CONFIG_ASS #include "ass_mp.h" -extern ASS_Track *ass_track; -#endif +#include "libvo/sub.h" //===========================================================================// -extern int sub_visibility; extern float sub_delay; struct vf_priv_s { @@ -141,10 +138,12 @@ static int control(struct vf_instance *vf, int request, void* data) } case VFCTRL_DRAW_EOSD: { + struct osd_state *osd = data; mp_eosd_images_t images = {NULL, 2}; double pts = video_out->next_pts; if (!video_out->config_ok || !vf->priv->ass_priv) return CONTROL_FALSE; - if (sub_visibility && vf->priv->ass_priv && ass_track && (pts != MP_NOPTS_VALUE)) { + if (sub_visibility && vf->priv->ass_priv && osd->ass_track + && (pts != MP_NOPTS_VALUE)) { mp_eosd_res_t res; memset(&res, 0, sizeof(res)); if (vo_control(video_out, VOCTRL_GET_EOSD_RES, &res) == VO_TRUE) { @@ -153,7 +152,10 @@ static int control(struct vf_instance *vf, int request, void* data) ass_set_aspect_ratio(vf->priv->ass_priv, vf->priv->scale_ratio, 1); } - 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, + osd->ass_track, + (pts+sub_delay) * 1000 + .5, + &images.changed); if (!vf->priv->prev_visibility) images.changed = 2; vf->priv->prev_visibility = 1; |