releases are sorted from youngest to oldest.
version <next>:
-- aliases and defaults for Ogg subtypes (opus, spx)
-- HEVC/H.265 RTP payload format (draft v6) packetizer and depacketizer
-- avplay now exits by default at the end of playback
+- HEVC/H.265 RTP payload format (draft v6) packetizer
+- SUP/PGS subtitle demuxer
+- ffprobe -show_pixel_formats option
+- CAST128 symmetric block cipher, ECB mode
+- STL subtitle demuxer and decoder
+- libutvideo YUV 4:2:2 10bit support
+ - XCB-based screen-grabber
+version 2.4:
+- Icecast protocol
+- ported lenscorrection filter from frei0r filter
+- large optimizations in dctdnoiz to make it usable
+- ICY metadata are now requested by default with the HTTP protocol
+- support for using metadata in stream specifiers in fftools
+- LZMA compression support in TIFF decoder
+- support for H.261 RTP payload format (RFC 4587)
+- HEVC/H.265 RTP payload format (draft v6) depacketizer
+- added codecview filter to visualize information exported by some codecs
+- Matroska 3D support thorugh side data
+- HTML generation using texi2html is deprecated in favor of makeinfo/texi2any
+- silenceremove filter
-version 11:
-- libx265 encoder
+
+version 2.3:
+- AC3 fixed-point decoding
- shuffleplanes filter
+- subfile protocol
+- Phantom Cine demuxer
- replaygain data export
+- VP7 video decoder
- Alias PIX image encoder and decoder
-- BRender PIX image decoder
-- Amazing Studio PAF playback support
-- XBM decoder
-- BMP standalone parser
-- OpenEXR image decoder
-- support encoding and decoding 4-channel SGI images
+- Improvements to the BRender PIX image decoder
+- Improvements to the XBM decoder
+- QTKit input device
+- improvements to OpenEXR image decoder
- support decoding 16-bit RLE SGI images
-- VP7 video decoder
-- LucasArts SMUSH SANM video decoder
-- LucasArts SMUSH VIMA audio decoder (ADPCM)
-- LucasArts SMUSH demuxer
-- MP2 encoding via TwoLAME
-- asettb filter
-- Silicon Graphics RLE 8-bit video decoder
-- Silicon Graphics Motion Video Compressor 1 & 2 decoder
-- Silicon Graphics Movie demuxer
+- GDI screen grabbing for Windows
+- alternative rendition support for HTTP Live Streaming
+- AVFoundation input device
+- Direct Stream Digital (DSD) decoder
+- Magic Lantern Video (MLV) demuxer
- On2 AVC (Audio for Video) decoder
-- support for decoding through DXVA2 in avconv
+- support for decoding through DXVA2 in ffmpeg
- libbs2b-based stereo-to-binaural audio filter
+- libx264 reference frames count limiting depending on level
- native Opus decoder
- display matrix export and rotation API
-- drop avserver, it was unmaintained for years and largely broken
-- Icecast protocol
-- request Icecast metadata by default
-- support for using metadata in stream specifiers in avtools
-- Matroska 3D support
+- WebVTT encoder
+- showcqt multimedia filter
+- zoompan filter
+- signalstats filter
+- hqx filter (hq2x, hq3x, hq4x)
+- flanger filter
+- Image format auto-detection
+- LRC demuxer and muxer
+- Samba protocol (via libsmbclient)
+- WebM DASH Manifest muxer
+- libfribidi support in drawtext
-version 10:
-- av_strnstr
-- support ID3v2 tags in ASF files
+version 2.2:
+
+- HNM version 4 demuxer and video decoder
+- Live HDS muxer
+- setsar/setdar filters now support variables in ratio expressions
+- elbg filter
+- string validation in ffprobe
+- support for decoding through VDPAU in ffmpeg (the -hwaccel option)
+- complete Voxware MetaSound decoder
+- remove mp3_header_compress bitstream filter
+- Windows resource files for shared libraries
+- aeval filter
+- stereoscopic 3d metadata handling
+- WebP encoding via libwebp
+- ATRAC3+ decoder
+- VP8 in Ogg demuxing
+- side & metadata support in NUT
+- framepack filter
+- XYZ12 rawvideo support in NUT
+- Exif metadata support in WebP decoder
+- OpenGL device
+- Use metadata_header_padding to control padding in ID3 tags (currently used in
+ MP3, AIFF, and OMA files), FLAC header, and the AVI "junk" block.
+- Mirillis FIC video decoder
+- Support DNx444
+- libx265 encoder
+- dejudder filter
+- Autodetect VDA like all other hardware accelerations
+- aliases and defaults for Ogg subtypes (opus, spx)
+
+
+version 2.1:
+
+- aecho filter
+- perspective filter ported from libmpcodecs
+- ffprobe -show_programs option
+- compand filter
+- RTMP seek support
+- when transcoding with ffmpeg (i.e. not streamcopying), -ss is now accurate
+ even when used as an input option. Previous behavior can be restored with
+ the -noaccurate_seek option.
+- ffmpeg -t option can now be used for inputs, to limit the duration of
+ data read from an input file
+- incomplete Voxware MetaSound decoder
+- read EXIF metadata from JPEG
+- DVB teletext decoder
+- phase filter ported from libmpcodecs
+- w3fdif filter
+- Opus support in Matroska
+- FFV1 version 1.3 is stable and no longer experimental
+- FFV1: YUVA(444,422,420) 9, 10 and 16 bit support
+- changed DTS stream id in lavf mpeg ps muxer from 0x8a to 0x88, to be
+ more consistent with other muxers.
+- adelay filter
+- pullup filter ported from libmpcodecs
+- ffprobe -read_intervals option
+- Lossless and alpha support for WebP decoder
+- Error Resilient AAC syntax (ER AAC LC) decoding
+- Low Delay AAC (ER AAC LD) decoding
+- mux chapters in ASF files
+- SFTP protocol (via libssh)
+- libx264: add ability to encode in YUVJ422P and YUVJ444P
+- Fraps: use BT.709 colorspace by default for yuv, as reference fraps decoder does
+- make decoding alpha optional for prores, ffv1 and vp6 by setting
+ the skip_alpha flag.
+- ladspa wrapper filter
+- native VP9 decoder
+- dpx parser
+- max_error_rate parameter in ffmpeg
+- PulseAudio output device
+- ReplayGain scanner
+- Enhanced Low Delay AAC (ER AAC ELD) decoding (no LD SBR support)
+- Linux framebuffer output device
+- HEVC decoder
+- raw HEVC, HEVC in MOV/MP4, HEVC in Matroska, HEVC in MPEG-TS demuxing
+- mergeplanes filter
+
+
+version 2.0:
+
+- curves filter
- reference-counting for AVFrame and AVPacket data
-- avconv now fails when input options are used for output file
+- ffmpeg now fails when input options are used for output file
or vice versa
-- avconv options -filter_script and -filter_complex_script, which allow a
+- support for Monkey's Audio versions from 3.93
+- perms and aperms filters
+- audio filtering support in ffplay
+- 10% faster aac encoding on x86 and MIPS
+- sine audio filter source
+- WebP demuxing and decoding support
+- ffmpeg options -filter_script and -filter_complex_script, which allow a
filtergraph description to be read from a file
+- OpenCL support
+- audio phaser filter
+- separatefields filter
+- libquvi demuxer
- uniform options syntax across all filters
+- telecine filter
- interlace filter
-- JPEG 2000 decoder
-- asetpts filter (same as setpts, but for audio)
+- smptehdbars source
+- inverse telecine filters (fieldmatch and decimate)
+- colorbalance filter
+- colorchannelmixer filter
+- The matroska demuxer can now output proper verbatim ASS packets. It will
+ become the default at the next libavformat major bump.
+- decent native animated GIF encoding
+- asetrate filter
+- interleave filter
+- timeline editing with filters
+- vidstabdetect and vidstabtransform filters for video stabilization using
+ the vid.stab library
+- astats filter
- trim and atrim filters
-- avconv -t and -ss (output-only) options are now sample-accurate when
+- ffmpeg -t and -ss (output-only) options are now sample-accurate when
transcoding audio
- Matroska muxer can now put the index at the beginning of the file.
-- avconv -deinterlace option removed, the yadif filter should be used instead
+- extractplanes filter
+- avectorscope filter
+- ADPCM DTK decoder
+- ADP demuxer
+- RSD demuxer
+- RedSpark demuxer
+- ADPCM IMA Radical decoder
+- zmq filters
+- DCT denoiser filter (dctdnoiz)
+- Wavelet denoiser filter ported from libmpcodecs as owdenoise (formerly "ow")
- Apple Intermediate Codec decoder
- Escape 130 video decoder
+- FTP protocol support
+- V4L2 output device
+- 3D LUT filter (lut3d)
+- SMPTE 302M audio encoder
- support for slice multithreading in libavfilter
+- Hald CLUT support (generation and filtering)
- VC-1 interlaced B-frame support
- support for WavPack muxing (raw and in Matroska)
+- XVideo output device
+- vignette filter
+- True Audio (TTA) encoder
- Go2Webinar decoder
+- mcdeint filter ported from libmpcodecs
+- sab filter ported from libmpcodecs
+- ffprobe -show_chapters option
- WavPack encoding through libwavpack
-- Added the -n parameter to avconv
-- RTMP seek support
-- when transcoding with avconv (i.e. not streamcopying), -ss is now accurate
- even when used as an input option. Previous behavior can be restored with
- the -noaccurate_seek option.
-- avconv -t option can now be used for inputs, to limit the duration of
- data read from an input file
-- Voxware MetaSound decoder
-- WebP decoder
-- Error Resilient AAC syntax (ER AAC LC) decoding
-- Low Delay AAC (ER AAC LD) decoding
-- mux chapters in ASF files
-- Opus in Ogg demuxing
-- Enhanced Low Delay AAC (ER AAC ELD) decoding (no LD SBR support)
-- F4V muxer
-- HNM version 4 demuxer and video decoder
-- HEVC decoder
-- raw HEVC, HEVC in MOV/MP4, HEVC in Matroska, HEVC in MPEG-TS demuxing
-- remove avplay -vismv option, which has not worked for a long time
-- Live HDS muxer
-- setsar/setdar filters now support variables in ratio expressions
-- dar variable in the scale filter now returns the actual DAR (i.e. a * sar)
-- VP9 decoder
-- support for decoding through VDPAU in avconv (the -hwaccel option)
-- remove mp3_header_(de)compress bitstream filters
-- stereoscopic 3d metadata handling
-- png standalone parser
-- WebP encoding via libwebp
-- ATRAC3+ decoder
-- framepack filter
-- Mirillis FIC video decoder
-- Support DNx444
-- compand audio filter
+- rotate filter
+- spp filter ported from libmpcodecs
+- libgme support
+- psnr filter
-version 9:
-- av_basename and av_dirname
-- adobe and limelight publisher authentication in RTMP
+version 1.2:
+
- VDPAU hardware acceleration through normal hwaccel
- SRTP support
+- Error diffusion dither in Swscale
+- Chained Ogg support
+- Theora Midstream reconfiguration support
+- EVRC decoder
+- audio fade filter
+- filtering audio with unknown channel layout
+- allpass, bass, bandpass, bandreject, biquad, equalizer, highpass, lowpass
+ and treble audio filter
+- improved showspectrum filter, with multichannel support and sox-like colors
+- histogram filter
+- tee muxer
+- il filter ported from libmpcodecs
+- support ID3v2 tags in ASF files
+- encrypted TTA stream decoding support
+- RF64 support in WAV muxer
+- noise filter ported from libmpcodecs
+- Subtitles character encoding conversion
+- blend filter
+- stereo3d filter ported from libmpcodecs
-version 9_beta3:
-- ashowinfo audio filter
+version 1.1:
+
+- stream disposition information printing in ffprobe
+- filter for loudness analysis following EBU R128
+- Opus encoder using libopus
+- ffprobe -select_streams option
+- Pinnacle TARGA CineWave YUV16 decoder
+- TAK demuxer, decoder and parser
+- DTS-HD demuxer
+- remove -same_quant, it hasn't worked for years
+- FFM2 support
+- X-Face image encoder and decoder
- 24-bit FLAC encoding
-- audio volume filter
-- deprecated the avconv -vol option. the volume filter is to be used instead.
- multi-channel ALAC encoding up to 7.1
-- TAK demuxer, parser, and decoder
-- adaptive frame-level multithreading for H.264
-
-
-version 9_beta2:
- metadata (INFO tag) support in WAV muxer
+- subtitles raw text decoder
- support for building DLLs using MSVC
-- remove avserver daemon mode
+- LVF demuxer
+- ffescape tool
+- metadata (info chunk) support in CAF muxer
+- field filter ported from libmpcodecs
+- AVR demuxer
+- geq filter ported from libmpcodecs
+- remove ffserver daemon mode
+- AST muxer/demuxer
+- new expansion syntax for drawtext
+- BRender PIX image decoder
+- ffprobe -show_entries option
+- ffprobe -sections option
+- ADPCM IMA Dialogic decoder
+- BRSTM demuxer
+- animated GIF decoder and demuxer
+- PVF demuxer
+- subtitles filter
+- IRCAM muxer/demuxer
+- Paris Audio File demuxer
+- Virtual concatenation demuxer
+- VobSub demuxer
+- JSON captions for TED talks decoding support
+- SOX Resampler support in libswresample
+- aselect filter
+- SGI RLE 8-bit / Silicon Graphics RLE 8-bit video decoder
+- Silicon Graphics Motion Video Compressor 1 & 2 decoder
+- Silicon Graphics Movie demuxer
+- apad filter
+- Resolution & pixel format change support with multithreading for H.264
+- documentation split into per-component manuals
+- pp (postproc) filter ported from MPlayer
+- NIST Sphere demuxer
+- MPL2, VPlayer, MPlayer, AQTitle, PJS and SubViewer v1 subtitles demuxers and decoders
+- Sony Wave64 muxer
+- adobe and limelight publisher authentication in RTMP
+- data: URI scheme
- support building on the Plan 9 operating system
-- ffv1: support version 1.3
+- kerndeint filter ported from MPlayer
+- histeq filter ported from VirtualDub
+- Megalux Frame demuxer
+- 012v decoder
+- Improved AVC Intra decoding support
-version 9_beta1:
+version 1.0:
-- XWD encoder and decoder
-- Support for fragmentation in the mov/mp4 muxer
-- ISMV (Smooth Streaming) muxer
-- CDXL demuxer and decoder
-- Apple ProRes encoder
-- Sun Rasterfile Encoder
-- remove libpostproc
-- ID3v2 attached pictures reading and writing
-- WMA Lossless decoder
-- XBM encoder
-- RealAudio Lossless decoder
-- ZeroCodec decoder
-- drop support for avconv without libavfilter
-- add libavresample audio conversion library
-- audio filters support in libavfilter and avconv
-- add fps filter
-- audio split filter
-- audio mix filter
-- avprobe output is now standard INI or JSON. The old format can still
- be used with -of old.
+- INI and flat output in ffprobe
+- Scene detection in libavfilter
- Indeo Audio decoder
- channelsplit audio filter
+- setnsamples audio filter
+- atempo filter
+- ffprobe -show_data option
- RTMPT protocol support
- iLBC encoding/decoding via libilbc
- Microsoft Screen 1 decoder
--enable-libx264 enable H.264 encoding via x264 [no]
--enable-libx265 enable HEVC encoding via x265 [no]
--enable-libxavs enable AVS encoding via xavs [no]
+ --enable-libxcb enable X11 grabbing using XCB [no]
+ --enable-libxcb-shm enable X11 grabbing shm communication [auto]
+ --enable-libxcb-xfixes enable X11 grabbing mouse rendering [auto]
--enable-libxvid enable Xvid encoding via xvidcore,
native MPEG-4/Xvid encoder exists [no]
+ --enable-libzmq enable message passing via libzmq [no]
+ --enable-libzvbi enable teletext support via libzvbi [no]
+ --disable-lzma disable lzma [autodetect]
+ --enable-decklink enable Blackmagick DeckLink I/O support [no]
+ --enable-openal enable OpenAL 1.1 capture support [no]
+ --enable-opencl enable OpenCL code
+ --enable-opengl enable OpenGL rendering [no]
--enable-openssl enable openssl [no]
- --enable-x11grab enable X11 grabbing [no]
+ --disable-sdl disable sdl [autodetect]
- --enable-zlib enable zlib [autodetect]
+ --enable-x11grab enable X11 grabbing (legacy) [no]
+ --disable-xlib disable xlib [autodetect]
+ --disable-zlib disable zlib [autodetect]
Toolchain options:
--arch=ARCH select architecture [$arch]
libx264
libx265
libxavs
+ libxcb
+ libxcb_shm
+ libxcb_xfixes
libxvid
+ libzmq
+ libzvbi
+ lzma
+ openal
+ opencl
+ opengl
openssl
+ sdl
x11grab
+ xlib
zlib
"
oss_indev_deps_any="soundcard_h sys_soundcard_h"
oss_outdev_deps_any="soundcard_h sys_soundcard_h"
pulse_indev_deps="libpulse"
+pulse_outdev_deps="libpulse"
+qtkit_indev_extralibs="-framework QTKit -framework Foundation -framework QuartzCore"
+qtkit_indev_select="qtkit"
+sdl_outdev_deps="sdl"
sndio_indev_deps="sndio_h"
sndio_outdev_deps="sndio_h"
+v4l_indev_deps="linux_videodev_h"
v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
+v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
vfwcap_indev_extralibs="-lavicap32"
+xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
+xv_outdev_extralibs="-lXv -lX11 -lXext"
x11grab_indev_deps="x11grab"
+ x11grab_xcb_indev_deps="libxcb"
# protocols
+bluray_protocol_deps="libbluray"
ffrtmpcrypt_protocol_deps="!librtmp_protocol"
ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
ffrtmpcrypt_protocol_select="tcp_protocol"
if enabled libcdio; then
check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
- check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio
+ check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
+ die "ERROR: libcdio-paranoia not found"
fi
-check_lib X11/Xlib.h XOpenDisplay -lX11 && enable xlib
+enabled xlib &&
+ check_lib X11/Xlib.h XOpenDisplay -lX11 || disable xlib
- enabled x11grab &&
- require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
- require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes &&
- { enabled xlib || die "ERROR: Xlib not found"; }
+ if enabled libxcb || enabled x11grab && ! disabled libxcb; then
+ check_pkg_config xcb-event xcb/xcb.h xcb_connect || {
+ enabled libxcb && die "ERROR: libxcb not found";
+ } && disable x11grab && enable libxcb
+
+ disabled libxcb_shm ||
+ check_pkg_config xcb-shm xcb/shm.h xcb_shm_attach || {
+ enabled libxcb_shm && die "ERROR: libxcb_shm not found";
+ } && check_header sys/shm.h && enable libxcb_shm
+
+ disabled libxcb_xfixes ||
+ check_pkg_config xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image || {
+ enabled libxcb_xfixes && die "ERROR: libxcb_xfixes not found";
+ } && enable libxcb_xfixes
+
+ add_cflags "$xcb_event_cflags $xcb_shm_cflags $xcb_xfixes_cflags"
+ add_extralibs "$xcb_event_libs $xcb_shm_libs $xcb_xfixes_libs"
+ fi
+
+ if enabled x11grab; then
+ enabled xlib || die "ERROR: Xlib not found"
+ require Xext X11/extensions/XShm.h XShmCreateImage -lXext
+ require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
+ fi
+check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs"
+
+enabled dxva2api_h &&
+ check_cc <<EOF && enable dxva2api_cobj
+#define _WIN32_WINNT 0x0600
+#define COBJMACROS
+#include <windows.h>
+#include <d3d9.h>
+#include <dxva2api.h>
+int main(void) { IDirectXVideoDecoder *o = NULL; IDirectXVideoDecoder_Release(o); return 0; }
+EOF
+
+enabled vaapi &&
+ check_lib va/va.h vaInitialize -lva ||
+ disable vaapi
+
enabled vdpau &&
check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
disable vdpau
# input/output devices
OBJS-$(CONFIG_ALSA_INDEV) += alsa-audio-common.o \
- alsa-audio-dec.o
+ alsa-audio-dec.o timefilter.o
OBJS-$(CONFIG_ALSA_OUTDEV) += alsa-audio-common.o \
alsa-audio-enc.o
+OBJS-$(CONFIG_AVFOUNDATION_INDEV) += avfoundation.o
OBJS-$(CONFIG_BKTR_INDEV) += bktr.o
+OBJS-$(CONFIG_CACA_OUTDEV) += caca.o
+OBJS-$(CONFIG_DECKLINK_OUTDEV) += decklink_enc.o decklink_enc_c.o decklink_common.o
+OBJS-$(CONFIG_DECKLINK_INDEV) += decklink_dec.o decklink_dec_c.o decklink_common.o
+OBJS-$(CONFIG_DSHOW_INDEV) += dshow.o dshow_enummediatypes.o \
+ dshow_enumpins.o dshow_filter.o \
+ dshow_pin.o dshow_common.o
OBJS-$(CONFIG_DV1394_INDEV) += dv1394.o
-OBJS-$(CONFIG_FBDEV_INDEV) += fbdev.o
+OBJS-$(CONFIG_FBDEV_INDEV) += fbdev_dec.o \
+ fbdev_common.o
+OBJS-$(CONFIG_FBDEV_OUTDEV) += fbdev_enc.o \
+ fbdev_common.o
+OBJS-$(CONFIG_GDIGRAB_INDEV) += gdigrab.o
+OBJS-$(CONFIG_IEC61883_INDEV) += iec61883.o
OBJS-$(CONFIG_JACK_INDEV) += jack_audio.o timefilter.o
+OBJS-$(CONFIG_LAVFI_INDEV) += lavfi.o
+OBJS-$(CONFIG_OPENAL_INDEV) += openal-dec.o
+OBJS-$(CONFIG_OPENGL_OUTDEV) += opengl_enc.o
OBJS-$(CONFIG_OSS_INDEV) += oss_audio.o oss_audio_dec.o
OBJS-$(CONFIG_OSS_OUTDEV) += oss_audio.o oss_audio_enc.o
-OBJS-$(CONFIG_PULSE_INDEV) += pulse.o
+OBJS-$(CONFIG_PULSE_INDEV) += pulse_audio_dec.o \
+ pulse_audio_common.o
+OBJS-$(CONFIG_PULSE_OUTDEV) += pulse_audio_enc.o \
+ pulse_audio_common.o
+OBJS-$(CONFIG_QTKIT_INDEV) += qtkit.o
+OBJS-$(CONFIG_SDL_OUTDEV) += sdl.o
OBJS-$(CONFIG_SNDIO_INDEV) += sndio_common.o sndio_dec.o
OBJS-$(CONFIG_SNDIO_OUTDEV) += sndio_common.o sndio_enc.o
-OBJS-$(CONFIG_V4L2_INDEV) += v4l2.o
+OBJS-$(CONFIG_V4L2_INDEV) += v4l2.o v4l2-common.o timefilter.o
+OBJS-$(CONFIG_V4L2_OUTDEV) += v4l2enc.o v4l2-common.o
+OBJS-$(CONFIG_V4L_INDEV) += v4l.o
OBJS-$(CONFIG_VFWCAP_INDEV) += vfwcap.o
-OBJS-$(CONFIG_X11GRAB_XLIB_INDEV) += x11grab.o
+OBJS-$(CONFIG_X11GRAB_INDEV) += x11grab.o
+ OBJS-$(CONFIG_X11GRAB_XCB_INDEV) += xcbgrab.o
+OBJS-$(CONFIG_XV_OUTDEV) += xv.o
# external libraries
OBJS-$(CONFIG_LIBCDIO_INDEV) += libcdio.o
/* devices */
REGISTER_INOUTDEV(ALSA, alsa);
+ REGISTER_INDEV (AVFOUNDATION, avfoundation);
REGISTER_INDEV (BKTR, bktr);
+ REGISTER_OUTDEV (CACA, caca);
+ REGISTER_INOUTDEV(DECKLINK, decklink);
+ REGISTER_INDEV (DSHOW, dshow);
REGISTER_INDEV (DV1394, dv1394);
- REGISTER_INDEV (FBDEV, fbdev);
+ REGISTER_INOUTDEV(FBDEV, fbdev);
+ REGISTER_INDEV (GDIGRAB, gdigrab);
+ REGISTER_INDEV (IEC61883, iec61883);
REGISTER_INDEV (JACK, jack);
+ REGISTER_INDEV (LAVFI, lavfi);
+ REGISTER_INDEV (OPENAL, openal);
+ REGISTER_OUTDEV (OPENGL, opengl);
REGISTER_INOUTDEV(OSS, oss);
- REGISTER_INDEV (PULSE, pulse);
+ REGISTER_INOUTDEV(PULSE, pulse);
+ REGISTER_INDEV (QTKIT, qtkit);
+ REGISTER_OUTDEV (SDL, sdl);
REGISTER_INOUTDEV(SNDIO, sndio);
- REGISTER_INDEV (V4L2, v4l2);
+ REGISTER_INOUTDEV(V4L2, v4l2);
+// REGISTER_INDEV (V4L, v4l
REGISTER_INDEV (VFWCAP, vfwcap);
REGISTER_INDEV (X11GRAB, x11grab);
+ REGISTER_INDEV (X11GRAB_XCB, x11grab_xcb);
+ REGISTER_OUTDEV (XV, xv);
/* external libraries */
REGISTER_INDEV (LIBCDIO, libcdio);
#include "libavutil/version.h"
-#define LIBAVDEVICE_VERSION_MAJOR 55
-#define LIBAVDEVICE_VERSION_MINOR 1
-#define LIBAVDEVICE_VERSION_MICRO 0
+#define LIBAVDEVICE_VERSION_MAJOR 56
- #define LIBAVDEVICE_VERSION_MINOR 1
++#define LIBAVDEVICE_VERSION_MINOR 2
+#define LIBAVDEVICE_VERSION_MICRO 100
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
LIBAVDEVICE_VERSION_MINOR, \
--- /dev/null
- * This file is part of Libav.
+ /*
+ * XCB input grabber
+ * Copyright (C) 2014 Luca Barbato <lu_zero@gentoo.org>
+ *
- * Libav is free software; you can redistribute it and/or
++ * This file is part of FFmpeg.
+ *
- * Libav is distributed in the hope that it will be useful,
++ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
- * License along with Libav; if not, write to the Free Software
++ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
++ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ #include "config.h"
+
+ #include <stdlib.h>
+ #include <xcb/xcb.h>
+
+ #if CONFIG_LIBXCB_XFIXES
+ #include <xcb/xfixes.h>
+ #endif
+
+ #if CONFIG_LIBXCB_SHM
+ #include <sys/shm.h>
+ #include <xcb/shm.h>
+ #endif
+
+ #include "libavformat/avformat.h"
+ #include "libavformat/internal.h"
+
+ #include "libavutil/mathematics.h"
+ #include "libavutil/opt.h"
+ #include "libavutil/parseutils.h"
+ #include "libavutil/time.h"
+
+ typedef struct XCBGrabContext {
+ const AVClass *class;
+
+ xcb_connection_t *conn;
+ xcb_screen_t *screen;
+ xcb_window_t window;
+ xcb_shm_seg_t segment;
+
+ int64_t time_frame;
+ AVRational time_base;
+
+ int x, y;
+ int width, height;
+ int frame_size;
+ int bpp;
+
+ int draw_mouse;
+ int follow_mouse;
+ int show_region;
+ int region_border;
+ int centered;
+
+ const char *video_size;
+ const char *framerate;
+
+ int has_shm;
+ } XCBGrabContext;
+
+ #define FOLLOW_CENTER -1
+
+ #define OFFSET(x) offsetof(XCBGrabContext, x)
+ #define D AV_OPT_FLAG_DECODING_PARAM
+ static const AVOption options[] = {
+ { "x", "Initial x coordinate.", OFFSET(x), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, D },
+ { "y", "Initial y coordinate.", OFFSET(y), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, D },
+ { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = "vga" }, 0, 0, D },
+ { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "ntsc" }, 0, 0, D },
+ { "draw_mouse", "Draw the mouse pointer.", OFFSET(draw_mouse), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, D },
+ { "follow_mouse", "Move the grabbing region when the mouse pointer reaches within specified amount of pixels to the edge of region.",
+ OFFSET(follow_mouse), AV_OPT_TYPE_INT, { .i64 = 0 }, FOLLOW_CENTER, INT_MAX, D, "follow_mouse" },
+ { "centered", "Keep the mouse pointer at the center of grabbing region when following.", 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, INT_MIN, INT_MAX, D, "follow_mouse" },
+ { "show_region", "Show the grabbing region.", OFFSET(show_region), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D },
+ { "region_border", "Set the region border thickness.", OFFSET(region_border), AV_OPT_TYPE_INT, { .i64 = 3 }, 1, 128, D },
+ { NULL },
+ };
+
+ static const AVClass xcbgrab_class = {
+ .class_name = "xcbgrab indev",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+ };
+
+ static int xcbgrab_reposition(AVFormatContext *s,
+ xcb_query_pointer_reply_t *p,
+ xcb_get_geometry_reply_t *geo)
+ {
+ XCBGrabContext *c = s->priv_data;
+ int x = c->x, y = c->y, p_x = p->win_x, p_y = p->win_y;
+ int w = c->width, h = c->height, f = c->follow_mouse;
+
+ if (!p || !geo)
+ return AVERROR(EIO);
+
+ if (f == FOLLOW_CENTER) {
+ x = p_x - w / 2;
+ y = p_y - h / 2;
+ } else {
+ int left = x + f;
+ int right = x + w - f;
+ int top = y + f;
+ int bottom = y + h + f;
+ if (p_x > right) {
+ x += p_x - right;
+ } else if (p_x < left) {
+ x -= left - p_x;
+ }
+ if (p_y > bottom) {
+ y += p_y - bottom;
+ } else if (p_y < top) {
+ y -= top - p_y;
+ }
+ }
+
+ c->x = FFMIN(FFMAX(0, x), geo->width - w);
+ c->y = FFMIN(FFMAX(0, y), geo->height - h);
+
+ return 0;
+ }
+
+ static int xcbgrab_frame(AVFormatContext *s, AVPacket *pkt)
+ {
+ XCBGrabContext *c = s->priv_data;
+ xcb_get_image_cookie_t iq;
+ xcb_get_image_reply_t *img;
+ xcb_drawable_t drawable = c->screen->root;
+ uint8_t *data;
+ int length, ret;
+
+ iq = xcb_get_image(c->conn, XCB_IMAGE_FORMAT_Z_PIXMAP, drawable,
+ c->x, c->y, c->width, c->height, ~0);
+
+ img = xcb_get_image_reply(c->conn, iq, NULL);
+ if (!img)
+ return AVERROR(EAGAIN);
+
+ data = xcb_get_image_data(img);
+ length = xcb_get_image_data_length(img);
+
+ ret = av_new_packet(pkt, length);
+
+ if (!ret)
+ memcpy(pkt->data, data, length);
+
+ free(img);
+
+ return ret;
+ }
+
+ static void wait_frame(AVFormatContext *s, AVPacket *pkt)
+ {
+ XCBGrabContext *c = s->priv_data;
+ int64_t curtime, delay;
+ int64_t frame_time = av_rescale_q(1, c->time_base, AV_TIME_BASE_Q);
+
+ c->time_frame += frame_time;
+
+ for (;;) {
+ curtime = av_gettime();
+ delay = c->time_frame - curtime;
+ if (delay <= 0)
+ break;
+ av_usleep(delay);
+ }
+
+ pkt->pts = curtime;
+ }
+
+ #if CONFIG_LIBXCB_SHM
+ static int check_shm(xcb_connection_t *conn)
+ {
+ xcb_shm_query_version_cookie_t cookie = xcb_shm_query_version(conn);
+ xcb_shm_query_version_reply_t *reply;
+
+ reply = xcb_shm_query_version_reply(conn, cookie, NULL);
+ if (reply) {
+ free(reply);
+ return 1;
+ }
+
+ return 0;
+ }
+
+ static void dealloc_shm(void *unused, uint8_t *data)
+ {
+ shmdt(data);
+ }
+
+ static int xcbgrab_frame_shm(AVFormatContext *s, AVPacket *pkt)
+ {
+ XCBGrabContext *c = s->priv_data;
+ xcb_shm_get_image_cookie_t iq;
+ xcb_shm_get_image_reply_t *img;
+ xcb_drawable_t drawable = c->screen->root;
+ uint8_t *data;
+ int size = c->frame_size + FF_INPUT_BUFFER_PADDING_SIZE;
+ int id = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777);
+ xcb_generic_error_t *e = NULL;
+
+ if (id == -1) {
+ char errbuf[1024];
+ int err = AVERROR(errno);
+ av_strerror(err, errbuf, sizeof(errbuf));
+ av_log(s, AV_LOG_ERROR, "Cannot get %d bytes of shared memory: %s.\n",
+ size, errbuf);
+ return err;
+ }
+
+ xcb_shm_attach(c->conn, c->segment, id, 0);
+
+ iq = xcb_shm_get_image(c->conn, drawable,
+ c->x, c->y, c->width, c->height, ~0,
+ XCB_IMAGE_FORMAT_Z_PIXMAP, c->segment, 0);
+
+ xcb_shm_detach(c->conn, c->segment);
+
+ img = xcb_shm_get_image_reply(c->conn, iq, &e);
+
+ xcb_flush(c->conn);
+
+ if (e) {
+ av_log(s, AV_LOG_ERROR,
+ "Cannot get the image data "
+ "event_error: response_type:%u error_code:%u "
+ "sequence:%u resource_id:%u minor_code:%u major_code:%u.\n",
+ e->response_type, e->error_code,
+ e->sequence, e->resource_id, e->minor_code, e->major_code);
+
+ shmctl(id, IPC_RMID, 0);
+ return AVERROR(EACCES);
+ }
+
+ free(img);
+
+ data = shmat(id, NULL, 0);
+ shmctl(id, IPC_RMID, 0);
+
+ if ((intptr_t)data == -1)
+ return AVERROR(errno);
+
+ pkt->buf = av_buffer_create(data, size, dealloc_shm, NULL, 0);
+ if (!pkt->buf) {
+ shmdt(data);
+ return AVERROR(ENOMEM);
+ }
+
+ pkt->data = pkt->buf->data;
+ pkt->size = c->frame_size;
+
+ return 0;
+ }
+ #endif /* CONFIG_LIBXCB_SHM */
+
+ #if CONFIG_LIBXCB_XFIXES
+ static int check_xfixes(xcb_connection_t *conn)
+ {
+ xcb_xfixes_query_version_cookie_t cookie;
+ xcb_xfixes_query_version_reply_t *reply;
+
+ cookie = xcb_xfixes_query_version(conn, XCB_XFIXES_MAJOR_VERSION,
+ XCB_XFIXES_MINOR_VERSION);
+ reply = xcb_xfixes_query_version_reply(conn, cookie, NULL);
+
+ if (reply) {
+ free(reply);
+ return 1;
+ }
+ return 0;
+ }
+
+ #define BLEND(target, source, alpha) \
+ (target) + ((source) * (255 - (alpha)) + 255 / 2) / 255
+
+ static void xcbgrab_draw_mouse(AVFormatContext *s, AVPacket *pkt,
+ xcb_query_pointer_reply_t *p,
+ xcb_get_geometry_reply_t *geo)
+ {
+ XCBGrabContext *gr = s->priv_data;
+ uint32_t *cursor;
+ uint8_t *image = pkt->data;
+ int stride = gr->bpp / 8;
+ xcb_xfixes_get_cursor_image_cookie_t cc;
+ xcb_xfixes_get_cursor_image_reply_t *ci;
+ int cx, cy, x, y, w, h, c_off, i_off;
+
+ cc = xcb_xfixes_get_cursor_image(gr->conn);
+ ci = xcb_xfixes_get_cursor_image_reply(gr->conn, cc, NULL);
+ if (!ci)
+ return;
+
+ cursor = xcb_xfixes_get_cursor_image_cursor_image(ci);
+ if (!cursor)
+ return;
+
+ cx = ci->x - ci->xhot;
+ cy = ci->y - ci->yhot;
+
+ x = FFMAX(cx, gr->x);
+ y = FFMAX(cy, gr->y);
+
+ w = FFMIN(cx + ci->width, gr->x + gr->width) - x;
+ h = FFMIN(cy + ci->height, gr->y + gr->height) - y;
+
+ c_off = x - cx;
+ i_off = x - gr->x;
+
+ cursor += (y - cy) * ci->width;
+ image += (y - gr->y) * gr->width * stride;
+
+ for (y = 0; y < h; y++) {
+ cursor += c_off;
+ image += i_off * stride;
+ for (x = 0; x < w; x++, cursor++, image += stride) {
+ int r, g, b, a;
+
+ r = *cursor & 0xff;
+ g = (*cursor >> 8) & 0xff;
+ b = (*cursor >> 16) & 0xff;
+ a = (*cursor >> 24) & 0xff;
+
+ if (!a)
+ continue;
+
+ if (a == 255) {
+ image[0] = r;
+ image[1] = g;
+ image[2] = b;
+ } else {
+ image[0] = BLEND(r, image[0], a);
+ image[1] = BLEND(g, image[1], a);
+ image[2] = BLEND(b, image[2], a);
+ }
+
+ }
+ cursor += ci->width - w - c_off;
+ image += (gr->width - w - i_off) * stride;
+ }
+
+ free(ci);
+ }
+ #endif /* CONFIG_LIBXCB_XFIXES */
+
+ static void xcbgrab_update_region(AVFormatContext *s)
+ {
+ XCBGrabContext *c = s->priv_data;
+ const uint32_t args[] = { c->x - c->region_border,
+ c->y - c->region_border };
+
+ xcb_configure_window(c->conn,
+ c->window,
+ XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y,
+ args);
+ }
+
+ static int xcbgrab_read_packet(AVFormatContext *s, AVPacket *pkt)
+ {
+ XCBGrabContext *c = s->priv_data;
+ xcb_query_pointer_cookie_t pc;
+ xcb_get_geometry_cookie_t gc;
+ xcb_query_pointer_reply_t *p = NULL;
+ xcb_get_geometry_reply_t *geo = NULL;
+ int ret = 0;
+
+ wait_frame(s, pkt);
+
+ if (c->follow_mouse || c->draw_mouse) {
+ pc = xcb_query_pointer(c->conn, c->screen->root);
+ gc = xcb_get_geometry(c->conn, c->screen->root);
+ p = xcb_query_pointer_reply(c->conn, pc, NULL);
+ geo = xcb_get_geometry_reply(c->conn, gc, NULL);
+ }
+
+ if (c->follow_mouse && p->same_screen)
+ xcbgrab_reposition(s, p, geo);
+
+ if (c->show_region)
+ xcbgrab_update_region(s);
+
+ #if CONFIG_LIBXCB_SHM
+ if (c->has_shm && xcbgrab_frame_shm(s, pkt) < 0)
+ c->has_shm = 0;
+ #endif
+ if (!c->has_shm)
+ ret = xcbgrab_frame(s, pkt);
+
+ #if CONFIG_LIBXCB_XFIXES
+ if (c->draw_mouse && p->same_screen)
+ xcbgrab_draw_mouse(s, pkt, p, geo);
+ #endif
+
+ free(p);
+ free(geo);
+
+ return ret;
+ }
+
+ static av_cold int xcbgrab_read_close(AVFormatContext *s)
+ {
+ XCBGrabContext *ctx = s->priv_data;
+
+ xcb_disconnect(ctx->conn);
+
+ return 0;
+ }
+
+ static xcb_screen_t *get_screen(const xcb_setup_t *setup, int screen_num)
+ {
+ xcb_screen_iterator_t it = xcb_setup_roots_iterator(setup);
+ xcb_screen_t *screen = NULL;
+
+ for (; it.rem > 0; xcb_screen_next (&it)) {
+ if (!screen_num) {
+ screen = it.data;
+ break;
+ }
+
+ screen_num--;
+ }
+
+ return screen;
+ }
+
+ static int pixfmt_from_pixmap_format(AVFormatContext *s, int depth,
+ int *pix_fmt)
+ {
+ XCBGrabContext *c = s->priv_data;
+ const xcb_setup_t *setup = xcb_get_setup(c->conn);
+ const xcb_format_t *fmt = xcb_setup_pixmap_formats(setup);
+ int length = xcb_setup_pixmap_formats_length(setup);
+
+ *pix_fmt = 0;
+
+ while (length--) {
+ if (fmt->depth == depth) {
+ switch (depth) {
+ case 32:
+ if (fmt->bits_per_pixel == 32)
+ *pix_fmt = AV_PIX_FMT_ARGB;
+ break;
+ case 24:
+ if (fmt->bits_per_pixel == 32)
+ *pix_fmt = AV_PIX_FMT_RGB32;
+ else if (fmt->bits_per_pixel == 24)
+ *pix_fmt = AV_PIX_FMT_RGB24;
+ break;
+ case 16:
+ if (fmt->bits_per_pixel == 16)
+ *pix_fmt = AV_PIX_FMT_RGB565;
+ break;
+ case 15:
+ if (fmt->bits_per_pixel == 16)
+ *pix_fmt = AV_PIX_FMT_RGB555;
+ break;
+ case 8:
+ if (fmt->bits_per_pixel == 8)
+ *pix_fmt = AV_PIX_FMT_RGB8;
+ break;
+ }
+ }
+
+ if (*pix_fmt) {
+ c->bpp = fmt->bits_per_pixel;
+ c->frame_size = c->width * c->height * fmt->bits_per_pixel / 8;
+ return 0;
+ }
+
+ fmt++;
+ }
+ av_log(s, AV_LOG_ERROR, "Pixmap format not mappable.\n");
+
+ return AVERROR_PATCHWELCOME;
+ }
+
+ static int create_stream(AVFormatContext *s)
+ {
+ XCBGrabContext *c = s->priv_data;
+ AVStream *st = avformat_new_stream(s, NULL);
+ const char *opts = strchr(s->filename, '+');
+ xcb_get_geometry_cookie_t gc;
+ xcb_get_geometry_reply_t *geo;
+ int ret;
+
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ ret = av_parse_video_size(&c->width, &c->height, c->video_size);
+ if (ret < 0)
+ return ret;
+
+ ret = av_parse_video_rate(&st->avg_frame_rate, c->framerate);
+ if (ret < 0)
+ return ret;
+
+ if (opts)
+ sscanf(opts, "%d,%d", &c->x, &c->y);
+
+ avpriv_set_pts_info(st, 64, 1, 1000000);
+
+ gc = xcb_get_geometry(c->conn, c->screen->root);
+ geo = xcb_get_geometry_reply(c->conn, gc, NULL);
+
+ c->width = FFMIN(geo->width, c->width);
+ c->height = FFMIN(geo->height, c->height);
+ c->time_base = (AVRational){ st->avg_frame_rate.den,
+ st->avg_frame_rate.num };
+ c->time_frame = av_gettime();
+
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
+ st->codec->width = c->width;
+ st->codec->height = c->height;
+ st->codec->time_base = c->time_base;
+
+ ret = pixfmt_from_pixmap_format(s, geo->depth, &st->codec->pix_fmt);
+
+ free(geo);
+
+ return ret;
+ }
+
+ static void draw_rectangle(AVFormatContext *s)
+ {
+ XCBGrabContext *c = s->priv_data;
+ xcb_gcontext_t gc = xcb_generate_id(c->conn);
+ uint32_t mask = XCB_GC_FOREGROUND |
+ XCB_GC_BACKGROUND |
+ XCB_GC_LINE_WIDTH |
+ XCB_GC_LINE_STYLE |
+ XCB_GC_FILL_STYLE;
+ uint32_t values[] = { c->screen->black_pixel,
+ c->screen->white_pixel,
+ c->region_border,
+ XCB_LINE_STYLE_DOUBLE_DASH,
+ XCB_FILL_STYLE_SOLID };
+ xcb_rectangle_t r = { 1, 1,
+ c->width + c->region_border * 2 - 3,
+ c->height + c->region_border * 2 - 3 };
+
+ xcb_create_gc(c->conn, gc, c->window, mask, values);
+
+ xcb_poly_rectangle(c->conn, c->window, gc, 1, &r);
+ }
+
+ static void setup_window(AVFormatContext *s)
+ {
+ XCBGrabContext *c = s->priv_data;
+ uint32_t mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK;
+ uint32_t values[] = { 1,
+ XCB_EVENT_MASK_EXPOSURE |
+ XCB_EVENT_MASK_STRUCTURE_NOTIFY };
+ xcb_rectangle_t rect = { c->x, c->y, c->width, c->height };
+
+ c->window = xcb_generate_id(c->conn);
+
+ xcb_create_window(c->conn, XCB_COPY_FROM_PARENT,
+ c->window,
+ c->screen->root,
+ c->x - c->region_border,
+ c->y - c->region_border,
+ c->width + c->region_border * 2,
+ c->height + c->region_border * 2,
+ 0,
+ XCB_WINDOW_CLASS_INPUT_OUTPUT,
+ XCB_COPY_FROM_PARENT,
+ mask, values);
+
+ xcb_shape_rectangles(c->conn, XCB_SHAPE_SO_SUBTRACT,
+ XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
+ c->window,
+ c->region_border, c->region_border,
+ 1, &rect);
+
+ xcb_map_window(c->conn, c->window);
+
+ draw_rectangle(s);
+ }
+
+ static av_cold int xcbgrab_read_header(AVFormatContext *s)
+ {
+ XCBGrabContext *c = s->priv_data;
+ int screen_num, ret;
+ const xcb_setup_t *setup;
+
+ c->conn = xcb_connect(s->filename, &screen_num);
+ if ((ret = xcb_connection_has_error(c->conn))) {
+ av_log(s, AV_LOG_ERROR, "Cannot open display %s, error %d.\n",
+ s->filename ? s->filename : "default", ret);
+ return AVERROR(EIO);
+ }
+ setup = xcb_get_setup(c->conn);
+
+ c->screen = get_screen(setup, screen_num);
+ if (!c->screen) {
+ av_log(s, AV_LOG_ERROR, "The screen %d does not exist.\n",
+ screen_num);
+ xcbgrab_read_close(s);
+ return AVERROR(EIO);
+ }
+
+ c->segment = xcb_generate_id(c->conn);
+
+ ret = create_stream(s);
+
+ if (ret < 0) {
+ xcbgrab_read_close(s);
+ return ret;
+ }
+
+ #if CONFIG_LIBXCB_SHM
+ c->has_shm = check_shm(c->conn);
+ #endif
+
+ #if CONFIG_LIBXCB_XFIXES
+ if (c->draw_mouse) {
+ if (!(c->draw_mouse = check_xfixes(c->conn))) {
+ av_log(s, AV_LOG_WARNING,
+ "XFixes not available, cannot draw the mouse.\n");
+ }
+ if (c->bpp < 24) {
+ avpriv_report_missing_feature(s, "%d bits per pixel screen",
+ c->bpp);
+ c->draw_mouse = 0;
+ }
+ }
+ #endif
+
+ if (c->show_region)
+ setup_window(s);
+
+ return 0;
+ }
+
+ AVInputFormat ff_x11grab_xcb_demuxer = {
+ .name = "x11grab",
+ .long_name = NULL_IF_CONFIG_SMALL("X11 screen capture, using XCB"),
+ .priv_data_size = sizeof(XCBGrabContext),
+ .read_header = xcbgrab_read_header,
+ .read_packet = xcbgrab_read_packet,
+ .read_close = xcbgrab_read_close,
+ .flags = AVFMT_NOFILE,
+ .priv_class = &xcbgrab_class,
+ };