diff options
Diffstat (limited to 'sub')
-rw-r--r-- | sub/ass_mp.c | 22 | ||||
-rw-r--r-- | sub/ass_mp.h | 9 | ||||
-rw-r--r-- | sub/dec_sub.h | 10 | ||||
-rw-r--r-- | sub/sd_ass.c | 1 | ||||
-rw-r--r-- | sub/sub.h | 9 |
5 files changed, 25 insertions, 26 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c index 8266f45d2e..202664578b 100644 --- a/sub/ass_mp.c +++ b/sub/ass_mp.c @@ -225,13 +225,14 @@ ASS_Track *mp_ass_read_stream(ASS_Library *library, const char *fname, return track; } -void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts, int w, int h, - bool unscaled) +void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts, + struct mp_eosd_res *dim, bool unscaled) { int hinting; - ass_set_frame_size(priv, w, h); - ass_set_margins(priv, opts->ass_top_margin, opts->ass_bottom_margin, 0, 0); - mp_ass_reload_options(priv, opts); + ass_set_frame_size(priv, dim->w, dim->h); + ass_set_margins(priv, dim->mt, dim->mb, dim->ml, dim->mr); + ass_set_use_margins(priv, opts->ass_use_margins); + ass_set_font_scale(priv, opts->ass_font_scale); if (!unscaled && (opts->ass_hinting & 4)) hinting = 0; else @@ -294,14 +295,3 @@ ASS_Library *mp_ass_init(struct MPOpts *opts) free(path); return priv; } - -void mp_ass_reload_options(ASS_Renderer *priv, struct MPOpts *opts) -{ - /* This could be needed for vf_ass case if the margins were actually - * runtime configurable, but would be wrong with EOSD: - * ass_set_margins(priv, opts->ass_top_margin, opts->ass_bottom_margin, - * 0, 0); - */ - ass_set_use_margins(priv, opts->ass_use_margins); - ass_set_font_scale(priv, opts->ass_font_scale); -} diff --git a/sub/ass_mp.h b/sub/ass_mp.h index a222d61bbb..095cf4311d 100644 --- a/sub/ass_mp.h +++ b/sub/ass_mp.h @@ -31,6 +31,9 @@ #include <ass/ass.h> #include <ass/ass_types.h> +struct MPOpts; +struct mp_eosd_res; + ASS_Track *mp_ass_default_track(ASS_Library *library, struct MPOpts *opts); ASS_Track *mp_ass_read_subdata(ASS_Library *library, struct MPOpts *opts, sub_data *subdata, double fps); @@ -38,13 +41,11 @@ ASS_Track *mp_ass_read_stream(ASS_Library *library, const char *fname, char *charset); struct MPOpts; -void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts, int w, int h, - bool unscaled); +void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts, + struct mp_eosd_res *dim, bool unscaled); void mp_ass_configure_fonts(ASS_Renderer *priv); ASS_Library *mp_ass_init(struct MPOpts *opts); -void mp_ass_reload_options(ASS_Renderer *priv, struct MPOpts *opts); - #else /* CONFIG_ASS */ /* Needed for EOSD code using this type to compile */ diff --git a/sub/dec_sub.h b/sub/dec_sub.h index d6fbef25f0..e58ad65550 100644 --- a/sub/dec_sub.h +++ b/sub/dec_sub.h @@ -1,6 +1,14 @@ +#ifndef MPLAYER_DEC_SUB_H +#define MPLAYER_DEC_SUB_H + struct sh_sub; struct osd_state; +typedef struct mp_eosd_res { + int w, h; // screen dimensions, including black borders + int mt, mb, ml, mr; // borders (top, bottom, left, right) +} mp_eosd_res_t; + static inline bool is_text_sub(int type) { return type == 't' || type == 'm' || type == 'a'; @@ -12,3 +20,5 @@ void sub_init(struct sh_sub *sh, struct osd_state *osd); void sub_reset(struct sh_sub *sh, struct osd_state *osd); void sub_switchoff(struct sh_sub *sh, struct osd_state *osd); void sub_uninit(struct sh_sub *sh); + +#endif diff --git a/sub/sd_ass.c b/sub/sd_ass.c index b8924fbb3f..f54c18e805 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -64,7 +64,6 @@ static int init(struct sh_sub *sh, struct osd_state *osd) assert(osd->ass_track == NULL); osd->ass_track = ctx->ass_track; osd->vsfilter_aspect = sh->type == 'a'; - osd->ass_track_changed = true; return 0; } @@ -21,6 +21,9 @@ #include <stdbool.h> +#include "subreader.h" +#include "dec_sub.h" + typedef struct mp_osd_bbox_s { int x1,y1,x2,y2; } mp_osd_bbox_t; @@ -58,14 +61,12 @@ typedef struct mp_osd_obj_s { struct osd_state { struct ass_library *ass_library; - // flag to signal reinitialization due to ass-related option changes - bool ass_force_reload; + struct ass_renderer *ass_renderer; int w, h; char *osd_text; struct ass_track *ass_track; double pts; double sub_offset; - bool ass_track_changed; bool vsfilter_aspect; struct ass_renderer *osd_render; @@ -74,8 +75,6 @@ struct osd_state { struct MPOpts *opts; }; -#include "subreader.h" - extern subtitle* vo_sub; extern int vo_osd_progbar_type; |