avdevice/x11grab: fix error handling in pixel formats
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 4 Sep 2014 02:09:59 +0000 (04:09 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 4 Sep 2014 11:42:53 +0000 (13:42 +0200)
Reviewed-by: Benoit Fouet <benoit.fouet@free.fr>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavdevice/x11grab.c

index 120f754..e0d1dfa 100644 (file)
@@ -181,6 +181,8 @@ static int pixfmt_from_image(AVFormatContext *s, XImage *image, int *pix_fmt)
            image->blue_mask,
            image->bits_per_pixel);
 
            image->blue_mask,
            image->bits_per_pixel);
 
+    *pix_fmt = AV_PIX_FMT_NONE;
+
     switch (image->bits_per_pixel) {
     case 8:
         *pix_fmt =  AV_PIX_FMT_PAL8;
     switch (image->bits_per_pixel) {
     case 8:
         *pix_fmt =  AV_PIX_FMT_PAL8;
@@ -214,7 +216,8 @@ static int pixfmt_from_image(AVFormatContext *s, XImage *image, int *pix_fmt)
             *pix_fmt = AV_PIX_FMT_0RGB32;
         }
         break;
             *pix_fmt = AV_PIX_FMT_0RGB32;
         }
         break;
-    default:
+    }
+    if (*pix_fmt == AV_PIX_FMT_NONE) {
         av_log(s, AV_LOG_ERROR,
                "XImages with RGB mask 0x%.6lx 0x%.6lx 0x%.6lx and depth %i "
                "are currently not supported.\n",
         av_log(s, AV_LOG_ERROR,
                "XImages with RGB mask 0x%.6lx 0x%.6lx 0x%.6lx and depth %i "
                "are currently not supported.\n",