GstVaapiDisplay: GStreamer VA-API Plugins 1.4 Library Reference Manual

## GstVaapiDisplay GstVaapiDisplay — VA display abstraction |

## Functions

GstVaapiDisplay * | gst_vaapi_display_new_with_display ()
GstVaapiDisplay * | gst_vaapi_display_ref ()
void | gst_vaapi_display_unref ()
void | gst_vaapi_display_replace ()
void | gst_vaapi_display_lock ()
void | gst_vaapi_display_unlock ()
void | gst_vaapi_display_sync ()
void | gst_vaapi_display_flush ()
GstVaapiDisplayType | gst_vaapi_display_get_class_type ()
GstVaapiDisplayType | gst_vaapi_display_get_display_type ()
const gchar * | gst_vaapi_display_get_display_name ()
VADisplay | gst_vaapi_display_get_display ()
guint | gst_vaapi_display_get_width ()
guint | gst_vaapi_display_get_height ()
void | gst_vaapi_display_get_size ()
void | gst_vaapi_display_get_pixel_aspect_ratio ()
gboolean | gst_vaapi_display_has_video_processing ()
GArray * | gst_vaapi_display_get_decode_profiles ()
gboolean | gst_vaapi_display_has_decoder ()
GArray * | gst_vaapi_display_get_encode_profiles ()
gboolean | gst_vaapi_display_has_encoder ()
GArray * | gst_vaapi_display_get_image_formats ()
gboolean | gst_vaapi_display_has_image_format ()
GArray * | gst_vaapi_display_get_subpicture_formats ()
gboolean | gst_vaapi_display_has_subpicture_format ()
gboolean | gst_vaapi_display_has_property ()
gboolean | gst_vaapi_display_get_property ()
gboolean | gst_vaapi_display_set_property ()
gboolean | gst_vaapi_display_get_render_mode ()
gboolean | gst_vaapi_display_set_render_mode ()
GstVaapiRotation | gst_vaapi_display_get_rotation ()
gboolean | gst_vaapi_display_set_rotation ()
const gchar * | gst_vaapi_display_get_vendor_string ()
gboolean | gst_vaapi_display_has_opengl ()

## Types and Values

enum | GstVaapiDisplayType
| GstVaapiDisplay
struct | GstVaapiDisplayInfo

## Description

## Functions

### gst_vaapi_display_new_with_display ()

    GstVaapiDisplay *
    gst_vaapi_display_new_with_display (VADisplay va_display);

Creates a new GstVaapiDisplay, using `va_display` as the VA display.

#### Parameters

va_display | a VADisplay |

#### Returns

the newly created GstVaapiDisplay object

### gst_vaapi_display_ref ()

    GstVaapiDisplay *
    gst_vaapi_display_ref (GstVaapiDisplay *display);

Atomically increases the reference count of the given `display` by one.

#### Parameters

display | a GstVaapiDisplay |

#### Returns

The same `display` argument

### gst_vaapi_display_unref ()

    void
    gst_vaapi_display_unref (GstVaapiDisplay *display);

Atomically decreases the reference count of the `display` by one. If the reference count reaches zero, the display will be free'd.

#### Parameters

display | a GstVaapiDisplay |

### gst_vaapi_display_replace ()

    void
    gst_vaapi_display_replace (GstVaapiDisplay **old_display_ptr,
                               GstVaapiDisplay *new_display);

Atomically replaces the display display held in `old_display_ptr` with `new_display` . This means that `old_display_ptr` shall reference a valid display. However, `new_display` can be NULL.

#### Parameters

old_display_ptr | a pointer to a GstVaapiDisplay |
new_display | a GstVaapiDisplay |

### gst_vaapi_display_lock ()

    void
    gst_vaapi_display_lock (GstVaapiDisplay *display);

Locks `display` . If `display` is already locked by another thread, the current thread will block until `display` is unlocked by the other thread.

#### Parameters

display | a GstVaapiDisplay |

### gst_vaapi_display_unlock ()

    void
    gst_vaapi_display_unlock (GstVaapiDisplay *display);

Unlocks `display` . If another thread is blocked in a `gst_vaapi_display_lock()` call for `display` , it will be woken and can lock `display` itself.

