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>
This commit is contained in:
Michael Niedermayer 2013-08-20 12:48:52 +02:00
commit fb679d5374
1 changed files with 15 additions and 11 deletions

View File

@ -1430,11 +1430,11 @@ static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track)
const char *hdlr, *descr = NULL, *hdlr_type = NULL; const char *hdlr, *descr = NULL, *hdlr_type = NULL;
int64_t pos = avio_tell(pb); int64_t pos = avio_tell(pb);
if (!track) { /* no media --> data handler */ hdlr = "dhlr";
hdlr = "dhlr"; hdlr_type = "url ";
hdlr_type = "url "; descr = "DataHandler";
descr = "DataHandler";
} else { if (track) {
hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0"; hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0";
if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) { if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {
hdlr_type = "vide"; hdlr_type = "vide";
@ -1451,16 +1451,20 @@ static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track)
else hdlr_type = "text"; else hdlr_type = "text";
descr = "SubtitleHandler"; 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',' ')) { } else if (track->enc->codec_tag == MKTAG('r','t','p',' ')) {
hdlr_type = "hint"; hdlr_type = "hint";
descr = "HintHandler"; descr = "HintHandler";
} else if (track->enc->codec_tag == MKTAG('t','m','c','d')) {
hdlr_type = "tmcd";
descr = "TimeCodeHandler";
} else { } else {
hdlr = "dhlr"; char tag_buf[32];
hdlr_type = "url "; av_get_codec_tag_string(tag_buf, sizeof(tag_buf),
descr = "DataHandler"; 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);
} }
} }