[FFmpeg-devel] [PATCH v3 10/25] avformat/movenc: deal with AVMEDIA_TYPE_DATA by using AV_CODEC_ID_META
Erkki Seppälä
erkki.seppala.ext at nokia.com
Mon Sep 19 16:25:33 EEST 2016
This includes creating an AVCodecTag table ff_codec_metadata_tags as
there are for video, audio and subtitles. The tag table is used for
mov-compatiblity.
Signed-off-by: Erkki Seppälä <erkki.seppala.ext at nokia.com>
Signed-off-by: OZOPlayer <OZOPL at nokia.com>
---
libavformat/isom.c | 5 +++++
libavformat/isom.h | 1 +
libavformat/movenc.c | 6 ++++++
3 files changed, 12 insertions(+)
diff --git a/libavformat/isom.c b/libavformat/isom.c
index cb457dd..1a90d00 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -355,6 +355,11 @@ const AVCodecTag ff_codec_movsubtitle_tags[] = {
{ AV_CODEC_ID_NONE, 0 },
};
+const AVCodecTag ff_codec_metadata_tags[] = {
+ { AV_CODEC_ID_META, MKTAG('m', 'e', 't', 'a') },
+ { AV_CODEC_ID_NONE, 0 },
+};
+
/* map numeric codes from mdhd atom to ISO 639 */
/* cf. QTFileFormat.pdf p253, qtff.pdf p205 */
/* http://developer.apple.com/documentation/mac/Text/Text-368.html */
diff --git a/libavformat/isom.h b/libavformat/isom.h
index 7b521d8..89b15ea 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -35,6 +35,7 @@ extern const AVCodecTag ff_mp4_obj_type[];
extern const AVCodecTag ff_codec_movvideo_tags[];
extern const AVCodecTag ff_codec_movaudio_tags[];
extern const AVCodecTag ff_codec_movsubtitle_tags[];
+extern const AVCodecTag ff_codec_metadata_tags[];
int ff_mov_iso639_to_lang(const char lang[4], int mp4);
int ff_mov_lang_to_iso639(unsigned code, char to[4]);
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index b2e87ed..a6f234e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1470,6 +1470,8 @@ static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track)
}
} else if (track->par->codec_type == AVMEDIA_TYPE_SUBTITLE)
tag = ff_codec_get_tag(ff_codec_movsubtitle_tags, track->par->codec_id);
+ else if (track->par->codec_type == AVMEDIA_TYPE_DATA)
+ tag = ff_codec_get_tag(ff_codec_metadata_tags, track->par->codec_id);
}
return tag;
@@ -2242,6 +2244,9 @@ static int mov_write_hdlr_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
} else if (track->par->codec_tag == MKTAG('t','m','c','d')) {
hdlr_type = "tmcd";
descr = "TimeCodeHandler";
+ } else if (track->par->codec_type == AVMEDIA_TYPE_DATA) {
+ hdlr_type = "meta";
+ descr = "DataHandler";
} else {
char tag_buf[32];
av_get_codec_tag_string(tag_buf, sizeof(tag_buf),
@@ -5425,6 +5430,7 @@ static void enable_tracks(AVFormatContext *s)
case AVMEDIA_TYPE_VIDEO:
case AVMEDIA_TYPE_AUDIO:
case AVMEDIA_TYPE_SUBTITLE:
+ case AVMEDIA_TYPE_DATA:
if (enabled[i] > 1)
mov->per_stream_grouping = 1;
if (!enabled[i] && first[i] >= 0)
--
2.7.4
More information about the ffmpeg-devel
mailing list