Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2014-04-12 01:35:11 +0400
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2014-04-12 01:35:11 +0400
commit8b122937af9ad10e9352f69c712e782fd6cfb436 (patch)
tree3b9824d4de2fc16976ac65f164cd22a581e1c8a2 /libavformat/avienc.c
parent662a8d882758ac90cf55968fc7ab3540e51f2d0b (diff)
Warn if rawvideo and an unreadable pix_fmt are written.
Print an error if a combination of rawvideo and an unusual pix_fmt that will be impossible to decode are written to avi or mov. Fixes ticket #3545.
Diffstat (limited to 'libavformat/avienc.c')
-rw-r--r--libavformat/avienc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 24a3821390..5acc7c2b14 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -32,6 +32,8 @@
#include "libavutil/dict.h"
#include "libavutil/avassert.h"
#include "libavutil/timestamp.h"
+#include "libavutil/pixdesc.h"
+#include "libavcodec/raw.h"
/*
* TODO:
@@ -296,6 +298,7 @@ static int avi_write_header(AVFormatContext *s)
if (stream->codec_type != AVMEDIA_TYPE_DATA) {
int ret;
+ enum AVPixelFormat pix_fmt;
strf = ff_start_tag(pb, "strf");
switch (stream->codec_type) {
@@ -306,6 +309,14 @@ static int avi_write_header(AVFormatContext *s)
break;
case AVMEDIA_TYPE_VIDEO:
ff_put_bmp_header(pb, stream, ff_codec_bmp_tags, 0, 0);
+ pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi,
+ stream->bits_per_coded_sample);
+ if ( !stream->codec_tag
+ && stream->codec_id == AV_CODEC_ID_RAWVIDEO
+ && stream->pix_fmt != pix_fmt
+ && stream->pix_fmt != AV_PIX_FMT_NONE)
+ av_log(s, AV_LOG_ERROR, "%s rawvideo cannot be written to avi, output file will be unreadable\n",
+ av_get_pix_fmt_name(stream->pix_fmt));
break;
case AVMEDIA_TYPE_AUDIO:
if ((ret = ff_put_wav_header(pb, stream)) < 0)