Message ID | 20210131194147.30246-1-andriy.gelman@gmail.com |
---|---|
State | Accepted |
Commit | 8e0a4d2d4d1cc56a12b3c231e444fd2e94f32ce0 |
Headers | show |
Series | [FFmpeg-devel] avdevice/xcbgrab: don't assume Xserver endianness | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
Am So., 31. Jan. 2021 um 20:51 Uhr schrieb Andriy Gelman <andriy.gelman@gmail.com>: > > From: Andriy Gelman <andriy.gelman@gmail.com> > > Xserver defines the endianness of the grabbed images. Use this information > to set the correct pixel format. lgtm if tested. Could you look at pal8? This used to work fine with x11grab... Thank you, Carl Eugen
On Sun, 31. Jan 23:28, Carl Eugen Hoyos wrote: > Am So., 31. Jan. 2021 um 20:51 Uhr schrieb Andriy Gelman > <andriy.gelman@gmail.com>: > > > > From: Andriy Gelman <andriy.gelman@gmail.com> > > > > Xserver defines the endianness of the grabbed images. Use this information > > to set the correct pixel format. > > lgtm if tested. Thanks, will apply in a few days. Do you think I should keep the docker testing instructions in the commit message? > > Could you look at pal8? This used to work fine with x11grab... Yes sure, will have a look later this week.
Am Di., 2. Feb. 2021 um 04:26 Uhr schrieb Andriy Gelman <andriy.gelman@gmail.com>: > > On Sun, 31. Jan 23:28, Carl Eugen Hoyos wrote: > > Am So., 31. Jan. 2021 um 20:51 Uhr schrieb Andriy Gelman > > <andriy.gelman@gmail.com>: > > > > > > From: Andriy Gelman <andriy.gelman@gmail.com> > > > > > > Xserver defines the endianness of the grabbed images. Use this information > > > to set the correct pixel format. > > > > lgtm if tested. > > Thanks, will apply in a few days. > Do you think I should keep the docker testing instructions in the commit > message? If you believe that testing is not trivial (I agree), then this sounds like a good idea. > > Could you look at pal8? This used to work fine with x11grab... > > Yes sure, will have a look later this week. Thank you, Carl Eugen
diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c index 95bdc8ab9d..be5d5ea2cf 100644 --- a/libavdevice/xcbgrab.c +++ b/libavdevice/xcbgrab.c @@ -513,21 +513,26 @@ static int pixfmt_from_pixmap_format(AVFormatContext *s, int depth, switch (depth) { case 32: if (fmt->bits_per_pixel == 32) - *pix_fmt = AV_PIX_FMT_0RGB; + *pix_fmt = setup->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST ? + AV_PIX_FMT_BGR0 : AV_PIX_FMT_0RGB; break; case 24: if (fmt->bits_per_pixel == 32) - *pix_fmt = AV_PIX_FMT_0RGB32; + *pix_fmt = setup->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST ? + AV_PIX_FMT_BGR0 : AV_PIX_FMT_0RGB; else if (fmt->bits_per_pixel == 24) - *pix_fmt = AV_PIX_FMT_RGB24; + *pix_fmt = setup->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST ? + AV_PIX_FMT_BGR24 : AV_PIX_FMT_RGB24; break; case 16: if (fmt->bits_per_pixel == 16) - *pix_fmt = AV_PIX_FMT_RGB565; + *pix_fmt = setup->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST ? + AV_PIX_FMT_RGB565LE : AV_PIX_FMT_RGB565BE; break; case 15: if (fmt->bits_per_pixel == 16) - *pix_fmt = AV_PIX_FMT_RGB555; + *pix_fmt = setup->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST ? + AV_PIX_FMT_RGB555LE : AV_PIX_FMT_RGB555BE; break; case 8: if (fmt->bits_per_pixel == 8)