#### Parameters

display | a GstVaapiDisplay |

### gst_vaapi_display_sync ()

    void
    gst_vaapi_display_sync (GstVaapiDisplay *display);

Flushes any requests queued for the windowing system and waits until all requests have been handled. This is often used for making sure that the display is synchronized with the current state of the program.

This is most useful for X11. On windowing systems where requests are handled synchronously, this function will do nothing.

#### Parameters

display | a GstVaapiDisplay |

### gst_vaapi_display_flush ()

    void
    gst_vaapi_display_flush (GstVaapiDisplay *display);

Flushes any requests queued for the windowing system.

This is most useful for X11. On windowing systems where requests are handled synchronously, this function will do nothing.

#### Parameters

display | a GstVaapiDisplay |

### gst_vaapi_display_get_class_type ()

    GstVaapiDisplayType
    gst_vaapi_display_get_class_type (GstVaapiDisplay *display);

Returns the GstVaapiDisplayType of `display` . This is the type of the object, thus the associated class, not the type of the VA display.

#### Parameters

display | a GstVaapiDisplay |

#### Returns

the GstVaapiDisplayType

### gst_vaapi_display_get_display_type ()

    GstVaapiDisplayType
    gst_vaapi_display_get_display_type (GstVaapiDisplay *display);

Returns the `display` name.

#### Parameters

display | a GstVaapiDisplay |

#### Returns

the display name

### gst_vaapi_display_get_display_name ()

    const gchar *
    gst_vaapi_display_get_display_name (GstVaapiDisplay *display);

### gst_vaapi_display_get_display ()

    VADisplay
    gst_vaapi_display_get_display (GstVaapiDisplay *display);

Returns the VADisplay bound to `display` .

#### Parameters

display | a GstVaapiDisplay |

#### Returns

the VADisplay

### gst_vaapi_display_get_width ()

    guint
    gst_vaapi_display_get_width (GstVaapiDisplay *display);

Retrieves the width of a GstVaapiDisplay.

#### Parameters

display | a GstVaapiDisplay |

#### Returns

the width of the `display` , in pixels

### gst_vaapi_display_get_height ()

    guint
    gst_vaapi_display_get_height (GstVaapiDisplay *display);

Retrieves the height of a GstVaapiDisplay

#### Parameters

display | a GstVaapiDisplay |

#### Returns

the height of the `display` , in pixels

### gst_vaapi_display_get_size ()

    void
    gst_vaapi_display_get_size (GstVaapiDisplay *display,
                                guint *pwidth,
                                guint *pheight);

Retrieves the dimensions of a GstVaapiDisplay.

#### Parameters

display | a GstVaapiDisplay |
pwidth | return location for the width, or `NULL` |
pheight | return location for the height, or `NULL` |

### gst_vaapi_display_get_pixel_aspect_ratio ()

    void
    gst_vaapi_display_get_pixel_aspect_ratio
                                   (GstVaapiDisplay *display,
                                    guint *par_n,
                                    guint *par_d);

Retrieves the pixel aspect ratio of a GstVaapiDisplay.

#### Parameters

display | a GstVaapiDisplay |
par_n | return location for the numerator of pixel aspect ratio, or `NULL` |
par_d | return location for the denominator of pixel aspect ratio, or `NULL` |

### gst_vaapi_display_has_video_processing ()

    gboolean
    gst_vaapi_display_has_video_processing
                                   (GstVaapiDisplay *display);

Checks whether the underlying VA driver implementation supports video processing (VPP) acceleration.

#### Parameters

display | a GstVaapiDisplay |

#### Returns

`TRUE` if some VPP features are available

### gst_vaapi_display_get_decode_profiles ()

    GArray *
    gst_vaapi_display_get_decode_profiles (GstVaapiDisplay *display);

Gets the supported profiles for decoding. The caller owns an extra reference to the resulting array of GstVaapiProfile elements, so it shall be released with `g_array_unref()` after usage.

#### Parameters

display | a GstVaapiDisplay |

#### Returns

a newly allocated GArray, or `NULL` or error or if decoding is not supported at all

