summaryrefslogtreecommitdiffstats
path: root/sub/sd_lavc.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-12-13 15:36:58 -0600
committerDudemanguy <random342@airmail.cc>2023-12-16 15:25:32 +0000
commitb0f31a76376cae73506e3969dff805de8a18b198 (patch)
treee3771b0debf9d881539ca6889262ddb982ad4921 /sub/sd_lavc.c
parentace2d6506f20dfc6a30d0bbb6cfb959f2144bfc9 (diff)
downloadmpv-b0f31a76376cae73506e3969dff805de8a18b198.tar.bz2
mpv-b0f31a76376cae73506e3969dff805de8a18b198.tar.xz
player: refactor secondary subtitle options and properties
Over the years, we've accumulated several secondary subtitle related options and properties, but the implementation was not really consistent and it wasn't clear what the right process for adding more should be. So to make things nicer, let's refactor all of the subtitle options with secondary variants (sub-delay, sub-pos, and sub-visibility) and split them off to a new, separate struct. All of the underlying values are stored in an array instead for simplicity. Additionally, the implementation of some secondary-sub-* properties were slightly changed so there would be less redundancy.
Diffstat (limited to 'sub/sd_lavc.c')
-rw-r--r--sub/sd_lavc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index 5bf887dad0..4f43a1d6d8 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -403,6 +403,7 @@ static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res d,
{
struct sd_lavc_priv *priv = sd->priv;
struct mp_subtitle_opts *opts = sd->opts;
+ struct mp_subtitle_shared_opts *shared_opts = sd->shared_opts;
priv->current_pts = pts;
@@ -450,8 +451,8 @@ static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res d,
h = MPMAX(priv->video_params.h, current->src_h);
}
- if (opts->sub_pos != 100.0f && opts->ass_style_override) {
- float offset = (100.0f - opts->sub_pos) / 100.0f * h;
+ if (shared_opts->sub_pos[0] != 100.0f && opts->ass_style_override) {
+ float offset = (100.0f - shared_opts->sub_pos[0]) / 100.0f * h;
for (int n = 0; n < res->num_parts; n++) {
struct sub_bitmap *sub = &res->parts[n];