xvimagesink

XvImageSink renders video frames to a drawable (XWindow) on a local display using the XVideo extension. Rendering to a remote display is theoretically possible but i doubt that the XVideo extension is actually available when connecting to a remote display. This element can receive a Window ID from the application through the GstVideoOverlay interface and will then render video frames in this drawable. If no Window ID was provided by the application, the element will create its own internal window and render into it.

Scaling

The XVideo extension, when it's available, handles hardware accelerated scaling of video frames. This means that the element will just accept incoming video frames no matter their geometry and will then put them to the drawable scaling them on the fly. Using the force-aspect-ratio property it is possible to enforce scaling with a constant aspect ratio, which means drawing black borders around the video frame.

Events

XvImageSink creates a thread to handle events coming from the drawable. There are several kind of events that can be grouped in 2 big categories: input events and window state related events. Input events will be translated to navigation events and pushed upstream for other elements to react on them. This includes events such as pointer moves, key press/release, clicks etc... Other events are used to handle the drawable appearance even when the data is not flowing (GST_STATE_PAUSED). That means that even when the element is paused, it will receive expose events from the drawable and draw the latest frame with correct borders/aspect-ratio.

Pixel aspect ratio

When changing state to GST_STATE_READY, XvImageSink will open a connection to the display specified in the display property or the default display if nothing specified. Once this connection is open it will inspect the display configuration including the physical display geometry and then calculate the pixel aspect ratio. When receiving video frames with a different pixel aspect ratio, XvImageSink will use hardware scaling to display the video frames correctly on display's pixel aspect ratio. Sometimes the calculated pixel aspect ratio can be wrong, it is then possible to enforce a specific pixel aspect ratio using the pixel-aspect-ratio property.

Examples

 gst-launch-1.0 -v videotestsrc ! xvimagesink

A pipeline to test hardware scaling. When the test video signal appears you can resize the window and see that video frames are scaled through hardware (no extra CPU cost). By default the image will never be distorted when scaled, instead black borders will be added if needed.

 gst-launch-1.0 -v videotestsrc ! xvimagesink force-aspect-ratio=false

Same pipeline with force-aspect-ratio property set to false. You can observe that no borders are drawn around the scaled image now and it will be distorted to fill the entire frame instead of respecting the aspect ratio.

 gst-launch-1.0 -v videotestsrc ! navigationtest ! xvimagesink

A pipeline to test navigation events. While moving the mouse pointer over the test signal you will see a black box following the mouse pointer. If you press the mouse button somewhere on the video and release it somewhere else a green box will appear where you pressed the button and a red one where you released it. (The navigationtest element is part of gst-plugins-good.) You can observe here that even if the images are scaled through hardware the pointer coordinates are converted back to the original video frame geometry so that the box can be drawn to the correct position. This also handles borders correctly, limiting coordinates to the image area

 gst-launch-1.0 -v videotestsrc ! video/x-raw, pixel-aspect-ratio=4/3 ! xvimagesink

This is faking a 4/3 pixel aspect ratio caps on video frames produced by videotestsrc, in most cases the pixel aspect ratio of the display will be 1/1. This means that XvImageSink will have to do the scaling to convert incoming frames to a size that will match the display pixel aspect ratio (from 320x240 to 320x180 in this case).

 gst-launch-1.0 -v videotestsrc ! xvimagesink hue=100 saturation=-100 brightness=100

Demonstrates how to use the colorbalance interface.

Hierarchy

GObject
    ╰──GInitiallyUnowned
        ╰──GstObject
            ╰──GstElement
                ╰──GstBaseSink
                    ╰──GstVideoSink
                        ╰──xvimagesink

Implemented interfaces

Factory details

Authors: – Julien Moutte

Classification:Sink/Video

Rank – primary

Plugin – xvimagesink

Package – GStreamer Base Plug-ins

Pad Templates

sink

video/x-raw:
      framerate: [ 0/1, 2147483647/1 ]
          width: [ 1, 2147483647 ]
         height: [ 1, 2147483647 ]

Presencealways

Directionsink

Object typeGstPad


Properties

autopaint-colorkey

“autopaint-colorkey” gboolean

Whether to autofill overlay with colorkey

Flags : Read / Write

Default value : true


brightness

“brightness” gint

The brightness of the video

Flags : Read / Write

Default value : 0


colorkey

“colorkey” gint

Color to use for the overlay mask.

Flags : Read / Write

Default value : 526352


contrast

“contrast” gint

The contrast of the video

Flags : Read / Write

Default value : 0


device

“device” gchararray

The number of the video adaptor

Flags : Read / Write

Default value : 0


device-name

“device-name” gchararray

The name of the video adaptor

Flags : Read

Default value : NULL


display

“display” gchararray

X Display name

Flags : Read / Write

Default value : NULL


double-buffer

“double-buffer” gboolean

Whether to double-buffer the output.

Flags : Read / Write

Default value : false


draw-borders

“draw-borders” gboolean

Draw black borders when using GstXvImageSink:force-aspect-ratio to fill unused parts of the video area.

Flags : Read / Write

Default value : true


force-aspect-ratio

“force-aspect-ratio” gboolean

When enabled, scaling will respect original aspect ratio

Flags : Read / Write

Default value : true


handle-events

“handle-events” gboolean

When enabled, XEvents will be selected and handled

Flags : Read / Write

Default value : true


handle-expose

“handle-expose” gboolean

When enabled, the current frame will always be drawn in response to X Expose.

Flags : Read / Write

Default value : true


hue

“hue” gint

The hue of the video

Flags : Read / Write

Default value : 0


pixel-aspect-ratio

“pixel-aspect-ratio” gchararray

The pixel aspect ratio of the device

Flags : Read / Write

Default value : NULL


render-rectangle

“render-rectangle” GstValueArray *

The render rectangle ('<x, y, width, height>')

Flags : Read / Write


saturation

“saturation” gint

The saturation of the video

Flags : Read / Write

Default value : 0


synchronous

“synchronous” gboolean

When enabled, runs the X display in synchronous mode. (unrelated to A/V sync, used only for debugging)

Flags : Read / Write

Default value : false


window-height

“window-height” guint64

Actual height of the video window.

Flags : Read

Default value : 0


window-width

“window-width” guint64

Actual width of the video window.

Flags : Read

Default value : 0


The results of the search are