[FFmpeg-devel] [PATCH 7/7] Add check in av_write_header() which validates the rawvideo codec tag.
Stefano Sabatini
stefano.sabatini-lala
Thu May 27 00:28:28 CEST 2010
Make the function fail if there is no codec tag associated to that
pixel format.
---
libavformat/utils.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index d1b7770..6685627 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2643,6 +2643,15 @@ int av_write_header(AVFormatContext *s)
break;
}
+ if (!st->codec->codec_tag && st->codec->codec_id == CODEC_ID_RAWVIDEO) {
+ st->codec->codec_tag = avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt);
+ if (!st->codec->codec_tag) {
+ av_log(s, AV_LOG_ERROR,
+ "Cannot find codec tag for rawvideo pixel format '%s'\n",
+ avcodec_get_pix_fmt_name(st->codec->pix_fmt));
+ return AVERROR(EINVAL);
+ }
+ }
if(s->oformat->codec_tag){
if(st->codec->codec_tag){
if (!validate_codec_tag(s, st)) {
--
1.7.1
More information about the ffmpeg-devel
mailing list