aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>2010-07-07 21:23:36 +0000
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>2010-07-07 21:23:36 +0000
commit0fd0ef7947ad31b2e1b9506cb70d85dcfdf6cba6 (patch)
treec79745bc17e836f9438ae968085c2997a5f8c3a5
parent38b04109028fdeb4009f74e7467f90f3083a897a (diff)
downloadffmpeg-0fd0ef7947ad31b2e1b9506cb70d85dcfdf6cba6.tar.gz
Add new decoder property max_lowres and do not init decoder if requested value is higher.
Originally committed as revision 24098 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/avcodec.h5
-rw-r--r--libavcodec/bmp.c1
-rw-r--r--libavcodec/cdgraphics.c1
-rw-r--r--libavcodec/dv.c1
-rw-r--r--libavcodec/flvdec.c1
-rw-r--r--libavcodec/h261dec.c1
-rw-r--r--libavcodec/h263dec.c1
-rw-r--r--libavcodec/kgv1dec.c1
-rw-r--r--libavcodec/libopenjpeg.c1
-rw-r--r--libavcodec/mjpegbdec.c1
-rw-r--r--libavcodec/mjpegdec.c2
-rw-r--r--libavcodec/mpeg12.c3
-rw-r--r--libavcodec/mpeg4videodec.c1
-rw-r--r--libavcodec/msmpeg4.c4
-rw-r--r--libavcodec/pngdec.c1
-rw-r--r--libavcodec/pnmdec.c5
-rw-r--r--libavcodec/rv10.c2
-rw-r--r--libavcodec/sp5xdec.c1
-rw-r--r--libavcodec/utils.c7
-rw-r--r--libavcodec/wmv2dec.c1
20 files changed, 39 insertions, 2 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 11ef87b5bb..6f51156859 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -30,8 +30,8 @@
#include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 52
-#define LIBAVCODEC_VERSION_MINOR 79
-#define LIBAVCODEC_VERSION_MICRO 1
+#define LIBAVCODEC_VERSION_MINOR 80
+#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
@@ -2713,6 +2713,7 @@ typedef struct AVCodec {
const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
const enum SampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
const int64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
+ uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
} AVCodec;
/**
diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c
index da7bb787d0..623a8a903e 100644
--- a/libavcodec/bmp.c
+++ b/libavcodec/bmp.c
@@ -345,5 +345,6 @@ AVCodec bmp_decoder = {
bmp_decode_end,
bmp_decode_frame,
CODEC_CAP_DR1,
+ .max_lowres = 5,
.long_name = NULL_IF_CONFIG_SMALL("BMP image"),
};
diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c
index c174aa9d98..8afbb27aad 100644
--- a/libavcodec/cdgraphics.c
+++ b/libavcodec/cdgraphics.c
@@ -377,5 +377,6 @@ AVCodec cdgraphics_decoder = {
cdg_decode_end,
cdg_decode_frame,
CODEC_CAP_DR1,
+ .max_lowres = 5,
.long_name = NULL_IF_CONFIG_SMALL("CD Graphics video"),
};
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index ea1f66179c..9f53562328 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -1304,6 +1304,7 @@ AVCodec dvvideo_decoder = {
dvvideo_decode_frame,
CODEC_CAP_DR1,
NULL,
+ .max_lowres = 3,
.long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
};
#endif
diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c
index cf9661ce1c..b21a9e4a34 100644
--- a/libavcodec/flvdec.c
+++ b/libavcodec/flvdec.c
@@ -127,6 +127,7 @@ AVCodec flv_decoder = {
ff_h263_decode_end,
ff_h263_decode_frame,
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
+ .max_lowres= 3,
.long_name= NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"),
.pix_fmts= ff_pixfmt_list_420,
};
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index bb5f27d503..3809a0179c 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -651,5 +651,6 @@ AVCodec h261_decoder = {
h261_decode_end,
h261_decode_frame,
CODEC_CAP_DR1,
+ .max_lowres = 3,
.long_name = NULL_IF_CONFIG_SMALL("H.261"),
};
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index c80cfcfa2d..d9d6f7e5d6 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -738,6 +738,7 @@ AVCodec h263_decoder = {
ff_h263_decode_frame,
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
.flush= ff_mpeg_flush,
+ .max_lowres= 3,
.long_name= NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),
.pix_fmts= ff_hwaccel_pixfmt_list_420,
};
diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c
index 5af6b3b2bb..7ecb28d417 100644
--- a/libavcodec/kgv1dec.c
+++ b/libavcodec/kgv1dec.c
@@ -172,5 +172,6 @@ AVCodec kgv1_decoder = {
NULL,
decode_end,
decode_frame,
+ .max_lowres = 1,
.long_name = NULL_IF_CONFIG_SMALL("Kega Game Video"),
};
diff --git a/libavcodec/libopenjpeg.c b/libavcodec/libopenjpeg.c
index 0956da9c36..f85ec00150 100644
--- a/libavcodec/libopenjpeg.c
+++ b/libavcodec/libopenjpeg.c
@@ -193,5 +193,6 @@ AVCodec libopenjpeg_decoder = {
libopenjpeg_decode_close,
libopenjpeg_decode_frame,
CODEC_CAP_DR1,
+ .max_lowres = 5,
.long_name = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"),
} ;
diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c
index b418f5734c..907fa6f504 100644
--- a/libavcodec/mjpegbdec.c
+++ b/libavcodec/mjpegbdec.c
@@ -156,5 +156,6 @@ AVCodec mjpegb_decoder = {
mjpegb_decode_frame,
CODEC_CAP_DR1,
NULL,
+ .max_lowres = 3,
.long_name = NULL_IF_CONFIG_SMALL("Apple MJPEG-B"),
};
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 7f57af905c..47f5a0eb4e 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1542,6 +1542,7 @@ AVCodec mjpeg_decoder = {
ff_mjpeg_decode_frame,
CODEC_CAP_DR1,
NULL,
+ .max_lowres = 8,
.long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
};
@@ -1556,5 +1557,6 @@ AVCodec thp_decoder = {
ff_mjpeg_decode_frame,
CODEC_CAP_DR1,
NULL,
+ .max_lowres = 3,
.long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"),
};
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 9f2d23d2be..0af24ad80a 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -2511,6 +2511,7 @@ AVCodec mpeg1video_decoder = {
mpeg_decode_frame,
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
.flush= flush,
+ .max_lowres= 3,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
};
@@ -2525,6 +2526,7 @@ AVCodec mpeg2video_decoder = {
mpeg_decode_frame,
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
.flush= flush,
+ .max_lowres= 3,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"),
};
@@ -2540,6 +2542,7 @@ AVCodec mpegvideo_decoder = {
mpeg_decode_frame,
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
.flush= flush,
+ .max_lowres= 3,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
};
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index fa69c9ef87..b339f7812f 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -2245,6 +2245,7 @@ AVCodec mpeg4_decoder = {
ff_h263_decode_frame,
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
.flush= ff_mpeg_flush,
+ .max_lowres= 3,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
.pix_fmts= ff_hwaccel_pixfmt_list_420,
};
diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c
index 84658fe84d..8b48dc7cd7 100644
--- a/libavcodec/msmpeg4.c
+++ b/libavcodec/msmpeg4.c
@@ -1929,6 +1929,7 @@ AVCodec msmpeg4v1_decoder = {
ff_h263_decode_end,
ff_h263_decode_frame,
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
+ .max_lowres= 3,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
.pix_fmts= ff_pixfmt_list_420,
};
@@ -1943,6 +1944,7 @@ AVCodec msmpeg4v2_decoder = {
ff_h263_decode_end,
ff_h263_decode_frame,
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
+ .max_lowres= 3,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
.pix_fmts= ff_pixfmt_list_420,
};
@@ -1957,6 +1959,7 @@ AVCodec msmpeg4v3_decoder = {
ff_h263_decode_end,
ff_h263_decode_frame,
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
+ .max_lowres= 3,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
.pix_fmts= ff_pixfmt_list_420,
};
@@ -1971,6 +1974,7 @@ AVCodec wmv1_decoder = {
ff_h263_decode_end,
ff_h263_decode_frame,
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
+ .max_lowres= 3,
.long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
.pix_fmts= ff_pixfmt_list_420,
};
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 03859a9913..a00c284946 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -667,5 +667,6 @@ AVCodec png_decoder = {
decode_frame,
CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/,
NULL,
+ .max_lowres = 5,
.long_name = NULL_IF_CONFIG_SMALL("PNG image"),
};
diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c
index 66033c1f4e..4ccaa457fc 100644
--- a/libavcodec/pnmdec.c
+++ b/libavcodec/pnmdec.c
@@ -199,6 +199,7 @@ AVCodec pgm_decoder = {
pnm_decode_frame,
CODEC_CAP_DR1,
.pix_fmts = (const enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE},
+ .max_lowres = 5,
.long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
};
#endif
@@ -215,6 +216,7 @@ AVCodec pgmyuv_decoder = {
pnm_decode_frame,
CODEC_CAP_DR1,
.pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+ .max_lowres = 5,
.long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
};
#endif
@@ -231,6 +233,7 @@ AVCodec ppm_decoder = {
pnm_decode_frame,
CODEC_CAP_DR1,
.pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE},
+ .max_lowres = 5,
.long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
};
#endif
@@ -247,6 +250,7 @@ AVCodec pbm_decoder = {
pnm_decode_frame,
CODEC_CAP_DR1,
.pix_fmts = (const enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE},
+ .max_lowres = 5,
.long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
};
#endif
@@ -263,6 +267,7 @@ AVCodec pam_decoder = {
pnm_decode_frame,
CODEC_CAP_DR1,
.pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE},
+ .max_lowres = 5,
.long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
};
#endif
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index b6ca031dfa..e9face622b 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -716,6 +716,7 @@ AVCodec rv10_decoder = {
rv10_decode_end,
rv10_decode_frame,
CODEC_CAP_DR1,
+ .max_lowres = 3,
.long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
.pix_fmts= ff_pixfmt_list_420,
};
@@ -731,6 +732,7 @@ AVCodec rv20_decoder = {
rv10_decode_frame,
CODEC_CAP_DR1 | CODEC_CAP_DELAY,
.flush= ff_mpeg_flush,
+ .max_lowres = 3,
.long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
.pix_fmts= ff_pixfmt_list_420,
};
diff --git a/libavcodec/sp5xdec.c b/libavcodec/sp5xdec.c
index 754926a4ce..b047f9c7af 100644
--- a/libavcodec/sp5xdec.c
+++ b/libavcodec/sp5xdec.c
@@ -204,6 +204,7 @@ AVCodec sp5x_decoder = {
sp5x_decode_frame,
CODEC_CAP_DR1,
NULL,
+ .max_lowres = 5,
.long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"),
};
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 902951137c..c3d701c74f 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -506,6 +506,13 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
}
avctx->frame_number = 0;
if(avctx->codec->init){
+ if(avctx->codec_type == AVMEDIA_TYPE_VIDEO &&
+ avctx->codec->max_lowres < avctx->lowres){
+ av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n",
+ avctx->codec->max_lowres);
+ goto free_and_end;
+ }
+
ret = avctx->codec->init(avctx);
if (ret < 0) {
goto free_and_end;
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index a9bb80cae4..c83f898d7f 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -494,6 +494,7 @@ AVCodec wmv2_decoder = {
wmv2_decode_end,
ff_h263_decode_frame,
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
+ .max_lowres = 3,
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
.pix_fmts= ff_pixfmt_list_420,
};