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.
This commit is contained in:
wm4 committed 2014-01-31 19:07:43 +01:00
1 parent cab3c5fbb8
commit 5bd0fe5daf
1 file changed
+4 -2
+4 -2
View File
@@ -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));