1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
FFmpeg/libavdevice
Andriy Gelman 8e0a4d2d4d avdevice/xcbgrab: don't assume xserver endianness
xserver defines the endianness of the grabbed images. Use this information
to set the correct pixel format.

This also fixes format selection in configuration depth=32/bpp=32 with
xserver on a little endian machine. Before the patch, the big endian
layout 0RGB was always selected which is incorrect because BGR0 should
be used. RGB24 was also incorrectly assumed (but this format was removed
in xserver 1.20).

The big-endian settings can be tested using docker+qemu from a little-endian
machine:

$ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
$ docker run --rm -it -v /tmp:/tmp powerpc64/debian /bin/bash

In docker container
$ apt-get update
$ apt-get install xvfb
$ apt-get install x11-apps

To test AV_PIX_FMT_0RGB32
$ Xvfb :2 -screen 0 720x480x24 &
$ export DISPLAY=:2
$ xclock -geometry 720x480 -bg green #test different colors

On your host machine grab the frames using the following
command. View output to check that colors are rendered correctly
$ ./ffmpeg -y -f x11grab -i :2.0 -codec:v mpeg2video out.mp4

Other pixel formats can be tested by modifying how Xvfb is started in the docker
container:

AV_PIX_FMT_RGB565
$ Xvfb :2 -screen 0 720x480x16

AV_PIX_FMT_RGB555
$ Xvfb :2 -screen 0 720x480x15

