[FFmpeg-devel] [PATCH] Support detecting and demuxing EIA-608 subtitles in mov.
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Sat Apr 7 02:23:42 CEST 2012
The format is slightly proprietary.
DVDs use a format of
code byte (0x00, 0x01, 0xfe or 0xff), two data bytes
MOV uses instead
cdat/cdt2 atom, two data bytes
Auto-detecting and supporting both in one decoder is trivial,
so a single codec ID is used.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
libavcodec/avcodec.h | 1 +
libavformat/isom.c | 2 ++
libavformat/mov.c | 4 +++-
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index ea833d0..a53f2c6 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -414,6 +414,7 @@ enum CodecID {
CODEC_ID_DVB_TELETEXT,
CODEC_ID_SRT,
CODEC_ID_MICRODVD = MKBETAG('m','D','V','D'),
+ CODEC_ID_EIA_608 = MKBETAG('c','6','0','8'),
/* other specific kind of codecs (generally used for attachments) */
CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
diff --git a/libavformat/isom.c b/libavformat/isom.c
index 9182008..c19ed0f 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -158,6 +158,7 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
{ CODEC_ID_H264, MKTAG('a', 'i', '1', '3') }, /* AVC-Intra 100M 1080p24/30/60 */
{ CODEC_ID_H264, MKTAG('a', 'i', '1', '5') }, /* AVC-Intra 100M 1080i50 */
{ CODEC_ID_H264, MKTAG('a', 'i', '1', '6') }, /* AVC-Intra 100M 1080i60 */
+ { CODEC_ID_H264, MKTAG('A', 'V', 'i', 'n') }, /* AVC-1/H.264 */
{ CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 Camcorder */
{ CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */
@@ -287,6 +288,7 @@ const AVCodecTag ff_codec_movaudio_tags[] = {
const AVCodecTag ff_codec_movsubtitle_tags[] = {
{ CODEC_ID_MOV_TEXT, MKTAG('t', 'e', 'x', 't') },
{ CODEC_ID_MOV_TEXT, MKTAG('t', 'x', '3', 'g') },
+ { CODEC_ID_EIA_608, MKTAG('c', '6', '0', '8') },
{ CODEC_ID_NONE, 0 },
};
diff --git a/libavformat/mov.c b/libavformat/mov.c
index b5d6516..9796c95 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1222,7 +1222,9 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
id = ff_codec_get_id(ff_codec_bmp_tags, format);
if (id > 0)
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- else if (st->codec->codec_type == AVMEDIA_TYPE_DATA){
+ else if (st->codec->codec_type == AVMEDIA_TYPE_DATA ||
+ (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE &&
+ st->codec->codec_id == CODEC_ID_NONE)){
id = ff_codec_get_id(ff_codec_movsubtitle_tags, format);
if (id > 0)
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
--
1.7.9.5
More information about the ffmpeg-devel
mailing list