## ximagesink ximagesink |

## Properties

gchar * | display | Read / Write
gboolean | force-aspect-ratio | Read / Write
gboolean | handle-events | Read / Write
gboolean | handle-expose | Read / Write
gchar * | pixel-aspect-ratio | Read / Write
gboolean | synchronous | Read / Write
guint64 | window-height | Read
guint64 | window-width | Read

## Types and Values

struct | GstXImageSink

## Object Hierarchy

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

## Implemented Interfaces

GstXImageSink implements GstNavigation and GstVideoOverlay.

## Description

XImageSink renders video frames to a drawable (XWindow) on a local or 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

As standard XImage rendering to a drawable is not scaled, XImageSink will use reverse caps negotiation to try to get scaled video frames for the drawable. This is accomplished by asking the peer pad if it accepts some different caps which in most cases implies that there is a scaling element in the pipeline, or that an element generating the video frames can generate them with a different geometry. This mechanism is handled during buffer allocations, for each allocation request the video sink will check the drawable geometry, look at the “force-aspect-ratio” property, calculate the geometry of desired video frames and then check that the peer pad accept those new caps. If it does it will then allocate a buffer in video memory with this new geometry and return it with the new caps.

#### Events

XImageSink 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, XImageSink 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 caps negotiation will occur, the video sink will set the calculated pixel aspect ratio on the caps to make sure that incoming video frames will have the correct pixel aspect ratio for this display. 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

    1
    gst-launch-1.0 -v videotestsrc ! queue ! ximagesink

A pipeline to test reverse negotiation. When the test video signal appears you can resize the window and see that scaled buffers of the desired size are going to arrive with a short delay. This illustrates how buffers of desired size are allocated along the way. If you take away the queue, scaling will happen almost immediately.

    1
    gst-launch-1.0 -v videotestsrc ! navigationtest ! videoconvert ! ximagesink

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.)

    1
    gst-launch-1.0 -v videotestsrc ! video/x-raw, pixel-aspect-ratio=(fraction)4/3 ! videoscale ! ximagesink

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 videoscale 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). Note that you might have to escape some characters for your shell like '(fraction)'.

## Synopsis

### Element Information

plugin | ximagesink
author | Julien Moutte <julien@moutte.net>
class | Sink/Video

### Element Pads

name | sink
direction | sink
presence | always
details | video/x-raw, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]

## Functions

## Types and Values

### struct GstXImageSink

    struct GstXImageSink;

The GstXImageSink data structure.

#### Members

## Property Details

### The `“display”` property

      “display”                  gchar *

X Display name.

Flags: Read / Write

Default value: NULL

### The `“force-aspect-ratio”` property

      “force-aspect-ratio”       gboolean

When enabled, reverse caps negotiation (scaling) will respect original aspect ratio.

Flags: Read / Write

Default value: TRUE

### The `“handle-events”` property

      “handle-events”            gboolean

When enabled, XEvents will be selected and handled.

Flags: Read / Write

Default value: TRUE

### The `“handle-expose”` property

      “handle-expose”            gboolean

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

Flags: Read / Write

Default value: TRUE

### The `“pixel-aspect-ratio”` property

      “pixel-aspect-ratio”       gchar *

The pixel aspect ratio of the device.

Flags: Read / Write

Default value: "1/1"

### The `“synchronous”` property

      “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

### The `“window-height”` property

      “window-height”            guint64

Actual height of the video window.

Flags: Read

Default value: 0

### The `“window-width”` property

      “window-width”             guint64

Actual width of the video window.

Flags: Read

Default value: 0