# HG changeset patch # User cehoyos # Date 1278537816 0 # Node ID c35d7bc648827419b9373d729843adf95ad5f2f5 # Parent 1e4996a88ca53b8145a909a19af85ecfc485a304 Add new decoder property max_lowres and do not init decoder if requested value is higher. diff -r 1e4996a88ca5 -r c35d7bc64882 avcodec.h --- a/avcodec.h Wed Jul 07 20:23:56 2010 +0000 +++ b/avcodec.h Wed Jul 07 21:23:36 2010 +0000 @@ -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 @@ 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 -r 1e4996a88ca5 -r c35d7bc64882 bmp.c --- a/bmp.c Wed Jul 07 20:23:56 2010 +0000 +++ b/bmp.c Wed Jul 07 21:23:36 2010 +0000 @@ -345,5 +345,6 @@ bmp_decode_end, bmp_decode_frame, CODEC_CAP_DR1, + .max_lowres = 5, .long_name = NULL_IF_CONFIG_SMALL("BMP image"), }; diff -r 1e4996a88ca5 -r c35d7bc64882 cdgraphics.c --- a/cdgraphics.c Wed Jul 07 20:23:56 2010 +0000 +++ b/cdgraphics.c Wed Jul 07 21:23:36 2010 +0000 @@ -377,5 +377,6 @@ cdg_decode_end, cdg_decode_frame, CODEC_CAP_DR1, + .max_lowres = 5, .long_name = NULL_IF_CONFIG_SMALL("CD Graphics video"), }; diff -r 1e4996a88ca5 -r c35d7bc64882 dv.c --- a/dv.c Wed Jul 07 20:23:56 2010 +0000 +++ b/dv.c Wed Jul 07 21:23:36 2010 +0000 @@ -1304,6 +1304,7 @@ dvvideo_decode_frame, CODEC_CAP_DR1, NULL, + .max_lowres = 3, .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"), }; #endif diff -r 1e4996a88ca5 -r c35d7bc64882 flvdec.c --- a/flvdec.c Wed Jul 07 20:23:56 2010 +0000 +++ b/flvdec.c Wed Jul 07 21:23:36 2010 +0000 @@ -127,6 +127,7 @@ 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 -r 1e4996a88ca5 -r c35d7bc64882 h261dec.c --- a/h261dec.c Wed Jul 07 20:23:56 2010 +0000 +++ b/h261dec.c Wed Jul 07 21:23:36 2010 +0000 @@ -651,5 +651,6 @@ h261_decode_end, h261_decode_frame, CODEC_CAP_DR1, + .max_lowres = 3, .long_name = NULL_IF_CONFIG_SMALL("H.261"), }; diff -r 1e4996a88ca5 -r c35d7bc64882 h263dec.c --- a/h263dec.c Wed Jul 07 20:23:56 2010 +0000 +++ b/h263dec.c Wed Jul 07 21:23:36 2010 +0000 @@ -738,6 +738,7 @@ 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 -r 1e4996a88ca5 -r c35d7bc64882 kgv1dec.c --- a/kgv1dec.c Wed Jul 07 20:23:56 2010 +0000 +++ b/kgv1dec.c Wed Jul 07 21:23:36 2010 +0000 @@ -172,5 +172,6 @@ NULL, decode_end, decode_frame, + .max_lowres = 1, .long_name = NULL_IF_CONFIG_SMALL("Kega Game Video"), }; diff -r 1e4996a88ca5 -r c35d7bc64882 libopenjpeg.c --- a/libopenjpeg.c Wed Jul 07 20:23:56 2010 +0000 +++ b/libopenjpeg.c Wed Jul 07 21:23:36 2010 +0000 @@ -193,5 +193,6 @@ libopenjpeg_decode_close, libopenjpeg_decode_frame, CODEC_CAP_DR1, + .max_lowres = 5, .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"), } ; diff -r 1e4996a88ca5 -r c35d7bc64882 mjpegbdec.c --- a/mjpegbdec.c Wed Jul 07 20:23:56 2010 +0000 +++ b/mjpegbdec.c Wed Jul 07 21:23:36 2010 +0000 @@ -156,5 +156,6 @@ mjpegb_decode_frame, CODEC_CAP_DR1, NULL, + .max_lowres = 3, .long_name = NULL_IF_CONFIG_SMALL("Apple MJPEG-B"), }; diff -r 1e4996a88ca5 -r c35d7bc64882 mjpegdec.c --- a/mjpegdec.c Wed Jul 07 20:23:56 2010 +0000 +++ b/mjpegdec.c Wed Jul 07 21:23:36 2010 +0000 @@ -1542,6 +1542,7 @@ ff_mjpeg_decode_frame, CODEC_CAP_DR1, NULL, + .max_lowres = 8, .long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"), }; @@ -1556,5 +1557,6 @@ ff_mjpeg_decode_frame, CODEC_CAP_DR1, NULL, + .max_lowres = 3, .long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"), }; diff -r 1e4996a88ca5 -r c35d7bc64882 mpeg12.c --- a/mpeg12.c Wed Jul 07 20:23:56 2010 +0000 +++ b/mpeg12.c Wed Jul 07 21:23:36 2010 +0000 @@ -2511,6 +2511,7 @@ 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 @@ 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 @@ 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 -r 1e4996a88ca5 -r c35d7bc64882 mpeg4videodec.c --- a/mpeg4videodec.c Wed Jul 07 20:23:56 2010 +0000 +++ b/mpeg4videodec.c Wed Jul 07 21:23:36 2010 +0000 @@ -2245,6 +2245,7 @@ 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 -r 1e4996a88ca5 -r c35d7bc64882 msmpeg4.c --- a/msmpeg4.c Wed Jul 07 20:23:56 2010 +0000 +++ b/msmpeg4.c Wed Jul 07 21:23:36 2010 +0000 @@ -1929,6 +1929,7 @@ 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 @@ 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 @@ 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 @@ 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 -r 1e4996a88ca5 -r c35d7bc64882 pngdec.c --- a/pngdec.c Wed Jul 07 20:23:56 2010 +0000 +++ b/pngdec.c Wed Jul 07 21:23:36 2010 +0000 @@ -667,5 +667,6 @@ decode_frame, CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/, NULL, + .max_lowres = 5, .long_name = NULL_IF_CONFIG_SMALL("PNG image"), }; diff -r 1e4996a88ca5 -r c35d7bc64882 pnmdec.c --- a/pnmdec.c Wed Jul 07 20:23:56 2010 +0000 +++ b/pnmdec.c Wed Jul 07 21:23:36 2010 +0000 @@ -199,6 +199,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 -r 1e4996a88ca5 -r c35d7bc64882 rv10.c --- a/rv10.c Wed Jul 07 20:23:56 2010 +0000 +++ b/rv10.c Wed Jul 07 21:23:36 2010 +0000 @@ -716,6 +716,7 @@ 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 @@ 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 -r 1e4996a88ca5 -r c35d7bc64882 sp5xdec.c --- a/sp5xdec.c Wed Jul 07 20:23:56 2010 +0000 +++ b/sp5xdec.c Wed Jul 07 21:23:36 2010 +0000 @@ -204,6 +204,7 @@ sp5x_decode_frame, CODEC_CAP_DR1, NULL, + .max_lowres = 5, .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"), }; diff -r 1e4996a88ca5 -r c35d7bc64882 utils.c --- a/utils.c Wed Jul 07 20:23:56 2010 +0000 +++ b/utils.c Wed Jul 07 21:23:36 2010 +0000 @@ -506,6 +506,13 @@ } 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 -r 1e4996a88ca5 -r c35d7bc64882 wmv2dec.c --- a/wmv2dec.c Wed Jul 07 20:23:56 2010 +0000 +++ b/wmv2dec.c Wed Jul 07 21:23:36 2010 +0000 @@ -494,6 +494,7 @@ 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, };