diff options
author | wm4 <wm4@nowhere> | 2014-01-29 16:52:40 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-01-31 19:07:43 +0100 |
commit | 5bd0fe5daf8ec20d309f3538bbf4da0735ba3879 (patch) | |
tree | e893216499e8adb3179193b00e04f0ecfe80db3b /sub/sd_lavc.c | |
parent | cab3c5fbb8d093933648003075dcf963740eb997 (diff) | |
download | mpv-5bd0fe5daf8ec20d309f3538bbf4da0735ba3879.tar.bz2 mpv-5bd0fe5daf8ec20d309f3538bbf4da0735ba3879.tar.xz |
sd_lavc: skip 0 sized sub-bitmaps
Not everything in the OSD path handles 0x0 sized sub-bitmaps well. At
least the code implementing --sub-gray had severe problems with it.
Fix this by skipping such bitmaps.
Diffstat (limited to 'sub/sd_lavc.c')
-rw-r--r-- | sub/sd_lavc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index 995d8da0a5..5a328e3c5f 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -183,11 +183,13 @@ static void decode(struct sd *sd, struct demux_packet *packet) sub.num_rects); for (int i = 0; i < sub.num_rects; i++) { struct AVSubtitleRect *r = sub.rects[i]; - struct sub_bitmap *b = &priv->inbitmaps[i]; - struct osd_bmp_indexed *img = &priv->imgs[i]; + struct sub_bitmap *b = &priv->inbitmaps[priv->count]; + struct osd_bmp_indexed *img = &priv->imgs[priv->count]; if (!(r->flags & AV_SUBTITLE_FLAG_FORCED) && opts->forced_subs_only) continue; + if (r->w == 0 || r->h == 0) + continue; img->bitmap = r->pict.data[0]; assert(r->nb_colors > 0); assert(r->nb_colors * 4 <= sizeof(img->palette)); |