gst_vaapi_context_get_entrypoint
gst_vaapi_context_get_size
gst_vaapi_context_get_surface
+gst_vaapi_context_get_surface_count
gst_vaapi_context_put_surface
gst_vaapi_context_find_surface_by_id
<SUBSECTION Standard>
}
/**
+ * gst_vaapi_context_get_surface_count:
+ * @context: a #GstVaapiContext
+ *
+ * Retrieves the number of free surfaces left in the pool.
+ *
+ * Return value: the number of free surfaces available in the pool
+ */
+guint
+gst_vaapi_context_get_surface_count(GstVaapiContext *context)
+{
+ g_return_val_if_fail(GST_VAAPI_IS_CONTEXT(context), 0);
+
+ return gst_vaapi_video_pool_get_size(context->priv->surfaces_pool);
+}
+
+/**
* gst_vaapi_context_put_surface:
* @context: a #GstVaapiContext
* @surface: the #GstVaapiSurface to release
GstVaapiSurface *
gst_vaapi_context_get_surface(GstVaapiContext *context);
+guint
+gst_vaapi_context_get_surface_count(GstVaapiContext *context);
+
void
gst_vaapi_context_put_surface(GstVaapiContext *context, GstVaapiSurface *surface);
static GstVaapiDecoderStatus
decode_step(GstVaapiDecoder *decoder)
{
+ GstVaapiDecoderPrivate * const priv = decoder->priv;
GstVaapiDecoderStatus status;
GstBuffer *buffer;
+ /* Decoding will fail if there is no surface left */
+ if (priv->context &&
+ gst_vaapi_context_get_surface_count(priv->context) == 0)
+ return GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE;
+
do {
buffer = pop_buffer(decoder);
if (!buffer)
* @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_UNKNOWN: Unknown error.
*
GST_VAAPI_DECODER_STATUS_ERROR_INIT_FAILED,
GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC,
GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA,
+ GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE,
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE,
GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN = -1
};