XVideo
   HOME

TheInfoList



OR:

The X video extension, often abbreviated as XVideo or Xv, is a video output mechanism for the
X Window System The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems. X provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting wit ...
. The protocol was designed by David Carver; the specification for version 2 of the protocol was written in July 1991.Official XVideo specification, version 2.0
/ref> It is mainly used today to resize video content in the video controller hardware in order to enlarge a given video or to watch it in full screen mode. Without XVideo, X would have to do this scaling on the main CPU. That requires a considerable amount of processing power, which could slow down or degrade the video stream; video controllers are specifically designed for this kind of computation, so can do it much more cheaply. Similarly, the X video extension can have the video controller perform
color space A color space is a specific organization of colors. In combination with color profiling supported by various physical devices, it supports reproducible representations of colorwhether such representation entails an analog or a digital represent ...
conversions, and change the contrast, brightness, and hue of a displayed video stream. In order for this to work, three things have to come together: * The video controller has to provide the required functions. * The
device driver In computing, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer or automaton. A driver provides a software interface to hardware devices, enabling operating systems and ot ...
software for the video controller and the X
display server In computing, a windowing system (or window system) is software that manages separately different parts of display screens. It is a type of graphical user interface (GUI) which implements the WIMP (windows, icons, menus, pointer) paradigm for ...
program have to implement the XVideo interface. * The video playback software has to make use of this interface. Most modern video controllers provide the functions required for XVideo; this feature is known as ''hardware scaling and
YUV YUV is a color model typically used as part of a color image pipeline. It encodes a color image or video taking human perception into account, allowing reduced bandwidth for chrominance components, compared to a "direct" RGB-representation. H ...
acceleration'' or sometimes as ''2D hardware acceleration''. The
XFree86 XFree86 is an implementation of the X Window System. It was originally written for Unix-like operating systems on IBM PC compatibles and was available for many other operating systems and platforms. It is free and open source software under the X ...
X display server has implemented XVideo since version 4.0.2. To check whether a given X display server supports XVideo, one can use the utility xdpyinfo. To check whether the video controller provides the required functions and whether the X device driver implements XVideo for any of them, one can use the xvinfo program. Video playback programs that run under the X Window system, such as
MPlayer MPlayer is a free and open-source media player software application. It is available for Linux, OS X and Microsoft Windows. Versions for OS/2, Syllable, AmigaOS, MorphOS and AROS Research Operating System are also available. A port for DOS usi ...
,
MythTV MythTV is a free and open-source home entertainment application with a simplified "10-foot user interface" design for the living room TV. It turns a computer with the necessary hardware into a network streaming digital video recorder, a digital ...
or
xine xine is a multimedia playback engine for Unix-like operating systems released under the GNU General Public License. xine is built around a shared library (xine-lib) that supports different frontend player applications. xine uses libraries ...
, typically have an option to enable XVideo output. It is very advisable to switch on this option if the system
GPU A graphics processing unit (GPU) is a specialized electronic circuit designed to manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. GPUs are used in embedded systems, mobi ...
video-hardware and device drivers supports XVideo and more modern rendering systems such as OpenGL and VDPAU are unavailable – the speedup is very noticeable even on a fast CPU. While the protocol itself has features for reading and writing of video streams from and to video adapters, in practice today only the functions XvPutImage and XvShmPutImage are used: the client program repeatedly prepares images and passes them on to the graphics hardware to be scaled, converted and displayed.


Display

After video has been scaled and prepared for display on the video card, it must be displayed. There are a few possible ways to display accelerated video at this stage. Since full acceleration means that the video controller is responsible for scaling, converting, and drawing the video, the technique used depends entirely on what the video is being drawn onto.


The role of window manager support and compositing

