# d3d11videosink

Direct3D11 based video render element

## Example launch line

    gst-launch-1.0 videotestsrc ! d3d11upload ! d3d11videosink

This pipeline will display test video stream on screen via d3d11videosink

## Hierarchy

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

## Implemented interfaces

    GstVideoOverlay
    GstNavigation

## Factory details

Authors: – Seungha Yang <seungha.yang></seungha.yang>

Classification: – `Sink/Video`

Rank – primary

Plugin – d3d11

Package – GStreamer Bad Plug-ins

## Pad Templates

### `sink`

    video/x-raw(memory:D3D11Memory):
             format: { RGBA64_LE, BGRA64_LE, Y412_LE, RGB10A2_LE, Y410, BGR10A2_LE, Y212_LE, Y210, VUYA, RGBA, BGRA, RBGA, P016_LE, P012_LE, P010_10LE, RGBx, BGRx, YUY2, NV12, AYUV64, GBRA_12LE, GBRA_10LE, AYUV, ABGR, ARGB, GBRA, Y444_16LE, GBR_16LE, Y444_12LE, GBR_12LE, I422_12LE, I420_12LE, Y444_10LE, GBR_10LE, I422_10LE, I420_10LE, Y444, BGRP, GBR, RGBP, xBGR, xRGB, Y42B, NV21, I420, YV12, GRAY16_LE, GRAY8, v216, v210, r210, v308, IYU2, RGB, BGR, UYVY, VYUY, YVYU, RGB16, BGR16, RGB15, BGR15 }
              width: [ 1, 16384 ]
             height: [ 1, 16384 ]
          framerate: [ 0/1, 2147483647/1 ]

    video/x-raw(memory:D3D11Memory, meta:GstVideoOverlayComposition):
             format: { RGBA64_LE, BGRA64_LE, Y412_LE, RGB10A2_LE, Y410, BGR10A2_LE, Y212_LE, Y210, VUYA, RGBA, BGRA, RBGA, P016_LE, P012_LE, P010_10LE, RGBx, BGRx, YUY2, NV12, AYUV64, GBRA_12LE, GBRA_10LE, AYUV, ABGR, ARGB, GBRA, Y444_16LE, GBR_16LE, Y444_12LE, GBR_12LE, I422_12LE, I420_12LE, Y444_10LE, GBR_10LE, I422_10LE, I420_10LE, Y444, BGRP, GBR, RGBP, xBGR, xRGB, Y42B, NV21, I420, YV12, GRAY16_LE, GRAY8, v216, v210, r210, v308, IYU2, RGB, BGR, UYVY, VYUY, YVYU, RGB16, BGR16, RGB15, BGR15 }
              width: [ 1, 16384 ]
             height: [ 1, 16384 ]
          framerate: [ 0/1, 2147483647/1 ]
    video/x-raw:
             format: { RGBA64_LE, BGRA64_LE, Y412_LE, RGB10A2_LE, Y410, BGR10A2_LE, Y212_LE, Y210, VUYA, RGBA, BGRA, RBGA, P016_LE, P012_LE, P010_10LE, RGBx, BGRx, YUY2, NV12, AYUV64, GBRA_12LE, GBRA_10LE, AYUV, ABGR, ARGB, GBRA, Y444_16LE, GBR_16LE, Y444_12LE, GBR_12LE, I422_12LE, I420_12LE, Y444_10LE, GBR_10LE, I422_10LE, I420_10LE, Y444, BGRP, GBR, RGBP, xBGR, xRGB, Y42B, NV21, I420, YV12, GRAY16_LE, GRAY8, v216, v210, r210, v308, IYU2, RGB, BGR, UYVY, VYUY, YVYU, RGB16, BGR16, RGB15, BGR15 }
              width: [ 1, 16384 ]
             height: [ 1, 16384 ]
          framerate: [ 0/1, 2147483647/1 ]

    video/x-raw(memory:SystemMemory, meta:GstVideoOverlayComposition):
             format: { RGBA64_LE, BGRA64_LE, Y412_LE, RGB10A2_LE, Y410, BGR10A2_LE, Y212_LE, Y210, VUYA, RGBA, BGRA, RBGA, P016_LE, P012_LE, P010_10LE, RGBx, BGRx, YUY2, NV12, AYUV64, GBRA_12LE, GBRA_10LE, AYUV, ABGR, ARGB, GBRA, Y444_16LE, GBR_16LE, Y444_12LE, GBR_12LE, I422_12LE, I420_12LE, Y444_10LE, GBR_10LE, I422_10LE, I420_10LE, Y444, BGRP, GBR, RGBP, xBGR, xRGB, Y42B, NV21, I420, YV12, GRAY16_LE, GRAY8, v216, v210, r210, v308, IYU2, RGB, BGR, UYVY, VYUY, YVYU, RGB16, BGR16, RGB15, BGR15 }
              width: [ 1, 16384 ]
             height: [ 1, 16384 ]
          framerate: [ 0/1, 2147483647/1 ]

