Commit 380cfce2 authored by Clément Bœsch's avatar Clément Bœsch

lavc: add AV_CODEC_PROP_TEXT_SUB.

CC are not marked. Also allow potential mixed types later.
parent 6189ff36
...@@ -15,6 +15,9 @@ libavutil: 2012-10-22 ...@@ -15,6 +15,9 @@ libavutil: 2012-10-22
API changes, most recent first: API changes, most recent first:
2013-04-19 - xxxxxxx - lavc 55.4.100
Add AV_CODEC_PROP_TEXT_SUB property for text based subtitles codec.
2013-04-18 - xxxxxxx - lavf 55.3.100 2013-04-18 - xxxxxxx - lavf 55.3.100
The matroska demuxer can now output proper verbatim ASS packets. It will The matroska demuxer can now output proper verbatim ASS packets. It will
become the default starting lavf 56.0.100. become the default starting lavf 56.0.100.
......
...@@ -541,8 +541,14 @@ typedef struct AVCodecDescriptor { ...@@ -541,8 +541,14 @@ typedef struct AVCodecDescriptor {
#define AV_CODEC_PROP_LOSSLESS (1 << 2) #define AV_CODEC_PROP_LOSSLESS (1 << 2)
/** /**
* Subtitle codec is bitmap based * Subtitle codec is bitmap based
* Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
*/ */
#define AV_CODEC_PROP_BITMAP_SUB (1 << 16) #define AV_CODEC_PROP_BITMAP_SUB (1 << 16)
/**
* Subtitle codec is text based.
* Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
*/
#define AV_CODEC_PROP_TEXT_SUB (1 << 17)
/** /**
* @ingroup lavc_decoding * @ingroup lavc_decoding
......
...@@ -2394,6 +2394,7 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -2394,6 +2394,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "text", .name = "text",
.long_name = NULL_IF_CONFIG_SMALL("raw UTF-8 text"), .long_name = NULL_IF_CONFIG_SMALL("raw UTF-8 text"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_XSUB, .id = AV_CODEC_ID_XSUB,
...@@ -2407,18 +2408,21 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -2407,18 +2408,21 @@ static const AVCodecDescriptor codec_descriptors[] = {
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "ass", .name = "ass",
.long_name = NULL_IF_CONFIG_SMALL("ASS (Advanced SSA) subtitle"), .long_name = NULL_IF_CONFIG_SMALL("ASS (Advanced SSA) subtitle"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_SSA, .id = AV_CODEC_ID_SSA,
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "ssa", .name = "ssa",
.long_name = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"), .long_name = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_MOV_TEXT, .id = AV_CODEC_ID_MOV_TEXT,
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "mov_text", .name = "mov_text",
.long_name = NULL_IF_CONFIG_SMALL("MOV text"), .long_name = NULL_IF_CONFIG_SMALL("MOV text"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_HDMV_PGS_SUBTITLE, .id = AV_CODEC_ID_HDMV_PGS_SUBTITLE,
...@@ -2438,24 +2442,28 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -2438,24 +2442,28 @@ static const AVCodecDescriptor codec_descriptors[] = {
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "srt", .name = "srt",
.long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle with embedded timing"), .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle with embedded timing"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_SUBRIP, .id = AV_CODEC_ID_SUBRIP,
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "subrip", .name = "subrip",
.long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle"), .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_MICRODVD, .id = AV_CODEC_ID_MICRODVD,
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "microdvd", .name = "microdvd",
.long_name = NULL_IF_CONFIG_SMALL("MicroDVD subtitle"), .long_name = NULL_IF_CONFIG_SMALL("MicroDVD subtitle"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_MPL2, .id = AV_CODEC_ID_MPL2,
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "mpl2", .name = "mpl2",
.long_name = NULL_IF_CONFIG_SMALL("MPL2 subtitle"), .long_name = NULL_IF_CONFIG_SMALL("MPL2 subtitle"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_EIA_608, .id = AV_CODEC_ID_EIA_608,
...@@ -2468,48 +2476,56 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -2468,48 +2476,56 @@ static const AVCodecDescriptor codec_descriptors[] = {
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "jacosub", .name = "jacosub",
.long_name = NULL_IF_CONFIG_SMALL("JACOsub subtitle"), .long_name = NULL_IF_CONFIG_SMALL("JACOsub subtitle"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_PJS, .id = AV_CODEC_ID_PJS,
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "pjs", .name = "pjs",
.long_name = NULL_IF_CONFIG_SMALL("PJS (Phoenix Japanimation Society) subtitle"), .long_name = NULL_IF_CONFIG_SMALL("PJS (Phoenix Japanimation Society) subtitle"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_SAMI, .id = AV_CODEC_ID_SAMI,
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "sami", .name = "sami",
.long_name = NULL_IF_CONFIG_SMALL("SAMI subtitle"), .long_name = NULL_IF_CONFIG_SMALL("SAMI subtitle"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_REALTEXT, .id = AV_CODEC_ID_REALTEXT,
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "realtext", .name = "realtext",
.long_name = NULL_IF_CONFIG_SMALL("RealText subtitle"), .long_name = NULL_IF_CONFIG_SMALL("RealText subtitle"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_SUBVIEWER1, .id = AV_CODEC_ID_SUBVIEWER1,
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "subviewer1", .name = "subviewer1",
.long_name = NULL_IF_CONFIG_SMALL("SubViewer v1 subtitle"), .long_name = NULL_IF_CONFIG_SMALL("SubViewer v1 subtitle"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_SUBVIEWER, .id = AV_CODEC_ID_SUBVIEWER,
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "subviewer", .name = "subviewer",
.long_name = NULL_IF_CONFIG_SMALL("SubViewer subtitle"), .long_name = NULL_IF_CONFIG_SMALL("SubViewer subtitle"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_VPLAYER, .id = AV_CODEC_ID_VPLAYER,
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "vplayer", .name = "vplayer",
.long_name = NULL_IF_CONFIG_SMALL("VPlayer subtitle"), .long_name = NULL_IF_CONFIG_SMALL("VPlayer subtitle"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_WEBVTT, .id = AV_CODEC_ID_WEBVTT,
.type = AVMEDIA_TYPE_SUBTITLE, .type = AVMEDIA_TYPE_SUBTITLE,
.name = "webvtt", .name = "webvtt",
.long_name = NULL_IF_CONFIG_SMALL("WebVTT subtitle"), .long_name = NULL_IF_CONFIG_SMALL("WebVTT subtitle"),
.props = AV_CODEC_PROP_TEXT_SUB,
}, },
{ {
.id = AV_CODEC_ID_BINTEXT, .id = AV_CODEC_ID_BINTEXT,
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 55 #define LIBAVCODEC_VERSION_MAJOR 55
#define LIBAVCODEC_VERSION_MINOR 3 #define LIBAVCODEC_VERSION_MINOR 4
#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
...@@ -302,7 +302,7 @@ static av_cold int init_subtitles(AVFilterContext *ctx) ...@@ -302,7 +302,7 @@ static av_cold int init_subtitles(AVFilterContext *ctx)
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
dec_desc = avcodec_descriptor_get(dec_ctx->codec_id); dec_desc = avcodec_descriptor_get(dec_ctx->codec_id);
if (dec_desc && (dec_desc->props & AV_CODEC_PROP_BITMAP_SUB)) { if (dec_desc && !(dec_desc->props & AV_CODEC_PROP_TEXT_SUB)) {
av_log(ctx, AV_LOG_ERROR, av_log(ctx, AV_LOG_ERROR,
"Only text based subtitles are currently supported\n"); "Only text based subtitles are currently supported\n");
return AVERROR_PATCHWELCOME; return AVERROR_PATCHWELCOME;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment