summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
Diffstat (limited to 'sub')
-rw-r--r--sub/dec_sub.c3
-rw-r--r--sub/dec_sub.h1
-rw-r--r--sub/sd.h2
-rw-r--r--sub/sd_ass.c13
-rw-r--r--sub/sd_lavc.c2
5 files changed, 8 insertions, 13 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index 195a14abea..4cb2d9bb67 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -213,7 +213,6 @@ static void update_segment(struct dec_sub *sub)
talloc_free(sub->sd);
sub->sd = new;
update_subtitle_speed(sub);
- sub_control(sub, SD_CTRL_SET_TOP, &sub->order);
} else {
// We'll just keep the current decoder, and feed it possibly
// invalid data (not our fault if it crashes or something).
@@ -364,7 +363,7 @@ struct sub_bitmaps *sub_get_bitmaps(struct dec_sub *sub, struct mp_osd_res dim,
if (!(sub->end != MP_NOPTS_VALUE && pts >= sub->end) &&
sub->sd->driver->get_bitmaps)
- res = sub->sd->driver->get_bitmaps(sub->sd, dim, format, pts);
+ res = sub->sd->driver->get_bitmaps(sub->sd, dim, format, pts, sub->order);
mp_mutex_unlock(&sub->lock);
return res;
diff --git a/sub/dec_sub.h b/sub/dec_sub.h
index 9de6760ff4..8c8d7d4de5 100644
--- a/sub/dec_sub.h
+++ b/sub/dec_sub.h
@@ -17,7 +17,6 @@ struct sd;
enum sd_ctrl {
SD_CTRL_SUB_STEP,
SD_CTRL_SET_VIDEO_PARAMS,
- SD_CTRL_SET_TOP,
SD_CTRL_SET_VIDEO_DEF_FPS,
SD_CTRL_UPDATE_OPTS,
};
diff --git a/sub/sd.h b/sub/sd.h
index 11a90fe2a8..969d1dcaca 100644
--- a/sub/sd.h
+++ b/sub/sd.h
@@ -41,7 +41,7 @@ struct sd_functions {
int (*control)(struct sd *sd, enum sd_ctrl cmd, void *arg);
struct sub_bitmaps *(*get_bitmaps)(struct sd *sd, struct mp_osd_res dim,
- int format, double pts);
+ int format, double pts, int order);
char *(*get_text)(struct sd *sd, double pts, enum sd_text_type type);
struct sd_times (*get_times)(struct sd *sd, double pts);
};
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index 6742f6f658..4c1ccd05bc 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -379,7 +379,7 @@ static void decode(struct sd *sd, struct demux_packet *packet)
}
static void configure_ass(struct sd *sd, struct mp_osd_res *dim,
- bool converted, ASS_Track *track)
+ bool converted, ASS_Track *track, int order)
{
struct mp_subtitle_opts *opts = sd->opts;
struct sd_ass_priv *ctx = sd->priv;
@@ -407,7 +407,7 @@ static void configure_ass(struct sd *sd, struct mp_osd_res *dim,
set_use_margins = opts->ass_use_margins;
}
if (converted || opts->ass_style_override) {
- set_sub_pos = 100.0f - opts->sub_pos;
+ set_sub_pos = 100.0f - (order == 1 ? opts->sec_sub_pos : opts->sub_pos);
set_line_spacing = opts->ass_line_spacing;
set_hinting = opts->ass_hinting;
set_font_scale = opts->sub_scale;
@@ -557,12 +557,12 @@ static long long find_timestamp(struct sd *sd, double pts)
#undef END
static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res dim,
- int format, double pts)
+ int format, double pts, int order)
{
struct sd_ass_priv *ctx = sd->priv;
struct mp_subtitle_opts *opts = sd->opts;
bool no_ass = !opts->ass_enabled || ctx->on_top ||
- opts->ass_style_override == 5;
+ opts->ass_style_override == 5 || order == 1;
bool converted = ctx->is_converted || no_ass;
ASS_Track *track = no_ass ? ctx->shadow_track : ctx->ass_track;
ASS_Renderer *renderer = ctx->ass_renderer;
@@ -591,7 +591,7 @@ static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res dim,
scale *= par;
}
if (!ctx->ass_configured || !osd_res_equals(old_osd, ctx->osd)) {
- configure_ass(sd, &dim, converted, track);
+ configure_ass(sd, &dim, converted, track, order);
ctx->ass_configured = true;
}
ass_set_pixel_aspect(renderer, scale);
@@ -852,9 +852,6 @@ static int control(struct sd *sd, enum sd_ctrl cmd, void *arg)
case SD_CTRL_SET_VIDEO_PARAMS:
ctx->video_params = *(struct mp_image_params *)arg;
return CONTROL_OK;
- case SD_CTRL_SET_TOP:
- ctx->on_top = *(bool *)arg;
- return CONTROL_OK;
case SD_CTRL_UPDATE_OPTS: {
int flags = (uintptr_t)arg;
if (flags & UPDATE_SUB_FILT) {
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index 30aa641437..5bf887dad0 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -399,7 +399,7 @@ static struct sub *get_current(struct sd_lavc_priv *priv, double pts)
}
static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res d,
- int format, double pts)
+ int format, double pts, int order)
{
struct sd_lavc_priv *priv = sd->priv;
struct mp_subtitle_opts *opts = sd->opts;