From df720b521816da07d6f094b82eacd9de92cc2954 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Thu, 8 Feb 2024 11:24:22 -0600 Subject: sd_lavc: support secondary subs properly Before 3250f6e4473b6c0ba1be03af3c80f3141b485721, secondary subtitles didn't work properly with sd_lavc at all. They would render but be in the same position as the primary subtitles. sd_ass used SD_CTRL_SET_TOP to specifically place secondary subtitles in a different spot, but it was unused by sd_lavc. With that above mentioned commit, it became possible to distinguish between the position of primary and secondary subtitles via mpv's option system. sd_lavc was missed however because at the time we simply didn't realize this could work and was actually simple. With some subsequent refactoring that happened later, the fix is to just use the correct sd->order when accessing the shared subtitle options instead of hard coding 0. Fixes #13440. --- sub/sd_lavc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sub/sd_lavc.c') diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index b6e0ffea3e..988f6e088d 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -454,8 +454,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 (shared_opts->sub_pos[0] != 100.0f && shared_opts->ass_style_override[0]) { - float offset = (100.0f - shared_opts->sub_pos[0]) / 100.0f * h; + if (shared_opts->sub_pos[sd->order] != 100.0f && shared_opts->ass_style_override[sd->order]) { + float offset = (100.0f - shared_opts->sub_pos[sd->order]) / 100.0f * h; for (int n = 0; n < res->num_parts; n++) { struct sub_bitmap *sub = &res->parts[n]; @@ -473,7 +473,7 @@ static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res d, osd_rescale_bitmaps(res, w, h, d, video_par); - if (opts->sub_scale != 1.0 && shared_opts->ass_style_override[0]) { + if (opts->sub_scale != 1.0 && shared_opts->ass_style_override[sd->order]) { for (int n = 0; n < res->num_parts; n++) { struct sub_bitmap *sub = &res->parts[n]; -- cgit v1.2.3