### gst_vaapi_display_has_decoder ()

    gboolean
    gst_vaapi_display_has_decoder (GstVaapiDisplay *display,
                                   GstVaapiProfile profile,
                                   GstVaapiEntrypoint entrypoint);

Returns whether VA `display` supports `profile` for decoding at the specified `entrypoint` .

#### Parameters

display | a GstVaapiDisplay |
profile | a VAProfile |
entrypoint | a GstVaaiEntrypoint |

#### Returns

`TRUE` if VA `display` supports `profile` for decoding.

### gst_vaapi_display_get_encode_profiles ()

    GArray *
    gst_vaapi_display_get_encode_profiles (GstVaapiDisplay *display);

Gets the supported profiles for encoding. The caller owns an extra reference to the resulting array of GstVaapiProfile elements, so it shall be released with `g_array_unref()` after usage.

#### Parameters

display | a GstVaapiDisplay |

#### Returns

a newly allocated GArray, or `NULL` or error or if encoding is not supported at all

### gst_vaapi_display_has_encoder ()

    gboolean
    gst_vaapi_display_has_encoder (GstVaapiDisplay *display,
                                   GstVaapiProfile profile,
                                   GstVaapiEntrypoint entrypoint);

Returns whether VA `display` supports `profile` for encoding at the specified `entrypoint` .

#### Parameters

display | a GstVaapiDisplay |
profile | a VAProfile |
entrypoint | a GstVaapiEntrypoint |

#### Returns

`TRUE` if VA `display` supports `profile` for encoding.

### gst_vaapi_display_get_image_formats ()

    GArray *
    gst_vaapi_display_get_image_formats (GstVaapiDisplay *display);

Gets the supported image formats for `gst_vaapi_surface_get_image()` or `gst_vaapi_surface_put_image()`.

Note that this method does not necessarily map image formats returned by `vaQueryImageFormats()`. The set of capabilities can be stripped down, if gstreamer-vaapi does not support the format, or expanded to cover compatible formats not exposed by the underlying driver. e.g. I420 can be supported even if the driver only exposes YV12.

Note: the caller owns an extra reference to the resulting array of GstVideoFormat elements, so it shall be released with `g_array_unref()` after usage.

#### Parameters

display | a GstVaapiDisplay |

#### Returns

a newly allocated GArray, or `NULL` on error or if the set is empty

### gst_vaapi_display_has_image_format ()

    gboolean
    gst_vaapi_display_has_image_format (GstVaapiDisplay *display,
                                        GstVideoFormat format);

Returns whether VA `display` supports `format` image format.

#### Parameters

display | a GstVaapiDisplay |
format | a GstVideoFormat |

#### Returns

`TRUE` if VA `display` supports `format` image format

### gst_vaapi_display_get_subpicture_formats ()

    GArray *
    gst_vaapi_display_get_subpicture_formats
                                   (GstVaapiDisplay *display);

Gets the supported subpicture formats.

Note that this method does not necessarily map subpicture formats returned by `vaQuerySubpictureFormats()`. The set of capabilities can be stripped down if gstreamer-vaapi does not support the format. e.g. this is the case for paletted formats like IA44.

Note: the caller owns an extra reference to the resulting array of GstVideoFormat elements, so it shall be released with `g_array_unref()` after usage.

#### Parameters

display | a GstVaapiDisplay |

#### Returns

a newly allocated GArray, or `NULL` on error of if the set is empty

### gst_vaapi_display_has_subpicture_format ()

    gboolean
    gst_vaapi_display_has_subpicture_format
                                   (GstVaapiDisplay *display,
                                    GstVideoFormat format,
                                    guint *flags_ptr);

Returns whether VA `display` supports `format` subpicture format with the supplied `flags` .

#### Parameters

display | a GstVaapiDisplay |
format | a GstVideoFormat |
flags_ptr | pointer to GstVaapiSubpictureFlags, or zero |

#### Returns

`TRUE` if VA `display` supports `format` subpicture format

### gst_vaapi_display_has_property ()

    gboolean
    gst_vaapi_display_has_property (GstVaapiDisplay *display,
                                    const gchar *name);

Returns whether VA `display` supports the requested property. The check is performed against the property `name` . So, the client application may perform this check only once and cache this information.

#### Parameters