Under X, how video is finally drawn depends largely on the
X window manager An X window manager is a window manager that runs on top of the X Window System, a windowing system mainly used on Unix-like systems. Unlike MacOS Classic, macOS, and Microsoft Windows platforms (excepting Microsoft Windows explorer.exe shel ...
in use. With properly installed drivers, and
GPU A graphics processing unit (GPU) is a specialized electronic circuit designed to manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. GPUs are used in embedded systems, mobi ...
hardware such as supported
Intel Intel Corporation is an American multinational corporation and technology company headquartered in Santa Clara, California. It is the world's largest semiconductor chip manufacturer by revenue, and is one of the developers of the x86 seri ...
,
ATI Ati or ATI may refer to: * Ati people, a Negrito ethnic group in the Philippines **Ati language (Philippines), the language spoken by this people group ** Ati-Atihan festival, an annual celebration held in the Philippines *Ati language (China), a ...
, and
nVidia Nvidia CorporationOfficially written as NVIDIA and stylized in its logo as VIDIA with the lowercase "n" the same height as the uppercase "VIDIA"; formerly stylized as VIDIA with a large italicized lowercase "n" on products from the mid 1990s to ...
chip sets, some
window managers A window manager is system software that controls the placement and appearance of windows within a windowing system in a graphical user interface. Most window managers are designed to help provide a desktop environment. They work in conjunction ...
, called
compositing window manager A compositing window manager, or compositor, is a window manager that provides applications with an off-screen data buffer, buffer for each window. The window manager Compositing, composites the window buffers into an image representing the screen ...
s, allow windows to be separately processed and then rendered (or composited). This involves all windows being rendered to separate output buffers in memory first, and later combined to form a complete graphical interface. While in (video) memory, individual windows can be transformed separately, and accelerated video may be added at this stage using a texture filter, before the window is composited and drawn. XVideo can also be used to accelerate video playback during the drawing of windows using an OpenGL Framebuffer Object or pbuffer.
Metacity Metacity was the default window manager used by the GNOME 2 desktop environment until it was replaced by Mutter in GNOME 3. It is still used by GNOME Flashback, a session for GNOME 3 that provides a similar user experience to the Gnome 2.x seri ...
, an
X window manager An X window manager is a window manager that runs on top of the X Window System, a windowing system mainly used on Unix-like systems. Unlike MacOS Classic, macOS, and Microsoft Windows platforms (excepting Microsoft Windows explorer.exe shel ...
uses compositing in this way. The compositing can also make use of 3D pipelines accelerations such as GLX_EXT_texture_from_pixmap. Among other things, this process allows many video outputs to share the same screen without interfering with each other. Other
compositing window manager A compositing window manager, or compositor, is a window manager that provides applications with an off-screen data buffer, buffer for each window. The window manager Compositing, composites the window buffers into an image representing the screen ...
s such as
Compiz Compiz () is a compositing window manager for the X Window System, using 3D graphics hardware to create fast compositing desktop effects for window management. Effects, such as a minimization animation or a cube workspace, are implemented as lo ...
also use compositing. However, on a system with limited OpenGL acceleration function, specifically the lack of an OpenGL Framebuffer Object or
pbuffer Pixel buffer or pBuffer is a feature in OpenGL and OpenGL ES platform interfaces which allows for off-screen rendering. It is specified as an extension to WGL API, and a core feature of GLX GLX (initialism for "OpenGL Extension to the X Win ...
, the use of an OpenGL environment like
Xgl Xgl is an obsolete display server implementation supporting the X Window System protocol designed to take advantage of modern graphics cards via their OpenGL drivers, layered on top of OpenGL. It supports hardware acceleration of all X, OpenGL an ...
makes xv hardware accelerations impossible.


The disadvantages of chroma keying

In the event that the window manager doesn't directly support compositing, it is more difficult to isolate where the video stream should be rendered, because by the time it can be accelerated the output has already been turned into a single image. The only way to do this is usually to employ a post processed
hardware overlay In computing, hardware overlay, a type of video overlay, provides a method of rendering an image to a display screen with a dedicated memory buffer inside computer video hardware. The technique aims to improve the display of a fast-moving video im ...
, using
chroma keying Chroma key compositing, or chroma keying, is a visual-effects and post-production technique for compositing (layering) two images or video streams together based on colour hues ( chroma range). The technique has been used in many fields to r ...
. After all of the windows have already been drawn, the only pieces of information we have available are the size and position of the video window's canvas. A third piece of information is required to indicate which parts of the video window's canvas are obscured by other windows and which are not. Therefore, the video player draws its canvas using a solid color (we'll say green), and this color becomes a makeshift third dimension. When all windows have been drawn, windows covering the video player will block out the green color. When the video stream is added to the output, the graphics card can simply scan the co-ordinates of the canvas. When it encounters green, it knows it has found a visible portion of the video window, and only draws those portions of the video. This same process was also the only available option to render hardware accelerated video under
Microsoft Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washing ...
Windows XP Windows XP is a major release of Microsoft's Windows NT operating system. It was released to manufacturing on August 24, 2001, and later to retail on October 25, 2001. It is a direct upgrade to its predecessors, Windows 2000 for high-end and ...
and earlier, since its window management features were so deeply embedded into the operating system that accelerating them would have been impossible. If the window manager doesn't support compositing, post processed
hardware overlay In computing, hardware overlay, a type of video overlay, provides a method of rendering an image to a display screen with a dedicated memory buffer inside computer video hardware. The technique aims to improve the display of a fast-moving video im ...
s using
chroma keying Chroma key compositing, or chroma keying, is a visual-effects and post-production technique for compositing (layering) two images or video streams together based on colour hues ( chroma range). The technique has been used in many fields to r ...
as described in the previous paragraph can make it impossible to produce a proper
screenshot screenshot (also known as screen capture or screen grab) is a digital image that shows the contents of a computer display. A screenshot is created by the operating system or software running on the device powering the display. Additionally, s ...
s of Xvideo applications. It can also make it impossible to view this kind of playback on a secondary display when only one overlay is allowed at the hardware level.


See also

*
X-Video Motion Compensation X-Video Motion Compensation (XvMC), is an extension of the X video extension (Xv) for the X Window System. The XvMC API allows video programs to offload portions of the video decoding process to the GPU video-hardware. In theory this process shou ...


References


External links


Official X Video Extension specification, version 2.0

Additions in XVideo version 2.2



Example programs


testxv.c
on most installations, it is compiled by "gcc -o testxv testxv.c -L/usr/X11R6/lib -lX11 -lXext -lXv"
testxv2.cc
another example in C++ {{DEFAULTSORT:X Video Extension Application layer protocols Application programming interfaces Freedesktop.org X Window extensions