From b65424f5c2bf1a3a5e4781f640023132920991d7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 21 Aug 2012 18:49:10 +0200 Subject: 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. --- sub/osd_libass.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'sub/osd_libass.c') 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; } -- cgit v1.2.3