Presence – always

Direction – sink

Object type – GstPad

## Signals

### begin-draw

    begin_draw_callback (GstElement * videosink,
                         gpointer udata)

    def begin_draw_callback (videosink, udata):
        #python callback for the 'begin-draw' signal

    function begin_draw_callback(videosink: GstElement * videosink, udata: gpointer udata): {
        // javascript callback for the 'begin-draw' signal
    }

Emitted when sink has a texture to draw. Application needs to invoke draw action signal before returning from begin-draw signal handler.

Parameters:

`videosink` –

the d3d11videosink

`udata` –
No description available

Flags: Run Last

Since : 1.20 Deprecated, Use appsink to access GStreamer produced D3D11 texture

### present

    present_callback (GstElement * videosink,
                      GstObject * device,
                      gpointer render_target,
                      gpointer udata)

    def present_callback (videosink, device, render_target, udata):
        #python callback for the 'present' signal

    function present_callback(videosink: GstElement * videosink, device: GstObject * device, render_target: gpointer render_target, udata: gpointer udata): {
        // javascript callback for the 'present' signal
    }

Emitted just before presenting a texture via the IDXGISwapChain::Present. The client can perform additional rendering on the given render_target, or can read the content already rendered on the swapchain's backbuffer.

This signal will be emitted with gst_d3d11_device_lock taken and client should perform GPU operation from the thread where this signal emitted.

Parameters:

`videosink` –

the d3d11videosink

`device` –

a GstD3D11Device object

`render_target` –

a ID3D11RenderTargetView handle of swapchain's backbuffer

`udata` –
No description available

Flags: Run Last

Since : 1.22

## Action Signals

### draw

    g_signal_emit_by_name (videosink, "draw", shard_handle, texture_misc_flags, acquire_key, release_key, &ret);

    ret = videosink.emit ("draw", shard_handle, texture_misc_flags, acquire_key, release_key)

    let ret = videosink.emit ("draw", shard_handle, texture_misc_flags, acquire_key, release_key);

Draws on a shared texture. shard_handle must be a valid pointer to a HANDLE which was obtained via IDXGIResource::GetSharedHandle or IDXGIResource1::CreateSharedHandle.

If the texture was created with D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX flag, caller must specify valid acquire_key and release_key. Otherwise (i.e., created with D3D11_RESOURCE_MISC_SHARED flag), acquire_key and release_key will be ignored.

Parameters:

`videosink` (GstElement *) –

the d3d11videosink

`shard_handle` (gpointer) –

a pointer to HANDLE

`texture_misc_flags` (guint) –

a D3D11_RESOURCE_MISC_FLAG value

`acquire_key` (guint64) –

a key value used for IDXGIKeyedMutex::AcquireSync

`release_key` (guint64) –

a key value used for IDXGIKeyedMutex::ReleaseSync

Returns (gboolean) –
No description available

Flags: Run Last / Action

Since : 1.20 As of 1.24, @acquire_key and @release_key must be zero. Other values are not supported. Deprecated, Use appsink to access GStreamer produced D3D11 texture

## Properties

### adapter

    “adapter” gint

Adapter index for creating device (-1 for default)

Flags : Read / Write

Default value : -1

### display-format

    “display-format” D3d11video-sink-display-format *

Swapchain display format

Flags : Read / Write

Default value : unknown (0)

Since : 1.22

### draw-on-shared-texture

    “draw-on-shared-texture” gboolean

Instruct the sink to draw on a shared texture provided by user. User must watch begin-draw signal and should call draw method on the begin-draw signal handler.

Currently supported formats for user texture are:

