diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-08-20 14:48:52 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-08-20 14:48:52 +0400 |
commit | fb679d53743f3beed3ccb998c428c8b601cec59e (patch) | |
tree | 290fda459e006965cc989b745615fb824f3aacb2 /libavformat/movenc.c | |
parent | eec75e0a1fc952d5ca31de8f5c8d934cfa52edf2 (diff) | |
parent | 67400f6b6219892ab7a555fb61ef979c857692d7 (diff) |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
mov: Prevent segfaults on mov_write_hdlr_tag
Conflicts:
libavformat/movenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 5b70468014..d0f663bb62 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1430,11 +1430,11 @@ static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track) const char *hdlr, *descr = NULL, *hdlr_type = NULL; int64_t pos = avio_tell(pb); - if (!track) { /* no media --> data handler */ - hdlr = "dhlr"; - hdlr_type = "url "; - descr = "DataHandler"; - } else { + hdlr = "dhlr"; + hdlr_type = "url "; + descr = "DataHandler"; + + if (track) { hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0"; if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) { hdlr_type = "vide"; @@ -1451,16 +1451,20 @@ static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track) else hdlr_type = "text"; descr = "SubtitleHandler"; } - } else if (track->enc->codec_tag == MKTAG('t','m','c','d')) { - hdlr_type = "tmcd"; - descr = "TimeCodeHandler"; } else if (track->enc->codec_tag == MKTAG('r','t','p',' ')) { hdlr_type = "hint"; descr = "HintHandler"; + } else if (track->enc->codec_tag == MKTAG('t','m','c','d')) { + hdlr_type = "tmcd"; + descr = "TimeCodeHandler"; } else { - hdlr = "dhlr"; - hdlr_type = "url "; - descr = "DataHandler"; + char tag_buf[32]; + av_get_codec_tag_string(tag_buf, sizeof(tag_buf), + track->enc->codec_tag); + + av_log(track->enc, AV_LOG_WARNING, + "Unknown hldr_type for %s / 0x%04X, writing dummy values\n", + tag_buf, track->enc->codec_tag); } } |