aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2014-07-15 16:04:49 +0200
committerNicolas George <george@nsup.org>2014-07-17 18:11:56 +0200
commit16c6795465fd7663792fe535256c760560714863 (patch)
treed393a11916ae7a590d2f6d44a32148987fc37fc7
parent36fbe3c789744ad866f292a942bfb3b5d8417e77 (diff)
downloadffmpeg-16c6795465fd7663792fe535256c760560714863.tar.gz
lavd/x11grab: check 32-bits color masks.
The X11 servers by VNC, at 32-bits depths, has the following masks: R:0x000007ff G:0x003ff800 B:0xffc00000 This is not compatible with AV_PIX_FMT_0RGB32, and the result is success with completely wrong colors.
-rw-r--r--libavdevice/x11grab.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index 3a4aaeb0d3..7271e6cb0c 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -308,7 +308,16 @@ x11grab_read_header(AVFormatContext *s1)
}
break;
case 32:
- input_pixfmt = AV_PIX_FMT_0RGB32;
+ if ( image->red_mask == 0xff0000 &&
+ image->green_mask == 0x00ff00 &&
+ image->blue_mask == 0x0000ff ) {
+ input_pixfmt = AV_PIX_FMT_0RGB32;
+ } else {
+ av_log(s1, AV_LOG_ERROR,"rgb ordering at image depth %i not supported ... aborting\n", image->bits_per_pixel);
+ av_log(s1, AV_LOG_ERROR, "color masks: r 0x%.6lx g 0x%.6lx b 0x%.6lx\n", image->red_mask, image->green_mask, image->blue_mask);
+ ret = AVERROR_PATCHWELCOME;
+ goto out;
+ }
break;
default:
av_log(s1, AV_LOG_ERROR, "image depth %i not supported ... aborting\n", image->bits_per_pixel);