[FFmpeg-cvslog] lavc: mark bitmap based subtitles codecs as such.

Clément Bœsch git at videolan.org
Sun Feb 17 13:04:12 CET 2013


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Sat Jan  5 11:06:31 2013 +0100| [8732271e4025ed4198055686228a62c1d4f1a8c7] | committer: Clément Bœsch

lavc: mark bitmap based subtitles codecs as such.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8732271e4025ed4198055686228a62c1d4f1a8c7
---

 libavcodec/avcodec.h    |    4 ++++
 libavcodec/codec_desc.c |    4 ++++
 libavcodec/utils.c      |    2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 68eac55..fc7091c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -540,6 +540,10 @@ typedef struct AVCodecDescriptor {
  * Codec supports lossless compression. Audio and video codecs only.
  */
 #define AV_CODEC_PROP_LOSSLESS      (1 << 2)
+/**
+ * Subtitle codec is bitmap based
+ */
+#define AV_CODEC_PROP_BITMAP_SUB    (1 << 16)
 
 #if FF_API_OLD_DECODE_AUDIO
 /* in bytes */
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 0806b5b..440e9d9 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2371,12 +2371,14 @@ static const AVCodecDescriptor codec_descriptors[] = {
         .type      = AVMEDIA_TYPE_SUBTITLE,
         .name      = "dvd_subtitle",
         .long_name = NULL_IF_CONFIG_SMALL("DVD subtitles"),
+        .props     = AV_CODEC_PROP_BITMAP_SUB,
     },
     {
         .id        = AV_CODEC_ID_DVB_SUBTITLE,
         .type      = AVMEDIA_TYPE_SUBTITLE,
         .name      = "dvb_subtitle",
         .long_name = NULL_IF_CONFIG_SMALL("DVB subtitles"),
+        .props     = AV_CODEC_PROP_BITMAP_SUB,
     },
     {
         .id        = AV_CODEC_ID_TEXT,
@@ -2389,6 +2391,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
         .type      = AVMEDIA_TYPE_SUBTITLE,
         .name      = "xsub",
         .long_name = NULL_IF_CONFIG_SMALL("XSUB"),
+        .props     = AV_CODEC_PROP_BITMAP_SUB,
     },
     {
         .id        = AV_CODEC_ID_SSA,
@@ -2407,6 +2410,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
         .type      = AVMEDIA_TYPE_SUBTITLE,
         .name      = "hdmv_pgs_subtitle",
         .long_name = NULL_IF_CONFIG_SMALL("HDMV Presentation Graphic Stream subtitles"),
+        .props     = AV_CODEC_PROP_BITMAP_SUB,
     },
     {
         .id        = AV_CODEC_ID_DVB_TELETEXT,
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index f55d378..7e753ac 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1872,7 +1872,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
             sub->pts = av_rescale_q(avpkt->pts,
                                     avctx->pkt_timebase, AV_TIME_BASE_Q);
         ret = avctx->codec->decode(avctx, sub, got_sub_ptr, &tmp);
-        sub->format = sub->num_rects && sub->rects[0]->ass;
+        sub->format = !(avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB);
 
         avctx->pkt = NULL;
         if (did_split) {



More information about the ffmpeg-cvslog mailing list