summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-08-21 18:49:10 +0200
committerwm4 <wm4@nowhere>2012-08-21 18:58:15 +0200
commitb65424f5c2bf1a3a5e4781f640023132920991d7 (patch)
tree7caf32748b95fa0bab6b529152d4a33a12591cca
parent009d9d8706f45bc7cb618891527967e70ed17a8d (diff)
downloadmpv-b65424f5c2bf1a3a5e4781f640023132920991d7.tar.bz2
mpv-b65424f5c2bf1a3a5e4781f640023132920991d7.tar.xz
osd_libass: fix displaying empty text, fix API usage
If empty text is rendered, the bounding box is empty. Instead of continuing with a bogus bounding box that would result in garbage being rendered on screen, make the OSD image invisible. This happened when playing demuxer SRT subtitles (e.g. SRT embedded in MKV) with -no-ass at the moment a subtitle line disappeared. Unrelated to this issue, fix libass API usage. Delete the event with libass_flush_events(), instead of trying to reuse the previous event. Based on a patch by uau.
-rw-r--r--sub/osd_libass.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/sub/osd_libass.c b/sub/osd_libass.c
index 3e6c9a872a..9f15173442 100644
--- a/sub/osd_libass.c
+++ b/sub/osd_libass.c
@@ -149,7 +149,10 @@ static void draw_ass_osd(struct osd_state *osd, mp_osd_obj_t *obj)
NULL);
int x1, y1, x2, y2;
- ass_bb(imgs, &x1, &y1, &x2, &y2);
+ if (!ass_bb(imgs, &x1, &y1, &x2, &y2)) {
+ obj->flags &= ~OSDFLAG_VISIBLE;
+ return;
+ }
obj->bbox.x1 = x1;
obj->bbox.y1 = y1;
@@ -200,22 +203,14 @@ static ASS_Track *create_osd_ass_track(struct osd_state *osd)
return track;
}
-// xxx extremely evil hack to get rid of '[ass] Event height has changed'
-static void reset_ass_event(ASS_Event *event)
-{
- free(event->render_priv);
- event->render_priv = NULL;
-}
-
static ASS_Event *get_osd_ass_event(ASS_Track *track)
{
- if (!track->n_events)
- ass_alloc_event(track);
+ ass_flush_events(track);
+ ass_alloc_event(track);
ASS_Event *event = track->events + 0;
event->Start = 0;
event->Duration = 100;
event->Style = track->default_style;
- reset_ass_event(event);
return event;
}