[FFmpeg-cvslog] r24098 - in trunk/libavcodec: avcodec.h bmp.c cdgraphics.c dv.c flvdec.c h261dec.c h263dec.c kgv1dec.c libopenjpeg.c mjpegbdec.c mjpegdec.c mpeg12.c mpeg4videodec.c msmpeg4.c pngdec.c pnmdec.c rv10...

cehoyos subversion
Wed Jul 7 23:23:37 CEST 2010


Author: cehoyos
Date: Wed Jul  7 23:23:36 2010
New Revision: 24098

Log:
Add new decoder property max_lowres and do not init decoder if requested value is higher.

Modified:
   trunk/libavcodec/avcodec.h
   trunk/libavcodec/bmp.c
   trunk/libavcodec/cdgraphics.c
   trunk/libavcodec/dv.c
   trunk/libavcodec/flvdec.c
   trunk/libavcodec/h261dec.c
   trunk/libavcodec/h263dec.c
   trunk/libavcodec/kgv1dec.c
   trunk/libavcodec/libopenjpeg.c
   trunk/libavcodec/mjpegbdec.c
   trunk/libavcodec/mjpegdec.c
   trunk/libavcodec/mpeg12.c
   trunk/libavcodec/mpeg4videodec.c
   trunk/libavcodec/msmpeg4.c
   trunk/libavcodec/pngdec.c
   trunk/libavcodec/pnmdec.c
   trunk/libavcodec/rv10.c
   trunk/libavcodec/sp5xdec.c
   trunk/libavcodec/utils.c
   trunk/libavcodec/wmv2dec.c

Modified: trunk/libavcodec/avcodec.h
==============================================================================
--- trunk/libavcodec/avcodec.h	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/avcodec.h	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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;
 
 /**

Modified: trunk/libavcodec/bmp.c
==============================================================================
--- trunk/libavcodec/bmp.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/bmp.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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"),
 };

Modified: trunk/libavcodec/cdgraphics.c
==============================================================================
--- trunk/libavcodec/cdgraphics.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/cdgraphics.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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"),
 };

Modified: trunk/libavcodec/dv.c
==============================================================================
--- trunk/libavcodec/dv.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/dv.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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

Modified: trunk/libavcodec/flvdec.c
==============================================================================
--- trunk/libavcodec/flvdec.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/flvdec.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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,
 };

Modified: trunk/libavcodec/h261dec.c
==============================================================================
--- trunk/libavcodec/h261dec.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/h261dec.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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"),
 };

Modified: trunk/libavcodec/h263dec.c
==============================================================================
--- trunk/libavcodec/h263dec.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/h263dec.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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,
 };

Modified: trunk/libavcodec/kgv1dec.c
==============================================================================
--- trunk/libavcodec/kgv1dec.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/kgv1dec.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -172,5 +172,6 @@ AVCodec kgv1_decoder = {
     NULL,
     decode_end,
     decode_frame,
+    .max_lowres = 1,
     .long_name = NULL_IF_CONFIG_SMALL("Kega Game Video"),
 };

Modified: trunk/libavcodec/libopenjpeg.c
==============================================================================
--- trunk/libavcodec/libopenjpeg.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/libopenjpeg.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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"),
 } ;

Modified: trunk/libavcodec/mjpegbdec.c
==============================================================================
--- trunk/libavcodec/mjpegbdec.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/mjpegbdec.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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"),
 };

Modified: trunk/libavcodec/mjpegdec.c
==============================================================================
--- trunk/libavcodec/mjpegdec.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/mjpegdec.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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"),
 };

Modified: trunk/libavcodec/mpeg12.c
==============================================================================
--- trunk/libavcodec/mpeg12.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/mpeg12.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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"),
 };
 

Modified: trunk/libavcodec/mpeg4videodec.c
==============================================================================
--- trunk/libavcodec/mpeg4videodec.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/mpeg4videodec.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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,
 };

Modified: trunk/libavcodec/msmpeg4.c
==============================================================================
--- trunk/libavcodec/msmpeg4.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/msmpeg4.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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,
 };

Modified: trunk/libavcodec/pngdec.c
==============================================================================
--- trunk/libavcodec/pngdec.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/pngdec.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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"),
 };

Modified: trunk/libavcodec/pnmdec.c
==============================================================================
--- trunk/libavcodec/pnmdec.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/pnmdec.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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

Modified: trunk/libavcodec/rv10.c
==============================================================================
--- trunk/libavcodec/rv10.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/rv10.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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,
 };

Modified: trunk/libavcodec/sp5xdec.c
==============================================================================
--- trunk/libavcodec/sp5xdec.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/sp5xdec.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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)"),
 };
 

Modified: trunk/libavcodec/utils.c
==============================================================================
--- trunk/libavcodec/utils.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/utils.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -506,6 +506,13 @@ int attribute_align_arg avcodec_open(AVC
     }
     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;

Modified: trunk/libavcodec/wmv2dec.c
==============================================================================
--- trunk/libavcodec/wmv2dec.c	Wed Jul  7 22:23:56 2010	(r24097)
+++ trunk/libavcodec/wmv2dec.c	Wed Jul  7 23:23:36 2010	(r24098)
@@ -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,
 };



More information about the ffmpeg-cvslog mailing list