summaryrefslogtreecommitdiff
path: root/libavcodec
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 /libavcodec
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 'libavcodec')
-rw-r--r--libavcodec/raw.c25
-rw-r--r--libavcodec/raw.h3
-rw-r--r--libavcodec/rawdec.c31
3 files changed, 31 insertions, 28 deletions
diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index 16b1b39945..551a1722fc 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -234,3 +234,28 @@ unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat fmt)
}
return 0;
}
+
+const PixelFormatTag avpriv_pix_fmt_bps_avi[] = {
+ { AV_PIX_FMT_MONOWHITE, 1 },
+ { AV_PIX_FMT_PAL8, 2 },
+ { AV_PIX_FMT_PAL8, 4 },
+ { AV_PIX_FMT_PAL8, 8 },
+ { AV_PIX_FMT_RGB444LE, 12 },
+ { AV_PIX_FMT_RGB555LE, 15 },
+ { AV_PIX_FMT_RGB555LE, 16 },
+ { AV_PIX_FMT_BGR24, 24 },
+ { AV_PIX_FMT_BGRA, 32 },
+ { AV_PIX_FMT_NONE, 0 },
+};
+
+const PixelFormatTag avpriv_pix_fmt_bps_mov[] = {
+ { AV_PIX_FMT_MONOWHITE, 1 },
+ { AV_PIX_FMT_PAL8, 2 },
+ { AV_PIX_FMT_PAL8, 4 },
+ { AV_PIX_FMT_PAL8, 8 },
+ { AV_PIX_FMT_RGB555BE, 16 },
+ { AV_PIX_FMT_RGB24, 24 },
+ { AV_PIX_FMT_ARGB, 32 },
+ { AV_PIX_FMT_MONOWHITE,33 },
+ { AV_PIX_FMT_NONE, 0 },
+};
diff --git a/libavcodec/raw.h b/libavcodec/raw.h
index 3e59f28e33..a4179930a3 100644
--- a/libavcodec/raw.h
+++ b/libavcodec/raw.h
@@ -41,4 +41,7 @@ enum AVPixelFormat ff_find_pix_fmt(const PixelFormatTag *tags, unsigned int four
#endif
enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc);
+extern av_export const PixelFormatTag avpriv_pix_fmt_bps_avi[];
+extern av_export const PixelFormatTag avpriv_pix_fmt_bps_mov[];
+
#endif /* AVCODEC_RAW_H */
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 4295ed5690..a03b1be9fe 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -62,31 +62,6 @@ static const AVClass rawdec_class = {
.version = LIBAVUTIL_VERSION_INT,
};
-static const PixelFormatTag pix_fmt_bps_avi[] = {
- { AV_PIX_FMT_MONOWHITE, 1 },
- { AV_PIX_FMT_PAL8, 2 },
- { AV_PIX_FMT_PAL8, 4 },
- { AV_PIX_FMT_PAL8, 8 },
- { AV_PIX_FMT_RGB444LE, 12 },
- { AV_PIX_FMT_RGB555LE, 15 },
- { AV_PIX_FMT_RGB555LE, 16 },
- { AV_PIX_FMT_BGR24, 24 },
- { AV_PIX_FMT_BGRA, 32 },
- { AV_PIX_FMT_NONE, 0 },
-};
-
-static const PixelFormatTag pix_fmt_bps_mov[] = {
- { AV_PIX_FMT_MONOWHITE, 1 },
- { AV_PIX_FMT_PAL8, 2 },
- { AV_PIX_FMT_PAL8, 4 },
- { AV_PIX_FMT_PAL8, 8 },
- { AV_PIX_FMT_RGB555BE, 16 },
- { AV_PIX_FMT_RGB24, 24 },
- { AV_PIX_FMT_ARGB, 32 },
- { AV_PIX_FMT_MONOWHITE,33 },
- { AV_PIX_FMT_NONE, 0 },
-};
-
#if LIBAVCODEC_VERSION_MAJOR < 55
enum AVPixelFormat ff_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc)
{
@@ -103,15 +78,15 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
if ( avctx->codec_tag == MKTAG('r','a','w',' ')
|| avctx->codec_tag == MKTAG('N','O','1','6'))
- avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_mov,
+ avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_mov,
avctx->bits_per_coded_sample);
else if (avctx->codec_tag == MKTAG('W', 'R', 'A', 'W'))
- avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_avi,
+ avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi,
avctx->bits_per_coded_sample);
else if (avctx->codec_tag && (avctx->codec_tag & 0xFFFFFF) != MKTAG('B','I','T', 0))
avctx->pix_fmt = avpriv_find_pix_fmt(ff_raw_pix_fmt_tags, avctx->codec_tag);
else if (avctx->pix_fmt == AV_PIX_FMT_NONE && avctx->bits_per_coded_sample)
- avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_avi,
+ avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi,
avctx->bits_per_coded_sample);
desc = av_pix_fmt_desc_get(avctx->pix_fmt);