sub: move all subtitle timestamp messing code to a central place

It was split at least across osd.c and sd_ass.c/sd_lavc.c. sd_lavc.c
actually ignored most of the more obscure subtitle timing things.
There's no reason for this - just move it all to dec_sub.c (mostly from
sd_ass.c, because it has some of the most complex stuff).

Now timestamps are transformed as they enter or leave dec_sub.c.

There appear to have been some subtle mismatches about how subtitle
timestamps were transformed, e.g. sd_functions.accepts_packet didn't
apply the subtitle speed to the timestamp. This patch should fix them,
although it's not clear if they caused actual misbehavior.

The semantics of SD_CTRL_SUB_STEP are slightly changed, which is the
reason for the changes in command.c and sd_lavc.c.
This commit is contained in:
wm4
2017-12-29 15:39:38 +01:00
committed by Kevin Mitchell
parent 828bd2963c
commit 3bf7df4a5e
6 changed files with 80 additions and 52 deletions

View File

@@ -273,12 +273,8 @@ static void render_object(struct osd_state *osd, struct osd_object *obj,
check_obj_resize(osd, res, obj);
if (obj->type == OSDTYPE_SUB || obj->type == OSDTYPE_SUB2) {
if (obj->sub) {
double sub_pts = video_pts;
if (sub_pts != MP_NOPTS_VALUE)
sub_pts -= opts->sub_delay;
sub_get_bitmaps(obj->sub, obj->vo_res, format, sub_pts, out_imgs);
}
if (obj->sub)
sub_get_bitmaps(obj->sub, obj->vo_res, format, video_pts, out_imgs);
} else if (obj->type == OSDTYPE_EXTERNAL2) {
if (obj->external2 && obj->external2->format) {
*out_imgs = *obj->external2;