[FFmpeg-devel] [PATCH]Make subtitle properties code in lavc more robust
Carl Eugen Hoyos
cehoyos at ag.or.at
Thu Aug 7 14:02:33 CEST 2014
Hi!
Attached patch should allow to set the teletext decoder properties to
(AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB).
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 6071380..3db2a1c 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1595,7 +1595,8 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
"supported with subtitles codecs\n");
ret = AVERROR(EINVAL);
goto free_and_end;
- } else if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) {
+ } else if ( avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB
+ && ~avctx->codec_descriptor->props & AV_CODEC_PROP_TEXT_SUB) {
av_log(avctx, AV_LOG_WARNING, "Codec '%s' is bitmap-based, "
"subtitles character encoding will be ignored\n",
avctx->codec_descriptor->name);
@@ -2676,9 +2677,11 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
av_free_packet(&pkt_recoded);
}
- if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB)
+ if ( avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB
+ && ~avctx->codec_descriptor->props & AV_CODEC_PROP_TEXT_SUB)
sub->format = 0;
- else if (avctx->codec_descriptor->props & AV_CODEC_PROP_TEXT_SUB)
+ else if ( avctx->codec_descriptor->props & AV_CODEC_PROP_TEXT_SUB
+ && ~avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB)
sub->format = 1;
avctx->internal->pkt = NULL;
}
More information about the ffmpeg-devel
mailing list