aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/movenc.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2014-04-11 23:35:11 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2014-04-11 23:35:11 +0200
commit8b122937af9ad10e9352f69c712e782fd6cfb436 (patch)
tree3b9824d4de2fc16976ac65f164cd22a581e1c8a2 /libavformat/movenc.c
parent662a8d882758ac90cf55968fc7ab3540e51f2d0b (diff)
downloadffmpeg-8b122937af9ad10e9352f69c712e782fd6cfb436.tar.gz
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/movenc.c')
-rw-r--r--libavformat/movenc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 94acc941b3..808a2bc098 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -34,12 +34,14 @@
#include "libavcodec/get_bits.h"
#include "libavcodec/put_bits.h"
#include "libavcodec/vc1.h"
+#include "libavcodec/raw.h"
#include "internal.h"
#include "libavutil/avstring.h"
#include "libavutil/intfloat.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
+#include "libavutil/pixdesc.h"
#include "hevc.h"
#include "rtpenc.h"
#include "mov_chan.h"
@@ -1009,6 +1011,7 @@ static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track)
{
int tag = track->enc->codec_tag;
int i;
+ enum AVPixelFormat pix_fmt;
for (i = 0; i < FF_ARRAY_ELEMS(mov_pix_fmt_tags); i++) {
if (track->enc->pix_fmt == mov_pix_fmt_tags[i].pix_fmt) {
@@ -1019,6 +1022,13 @@ static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track)
}
}
+ pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_mov,
+ track->enc->bits_per_coded_sample);
+ if (tag == MKTAG('r','a','w',' ') &&
+ track->enc->pix_fmt != pix_fmt &&
+ track->enc->pix_fmt != AV_PIX_FMT_NONE)
+ av_log(s, AV_LOG_ERROR, "%s rawvideo cannot be written to mov, output file will be unreadable\n",
+ av_get_pix_fmt_name(track->enc->pix_fmt));
return tag;
}