AV_PIX_FMT_BGR24 / AV_PIX_FMT_RGB24
This is difficult to test because bpp=24 support was removed in xserver 1.20
https://lists.x.org/archives/xorg-devel/2018-February/056175.html?hmsr=joyk.com&utm_source=joyk.com&utm_medium=referral
However, I was able to run previous version of Xvfb (with some
modifications to force 24bpp) to check that images are rendered correctly.

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2021-02-06 11:42:12 -05:00
..
tests Merge commit '93fed46a92bab8be176d3e67be4354189a8dbe7f' 2017-03-19 16:08:27 +01:00
.gitignore lavfi,lavd: add gitignore for generated static component lists 2018-04-05 22:08:53 +01:00
alldevices.c avdevice/alldevices: stop using deprecated linked list API 2020-10-19 11:54:45 -03:00
alsa_dec.c libavdevice: Update the class name as uniform style 2019-08-15 09:29:55 +08:00
alsa_enc.c libavdevice: Update the class name as uniform style 2019-08-15 09:29:55 +08:00
alsa.c avdevice/alsa: fix indefinite stop on closing PCM capture 2019-04-23 14:01:23 -08:00
alsa.h lavd/alsa: Double maximum alsa buffer size. 2017-11-27 14:05:28 +01:00
android_camera.c avdevice/android_camera: Fix AVClass.version 2018-04-19 23:44:33 +02:00
audiotoolbox.m lavdevice: Add AudioToolbox output device. 2020-06-15 15:09:33 +02:00
avdevice.c avdevice/alldevices: stop using deprecated linked list API 2020-10-19 11:54:45 -03:00
avdevice.h Revert "lavd: add new API for iterating input and output devices" 2018-03-31 23:26:31 +01:00
avdeviceres.rc
avfoundation.m avfoundation: Fix building on iOS 2020-04-30 14:21:47 +02:00
bktr.c libavdevice: Update the class name as uniform style 2019-08-15 09:29:55 +08:00
caca.c lavd/caca: do not access deprecated codec context 2020-12-10 09:45:19 +01:00
decklink_common_c.h avdevice/decklink_dec: add support for querying RP188 High Frame Rate timecode 2020-09-13 18:06:54 +02:00
decklink_common.cpp avdevice/decklink: warn about too old decklink API version 2020-12-03 18:32:57 +01:00
decklink_common.h avdevice/decklink_enc: simplify usage of buffercount type 2020-12-03 18:32:57 +01:00
decklink_dec_c.c avdevice/decklink: remove the duplicated warning message 2020-12-05 09:00:53 +08:00
decklink_dec.cpp avdevice/decklink_dec: mark get_frame_timecode and get_bmd_timecode static 2021-01-09 17:37:02 +01:00
decklink_dec.h libavdevice/decklink: add support for -sources and -sinks arguments 2017-10-10 20:07:25 +02:00
decklink_enc_c.c avdevice/decklink: remove the duplicated warning message 2020-12-05 09:00:53 +08:00
decklink_enc.cpp avdevice/decklink: remove the duplicated warning message 2020-12-05 09:00:53 +08:00
decklink_enc.h libavdevice/decklink: add support for -sources and -sinks arguments 2017-10-10 20:07:25 +02:00
dshow_capture.h avdevice/dshow: Add namespace prefix to the remaining global symbols 2021-01-25 19:31:11 -03:00
dshow_common.c
dshow_crossbar.c lavd/dshow: Add namespace prefix to global functions 2021-01-21 20:02:23 -03:00
dshow_enummediatypes.c avdevice/dshow: Add namespace prefix to the remaining global symbols 2021-01-25 19:31:11 -03:00
dshow_enumpins.c avdevice/dshow: Add namespace prefix to the remaining global symbols 2021-01-25 19:31:11 -03:00
dshow_filter.c avdevice/dshow: Add namespace prefix to the remaining global symbols 2021-01-25 19:31:11 -03:00
dshow_pin.c avdevice/dshow: Add namespace prefix to the remaining global symbols 2021-01-25 19:31:11 -03:00
dshow.c avdevice/dshow: Add namespace prefix to the remaining global symbols 2021-01-25 19:31:11 -03:00
fbdev_common.c Merge commit '87f98a2b9d4c7218ad82bb45347a53b65e5244f3' 2015-07-11 12:25:03 +02:00
fbdev_common.h
fbdev_dec.c avdevice: migrate to AVFormatContext->url 2018-01-28 23:06:43 +01:00
fbdev_enc.c avdevice: migrate to AVFormatContext->url 2018-01-28 23:06:43 +01:00
file_open.c
gdigrab.c libavdevice/gdigrab: fix ffmpeg -devices doesn't show gdigrab 2019-05-17 21:51:20 +08:00
iec61883.c lavd/iec61883: Fix the include path for poll.h. 2019-01-16 00:13:49 +01:00
internal.h avdevice/internal: add av_warn_unused_result 2015-10-16 17:28:40 -04:00
jack.c avdevice: migrate to AVFormatContext->url 2018-01-28 23:06:43 +01:00
kmsgrab.c kmsgrab: Do not require the modifier to stay constant. 2021-01-13 23:08:02 +00:00
lavfi.c avdevice/lavfi: av_malloc -> av_malloc_array 2020-09-21 09:30:55 +08:00
libavdevice.v Merge commit '535a742c2695a9e0c586b50d7fa76e318232ff24' 2016-06-27 17:56:47 +02:00
libcdio.c avdevice: migrate to AVFormatContext->url 2018-01-28 23:06:43 +01:00
libdc1394.c lavd/libdc1394: Do not crash if dc1394_camera_new() fails. 2017-08-18 19:20:15 +02:00
Makefile lavdevice: Add AudioToolbox output device. 2020-06-15 15:09:33 +02:00
openal-dec.c libavdevice: Update the class name as uniform style 2019-08-15 09:29:55 +08:00
opengl_enc_shaders.h all: Make header guard names consistent 2016-01-31 15:44:11 -08:00
opengl_enc.c avdevice/opengl: add support of wrapped avframe codec 2020-04-16 23:52:12 +02:00
oss_dec.c libavdevice: Update the class name as uniform style 2019-08-15 09:29:55 +08:00
oss_enc.c libavdevice: Update the class name as uniform style 2019-08-15 09:29:55 +08:00
oss.c Merge commit 'b586903ae1b89e2d8b99c79f33cabe9b3ca03784' 2017-11-11 16:19:50 -03:00
oss.h Merge commit '8d26c193fb42d08602ac93ece039d4718d029adc' 2015-04-09 21:36:42 +02:00
pulse_audio_common.c
pulse_audio_common.h avdevice/pulse_audio_common: add av_warn_unused_result 2015-10-22 19:03:50 -04:00
pulse_audio_dec.c libavdevice: Update the class name as uniform style 2019-08-15 09:29:55 +08:00
pulse_audio_enc.c libavdevice: Update the class name as uniform style 2019-08-15 09:29:55 +08:00
reverse.c avdevice: make ff_reverse available on shared builds 2017-07-20 00:33:29 -03:00
sdl2.c avdevice/sdl2: add option to set window position 2018-10-23 19:42:32 +02:00
sndio_dec.c avdevice: migrate to AVFormatContext->url 2018-01-28 23:06:43 +01:00
sndio_enc.c avdevice: migrate to AVFormatContext->url 2018-01-28 23:06:43 +01:00
sndio.c Merge commit '8d26c193fb42d08602ac93ece039d4718d029adc' 2015-04-09 21:36:42 +02:00
sndio.h Merge commit '8d26c193fb42d08602ac93ece039d4718d029adc' 2015-04-09 21:36:42 +02:00
timefilter.c Merge commit 'd12b5b2f135aade4099f4b26b0fe678656158c13' 2016-05-11 19:13:03 +01:00
timefilter.h
utils.c
v4l2-common.c lavd/v4l2-common: Add an entry for Z16. 2019-03-22 12:30:47 +01:00
v4l2-common.h Merge commit '3a165c187da7d74f46f6c1778294e8c5a3a7151f' 2017-03-22 17:55:18 +01:00
v4l2.c avdevice/v4l2: Remove av_assert0 when format not supported 2019-11-06 20:38:03 +01:00
v4l2enc.c avdevice/v4l2enc: Allow writing non-rawvideos to v4l2. 2020-05-09 15:44:43 +01:00
version.h avdevice/decklink_dec: map the raw_format instead of hardcode 2020-11-21 09:14:52 +08:00
vfwcap.c lavd/vfwcap: Pass pointers to int instead of long to av_parse_video_size(). 2018-04-18 20:26:44 +02:00
xcbgrab.c avdevice/xcbgrab: don't assume xserver endianness 2021-02-06 11:42:12 -05:00
xv.c avdevice/xv: add support of wrapped avframe codec 2020-04-16 23:52:12 +02:00