- DXGI_FORMAT_R8G8B8A8_UNORM
- DXGI_FORMAT_B8G8R8A8_UNORM
- DXGI_FORMAT_R10G10B10A2_UNORM

Flags : Read / Write

Default value : false

Since : 1.20 Deprecated, Use appsink to access GStreamer produced D3D11 texture

### emit-present

    “emit-present” gboolean

Emits "present" signal

Flags : Read / Write

Default value : false

Since : 1.22

### force-aspect-ratio

    “force-aspect-ratio” gboolean

When enabled, scaling will respect original aspect ratio

Flags : Read / Write

Default value : true

### fov

    “fov” gfloat

Field of view angle in degrees

Flags : Read / Write

Default value : 90

Since : 1.24

### fullscreen

    “fullscreen” gboolean

Ignored when "fullscreen-toggle-mode" does not include "property"

Flags : Read / Write

Default value : false

### fullscreen-toggle-mode

    “fullscreen-toggle-mode” D3d11window-fullscreen-toggle-mode *

Full screen toggle mode used to trigger fullscreen mode change

Flags : Read / Write

Default value : none

### gamma-mode

    “gamma-mode” GstVideoGammaMode *

Gamma conversion mode

Flags : Read / Write

Default value : none (0)

Since : 1.22

### msaa

    “msaa” GstD3D11MSAAMode *

MSAA (Multi-Sampling Anti-Aliasing) level

Flags : Read / Write

Default value : disabled (0)

Since : 1.24

### ortho

    “ortho” gboolean

Use orthographic projection

Flags : Read / Write

Default value : false

Since : 1.24

### primaries-mode

    “primaries-mode” GstVideoPrimariesMode *

Primaries conversion mode

Flags : Read / Write

Default value : none (0)

Since : 1.22

### redraw-on-update

    “redraw-on-update” gboolean

Immediately apply updated geometry related properties and redraw

Flags : Read / Write

Default value : true

Since : 1.24

### render-rectangle

    “render-rectangle” GstValueArray *

Flags : Read / Write

Since : 1.24

### rotate-method

    “rotate-method” GstVideoOrientationMethod *

Video rotation/flip method to use

Flags : Read / Write

Default value : identity (0)

Since : 1.22

### rotation-x

    “rotation-x” gfloat

x-axis rotation angle to be applied prior to "rotate-method"

Flags : Read / Write

Default value : 0

Since : 1.24

### rotation-y

    “rotation-y” gfloat

y-axis rotation angle to be applied prior to "rotate-method"

Flags : Read / Write

Default value : 0

Since : 1.24

### rotation-z

    “rotation-z” gfloat

z-axis rotation angle to be applied prior to "rotate-method"

Flags : Read / Write

Default value : 0

Since : 1.24

### sampling-method

    “sampling-method” GstD3D11SamplingMethod *

Sampling method

Flags : Read / Write

Default value : bilinear (1)

Since : 1.24

### scale-x

    “scale-x” gfloat

Scale multiplier for x-axis

Flags : Read / Write

Default value : 1

Since : 1.24

### scale-y

    “scale-y” gfloat

Scale multiplier for y-axis

Flags : Read / Write

Default value : 1

Since : 1.24

## Named constants

### GstD3D11MSAAMode

#### Members

`disabled` (0) – Disabled
`2x` (1) – 2x MSAA
`4x` (2) – 4x MSAA
`8x` (3) – 8x MSAA

Since : 1.24

### D3d11video-sink-display-format

Swapchain's DXGI format

#### Members

`unknown` (0) – DXGI_FORMAT_UNKNOWN
`r10g10b10a2-unorm` (24) – DXGI_FORMAT_R10G10B10A2_UNORM
`r8g8b8a8-unorm` (28) – DXGI_FORMAT_R8G8B8A8_UNORM
`b8g8r8a8-unorm` (87) – DXGI_FORMAT_B8G8R8A8_UNORM

Since : 1.22

### D3d11window-fullscreen-toggle-mode

#### Members

`none` (0x00000000) – GST_D3D11_WINDOW_FULLSCREEN_TOGGLE_MODE_NONE
`alt-enter` (0x00000002) – GST_D3D11_WINDOW_FULLSCREEN_TOGGLE_MODE_ALT_ENTER
`property` (0x00000004) – GST_D3D11_WINDOW_FULLSCREEN_TOGGLE_MODE_PROPERTY

The results of the search are