summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/sub.c5
-rw-r--r--sub/dec_sub.c5
-rw-r--r--sub/dec_sub.h2
3 files changed, 8 insertions, 4 deletions
diff --git a/player/sub.c b/player/sub.c
index 148109bdc9..50f3fbe2b4 100644
--- a/player/sub.c
+++ b/player/sub.c
@@ -171,7 +171,8 @@ static bool init_subdec(struct MPContext *mpctx, struct track *track)
return false;
track->d_sub = sub_create(mpctx->global, track->stream,
- get_all_attachments(mpctx));
+ get_all_attachments(mpctx),
+ get_order(mpctx, track));
if (!track->d_sub)
return false;
@@ -199,7 +200,7 @@ void reinit_sub(struct MPContext *mpctx, struct track *track)
sub_select(track->d_sub, true);
int order = get_order(mpctx, track);
osd_set_sub(mpctx->osd, order, track->d_sub);
- sub_control(track->d_sub, SD_CTRL_SET_TOP, &(bool){!!order});
+ sub_control(track->d_sub, SD_CTRL_SET_TOP, &order);
if (mpctx->playback_initialized)
update_subtitles(mpctx, mpctx->playback_pts);
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index 607b97e582..a283a5151d 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -57,6 +57,7 @@ struct dec_sub {
struct sh_stream *sh;
int play_dir;
+ int order;
double last_pkt_pts;
bool preload_attempted;
double video_fps;
@@ -161,7 +162,7 @@ static struct sd *init_decoder(struct dec_sub *sub)
// Ownership of attachments goes to the callee, and is released with
// talloc_free() (even on failure).
struct dec_sub *sub_create(struct mpv_global *global, struct sh_stream *sh,
- struct attachment_list *attachments)
+ struct attachment_list *attachments, int order)
{
assert(sh && sh->type == STREAM_SUB);
@@ -174,6 +175,7 @@ struct dec_sub *sub_create(struct mpv_global *global, struct sh_stream *sh,
.codec = sh->codec,
.attachments = talloc_steal(sub, attachments),
.play_dir = 1,
+ .order = order,
.last_pkt_pts = MP_NOPTS_VALUE,
.last_vo_pts = MP_NOPTS_VALUE,
.start = MP_NOPTS_VALUE,
@@ -210,6 +212,7 @@ 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).
diff --git a/sub/dec_sub.h b/sub/dec_sub.h
index 542c24798f..6257e74c65 100644
--- a/sub/dec_sub.h
+++ b/sub/dec_sub.h
@@ -37,7 +37,7 @@ struct attachment_list {
};
struct dec_sub *sub_create(struct mpv_global *global, struct sh_stream *sh,
- struct attachment_list *attachments);
+ struct attachment_list *attachments, int order);
void sub_destroy(struct dec_sub *sub);
bool sub_can_preload(struct dec_sub *sub);