GstVaapiDecoder: GStreamer VA-API Plugins 1.6 Library Reference Manual

## GstVaapiDecoder GstVaapiDecoder — VA decoder abstraction |

## Functions

GstCaps * | gst_vaapi_decoder_get_caps ()
GstVaapiCodec | gst_vaapi_decoder_get_codec ()
GstVideoCodecState * | gst_vaapi_decoder_get_codec_state ()
gboolean | gst_vaapi_decoder_put_buffer ()
GstVaapiDecoderStatus | gst_vaapi_decoder_get_surface ()
GstVaapiDecoderStatus | gst_vaapi_decoder_get_frame ()
GstVaapiDecoderStatus | gst_vaapi_decoder_get_frame_with_timeout ()
GstVaapiDecoderStatus | gst_vaapi_decoder_parse ()
GstVaapiDecoderStatus | gst_vaapi_decoder_decode ()

## Types and Values

enum | GstVaapiDecoderStatus
| GstVaapiDecoder

## Description

## Functions

### gst_vaapi_decoder_get_caps ()

    GstCaps *
    gst_vaapi_decoder_get_caps (GstVaapiDecoder *decoder);

Retrieves the `decoder` caps. The decoder owns the returned caps, so use `gst_caps_ref()` whenever necessary.

#### Parameters

decoder | a GstVaapiDecoder |

#### Returns

the `decoder` caps

### gst_vaapi_decoder_get_codec ()

    GstVaapiCodec
    gst_vaapi_decoder_get_codec (GstVaapiDecoder *decoder);

Retrieves the `decoder` codec type.

#### Parameters

decoder | a GstVaapiDecoder |

#### Returns

the GstVaapiCodec type for `decoder`

### gst_vaapi_decoder_get_codec_state ()

    GstVideoCodecState *
    gst_vaapi_decoder_get_codec_state (GstVaapiDecoder *decoder);

Retrieves the `decoder` codec state. The decoder owns the returned GstVideoCodecState structure, so use `gst_video_codec_state_ref()` whenever necessary.

#### Parameters

decoder | a GstVaapiDecoder |

#### Returns

the GstVideoCodecState object for `decoder`

### gst_vaapi_decoder_put_buffer ()

    gboolean
    gst_vaapi_decoder_put_buffer (GstVaapiDecoder *decoder,
                                  GstBuffer *buf);

Queues a GstBuffer to the HW decoder. The decoder holds a reference to `buf` .

Caller can notify an End-Of-Stream with `buf` set to `NULL`. However, if an empty buffer is passed, i.e. a buffer with `NULL` data pointer or size equals to zero, then the function ignores this buffer and returns `TRUE`.

#### Parameters

decoder | a GstVaapiDecoder |
buf | a GstBuffer |

#### Returns

`TRUE` on success

### gst_vaapi_decoder_get_surface ()

    GstVaapiDecoderStatus
    gst_vaapi_decoder_get_surface (GstVaapiDecoder *decoder,
                                   GstVaapiSurfaceProxy **out_proxy_ptr);

Flushes encoded buffers to the decoder and returns a decoded surface, if any.

On successful return, *`out_proxy_ptr` contains the decoded surface as a GstVaapiSurfaceProxy. The caller owns this object, so `gst_vaapi_surface_proxy_unref()` shall be called after usage.

#### Parameters

decoder | a GstVaapiDecoder |
out_proxy_ptr | the next decoded surface as a GstVaapiSurfaceProxy |

#### Returns

a GstVaapiDecoderStatus

### gst_vaapi_decoder_get_frame ()

    GstVaapiDecoderStatus
    gst_vaapi_decoder_get_frame (GstVaapiDecoder *decoder,
                                 GstVideoCodecFrame **out_frame_ptr);

On successful return, *`out_frame_ptr` contains the next decoded frame available as a GstVideoCodecFrame. The caller owns this object, so `gst_video_codec_frame_unref()` shall be called after usage. Otherwise, `GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA` is returned if no decoded frame is available.

The actual surface is available as a GstVaapiSurfaceProxy attached to the user-data anchor of the output frame. Ownership of the proxy is transferred to the frame.

This is equivalent to `gst_vaapi_decoder_get_frame_with_timeout()` with a timeout value of zero.

#### Parameters

decoder | a GstVaapiDecoder |
out_frame_ptr | the next decoded frame as a GstVideoCodecFrame |

#### Returns

a GstVaapiDecoderStatus

### gst_vaapi_decoder_get_frame_with_timeout ()

    GstVaapiDecoderStatus
    gst_vaapi_decoder_get_frame_with_timeout
                                   (GstVaapiDecoder *decoder,
                                    GstVideoCodecFrame **out_frame_ptr,
                                    guint64 timeout);

On successful return, *`out_frame_ptr` contains the next decoded frame available as a GstVideoCodecFrame. The caller owns this object, so `gst_video_codec_frame_unref()` shall be called after usage. Otherwise, `GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA` is returned if no decoded frame is available.

The actual surface is available as a GstVaapiSurfaceProxy attached to the user-data anchor of the output frame. Ownership of the proxy is transferred to the frame.

#### Parameters

decoder | a GstVaapiDecoder |
out_frame_ptr | the next decoded frame as a GstVideoCodecFrame |
timeout | the number of microseconds to wait for the frame, at most |

#### Returns

a GstVaapiDecoderStatus

### gst_vaapi_decoder_parse ()

    GstVaapiDecoderStatus
    gst_vaapi_decoder_parse (GstVaapiDecoder *decoder,
                             GstVideoCodecFrame *frame,
                             GstAdapter *adapter,
                             gboolean at_eos,
                             guint *got_unit_size_ptr,
                             gboolean *got_frame_ptr);

### gst_vaapi_decoder_decode ()

    GstVaapiDecoderStatus
    gst_vaapi_decoder_decode (GstVaapiDecoder *decoder,
                              GstVideoCodecFrame *frame);

## Types and Values

### enum GstVaapiDecoderStatus

Decoder status for `gst_vaapi_decoder_get_surface()`.

#### Members

GST_VAAPI_DECODER_STATUS_SUCCESS | Success. |
GST_VAAPI_DECODER_STATUS_END_OF_STREAM | End-Of-Stream. |
GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED | No memory left. |
GST_VAAPI_DECODER_STATUS_ERROR_INIT_FAILED | Decoder initialization failure. |
GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC | Unsupported codec. |
GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA | Not enough input data to decode. |
GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE | No surface left to hold the decoded picture. |
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE | Invalid surface. |
GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER | Invalid or unsupported bitstream data. |
GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_PROFILE | Unsupported codec profile. |
GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT | Unsupported chroma format. |
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER | Unsupported parameter. |
GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN | Unknown error. |

### GstVaapiDecoder

    typedef struct _GstVaapiDecoder GstVaapiDecoder;

A VA decoder base instance.