diff options
-rw-r--r-- | sub/sd_lavc_conv.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/sub/sd_lavc_conv.c b/sub/sd_lavc_conv.c index 09e960cde5..9da679905b 100644 --- a/sub/sd_lavc_conv.c +++ b/sub/sd_lavc_conv.c @@ -48,19 +48,9 @@ static bool supports_format(const char *format) { format = get_lavc_format(format); enum AVCodecID cid = mp_codec_to_av_codec_id(format); + AVCodec *codec = avcodec_find_decoder(cid); const AVCodecDescriptor *desc = avcodec_descriptor_get(cid); - if (!desc) - return false; - // These are known to support AVSubtitleRect->ass. - const char *whitelist[] = - {"text", "ass", "ssa", "srt", "subrip", "microdvd", "mpl2", - "jacosub", "pjs", "sami", "realtext", "subviewer", "subviewer1", - "vplayer", "webvtt", 0}; - for (int n = 0; whitelist[n]; n++) { - if (strcmp(format, whitelist[n]) == 0) - return true; - } - return false; + return codec && desc && desc->type == AVMEDIA_TYPE_SUBTITLE; } // Disable style definitions generated by the libavcodec converter. @@ -249,6 +239,8 @@ static void decode(struct sd *sd, struct demux_packet *packet) MP_ERR(sd, "Error decoding subtitle\n"); } else if (got_sub) { for (int i = 0; i < sub.num_rects; i++) { + if (sub.rects[i]->w > 0 && sub.rects[i]->h > 0) + MP_WARN(sd, "Ignoring bitmap subtitle.\n"); char *ass_line = sub.rects[i]->ass; if (!ass_line) break; |