## GstVaapiContext GstVaapiContext — VA context abstraction |

## Functions

GstVaapiContext * | gst_vaapi_context_new ()
gboolean | gst_vaapi_context_reset ()
GstVaapiID | gst_vaapi_context_get_id ()
GstVaapiSurfaceProxy * | gst_vaapi_context_get_surface_proxy ()
guint | gst_vaapi_context_get_surface_count ()

## Types and Values

struct | GstVaapiConfigInfoEncoder
struct | GstVaapiContextInfo
struct | GstVaapiContext
enum | GstVaapiContextUsage

## Description

## Functions

### gst_vaapi_context_new ()

    GstVaapiContext *
    gst_vaapi_context_new (GstVaapiDisplay *display,
                           const GstVaapiContextInfo *cip);

Creates a new GstVaapiContext with the configuration specified by `cip` , thus including profile, entry-point, encoded size and maximum number of reference frames reported by the bitstream.

#### Parameters

display | a GstVaapiDisplay |
cip | a pointer to the GstVaapiContextInfo |

#### Returns

the newly allocated GstVaapiContext object

### gst_vaapi_context_reset ()

    gboolean
    gst_vaapi_context_reset (GstVaapiContext *context,
                             const GstVaapiContextInfo *new_cip);

Resets `context` to the configuration specified by `new_cip` , thus including profile, entry-point, encoded size and maximum number of reference frames reported by the bitstream.

#### Parameters

context | a GstVaapiContext |
new_cip | a pointer to the new GstVaapiContextInfo details |

#### Returns

`TRUE` on success

### gst_vaapi_context_get_id ()

    GstVaapiID
    gst_vaapi_context_get_id (GstVaapiContext *context);

Returns the underlying VAContextID of the `context` .

#### Parameters

context | a GstVaapiContext |

#### Returns

the underlying VA context id

### gst_vaapi_context_get_surface_proxy ()

    GstVaapiSurfaceProxy *
    gst_vaapi_context_get_surface_proxy (GstVaapiContext *context);

Acquires a free surface, wrapped into a GstVaapiSurfaceProxy. The returned surface will be automatically released when the proxy is destroyed. So, it is enough to call `gst_vaapi_surface_proxy_unref()` after usage.

This function returns `NULL` if there is no free surface available in the pool. The surfaces are pre-allocated during context creation though.

#### Parameters

context | a GstVaapiContext |

#### Returns

a free surface, or `NULL` if none is available

### gst_vaapi_context_get_surface_count ()

    guint
    gst_vaapi_context_get_surface_count (GstVaapiContext *context);

Retrieves the number of free surfaces left in the pool.

#### Parameters

context | a GstVaapiContext |

#### Returns

the number of free surfaces available in the pool

## Types and Values

### struct GstVaapiConfigInfoEncoder

    struct GstVaapiConfigInfoEncoder {
      GstVaapiRateControl rc_mode;
      guint packed_headers;
    };

Extra configuration for encoding.

#### Members

GstVaapiRateControl `rc_mode`; | rate-control mode (GstVaapiRateControl). |
guint `packed_headers`; | notify encoder that packed headers are submitted (mask). |

### struct GstVaapiContextInfo

    struct GstVaapiContextInfo {
      GstVaapiContextUsage usage;
      GstVaapiProfile profile;
      GstVaapiEntrypoint entrypoint;
      GstVaapiChromaType chroma_type;
      guint width;
      guint height;
      guint ref_frames;
      union _GstVaapiConfigInfo {
        GstVaapiConfigInfoEncoder encoder;
      } config;
    };

Structure holding VA context info like encoded size, decoder profile and entry-point to use, and maximum number of reference frames reported by the bitstream.

### struct GstVaapiContext

    struct GstVaapiContext {
    };

A VA context wrapper.

### enum GstVaapiContextUsage

The set of supported VA context usages.

#### Members

GST_VAAPI_CONTEXT_USAGE_DECODE |  |
GST_VAAPI_CONTEXT_USAGE_ENCODE |  |
GST_VAAPI_CONTEXT_USAGE_VPP |  |