[FFmpeg-devel] [PATCH] lavf/movenc: Fail when codec tag is invalid for format
John Stebbins
jstebbins at jetheaddev.com
Fri Aug 24 21:44:11 EEST 2018
Fixes ticket #6897
---
libavformat/movenc.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 8ad7026741..4507666863 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1596,23 +1596,21 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
if (is_cover_image(track->st))
return ff_codec_get_tag(codec_cover_image_tags, track->par->codec_id);
- if (track->mode == MODE_MP4 || track->mode == MODE_PSP)
- tag = track->par->codec_tag;
- else if (track->mode == MODE_ISM)
- tag = track->par->codec_tag;
- else if (track->mode == MODE_IPOD) {
+ if (track->mode == MODE_IPOD)
if (!av_match_ext(s->url, "m4a") &&
!av_match_ext(s->url, "m4v") &&
!av_match_ext(s->url, "m4b"))
av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a nor .m4v "
"Quicktime/Ipod might not play the file\n");
- tag = track->par->codec_tag;
- } else if (track->mode & MODE_3GP)
- tag = track->par->codec_tag;
- else if (track->mode == MODE_F4V)
- tag = track->par->codec_tag;
- else
+
+ if (track->mode == MODE_MOV)
tag = mov_get_codec_tag(s, track);
+ else
+ if (av_codec_get_id(s->oformat->codec_tag,
+ track->par->codec_tag) != track->par->codec_id)
+ tag = 0;
+ else
+ tag = track->par->codec_tag;
return tag;
}
--
2.17.1
More information about the ffmpeg-devel
mailing list