display | a GstVaapiDisplay |
name | the property name to check |

#### Returns

`TRUE` if VA `display` supports property `name`

### gst_vaapi_display_get_property ()

    gboolean
    gst_vaapi_display_get_property (GstVaapiDisplay *display,
                                    const gchar *name,
                                    GValue *out_value);

### gst_vaapi_display_set_property ()

    gboolean
    gst_vaapi_display_set_property (GstVaapiDisplay *display,
                                    const gchar *name,
                                    const GValue *value);

### gst_vaapi_display_get_render_mode ()

    gboolean
    gst_vaapi_display_get_render_mode (GstVaapiDisplay *display,
                                       GstVaapiRenderMode *pmode);

Returns the current VA `display` rendering mode.

#### Parameters

display | a GstVaapiDisplay |
pmode | return location for the VA `display` rendering mode |

#### Returns

`TRUE` if VA `display` rendering mode could be determined

### gst_vaapi_display_set_render_mode ()

    gboolean
    gst_vaapi_display_set_render_mode (GstVaapiDisplay *display,
                                       GstVaapiRenderMode mode);

Sets the VA `display` rendering mode to the supplied `mode` . This function returns `FALSE` if the rendering mode could not be set, e.g. run-time switching rendering mode is not supported.

#### Parameters

display | a GstVaapiDisplay |
mode | the GstVaapiRenderMode to set |

#### Returns

`TRUE` if VA `display` rendering `mode` could be changed to the requested value

### gst_vaapi_display_get_rotation ()

    GstVaapiRotation
    gst_vaapi_display_get_rotation (GstVaapiDisplay *display);

Returns the current VA `display` rotation angle. If the VA driver does not support "rotation" display attribute, then the display is assumed to be un-rotated.

#### Parameters

display | a GstVaapiDisplay |

#### Returns

the current GstVaapiRotation value

### gst_vaapi_display_set_rotation ()

    gboolean
    gst_vaapi_display_set_rotation (GstVaapiDisplay *display,
                                    GstVaapiRotation rotation);

Sets the VA `display` rotation angle to the supplied `rotation` value. This function returns `FALSE` if the rotation angle could not be set, e.g. the VA driver does not allow to change the display rotation angle.

#### Parameters

display | a GstVaapiDisplay |
rotation | the GstVaapiRotation value to set |

#### Returns

`TRUE` if VA `display` rotation angle could be changed to the requested value

### gst_vaapi_display_get_vendor_string ()

    const gchar *
    gst_vaapi_display_get_vendor_string (GstVaapiDisplay *display);

Returns the VA driver vendor string attached to the supplied VA `display` . The `display` owns the vendor string, do *not* de-allocate it.

This function is thread safe.

#### Parameters

display | a GstVaapiDisplay |

#### Returns

the current GstVaapiRotation value

### gst_vaapi_display_has_opengl ()

    gboolean
    gst_vaapi_display_has_opengl (GstVaapiDisplay *display);

Returns wether the `display` that was created does support OpenGL context to be attached.

This function is thread safe.

#### Parameters

display | a GstVaapiDisplay |

#### Returns

`TRUE` if the `display` supports OpenGL context, `FALSE` otherwise

## Types and Values

### enum GstVaapiDisplayType

#### Members

GST_VAAPI_DISPLAY_TYPE_ANY | Automatic detection of the display type. |
GST_VAAPI_DISPLAY_TYPE_X11 | VA/X11 display. |
GST_VAAPI_DISPLAY_TYPE_GLX | VA/GLX display. |
GST_VAAPI_DISPLAY_TYPE_WAYLAND | VA/Wayland display. |
GST_VAAPI_DISPLAY_TYPE_DRM | VA/DRM display. |
GST_VAAPI_DISPLAY_TYPE_EGL | VA/EGL display. |

### GstVaapiDisplay

    typedef struct _GstVaapiDisplay GstVaapiDisplay;

Base class for VA displays.

### struct GstVaapiDisplayInfo

    struct GstVaapiDisplayInfo {
      GstVaapiDisplay *display;
      GstVaapiDisplayType display_type;
      gchar *display_name;
      VADisplay va_display;
      gpointer native_display;
    };

Generic class to retrieve VA display info