libs: blend: remove begin/render/end API

This API was risky and is superseded by the surface
generator (process) API.

Resolves #219
This commit is contained in:
U. Artie Eoff 2020-01-10 10:14:38 -08:00 committed by Víctor Manuel Jáquez Leal
parent edca6efede
commit f97d858237
2 changed files with 0 additions and 172 deletions

View file

@ -208,166 +208,6 @@ gst_vaapi_blend_replace (GstVaapiBlend ** old_blend_ptr,
gst_object_replace ((GstObject **) old_blend_ptr, GST_OBJECT (new_blend));
}
/**
* gst_vaapi_blend_process_begin:
* @blend: a #GstVaapiBlend
* @surface: the #GstVaapiSurface output target
*
* Locks the VA display and prepares the VA processing pipeline for rendering.
*
* If this function fails, then the VA display is unlocked before returning.
*
* If this function succeeds, it must be paired with a call to
* #gst_vaapi_blend_process_end to ensure the VA processing pipeline is
* finalized and the VA display is unlocked.
*
* Returns: %TRUE if successful, %FALSE otherwise.
*/
gboolean
gst_vaapi_blend_process_begin (GstVaapiBlend * blend, GstVaapiSurface * surface)
{
VAStatus va_status;
g_return_val_if_fail (blend != NULL, FALSE);
g_return_val_if_fail (surface != NULL, FALSE);
GST_VAAPI_DISPLAY_LOCK (blend->display);
va_status = vaBeginPicture (GST_VAAPI_DISPLAY_VADISPLAY (blend->display),
blend->va_context, GST_VAAPI_SURFACE_ID (surface));
if (!vaapi_check_status (va_status, "vaBeginPicture()")) {
GST_VAAPI_DISPLAY_UNLOCK (blend->display);
return FALSE;
}
return TRUE;
}
/**
* gst_vaapi_blend_process_render:
* @blend: a #GstVaapiBlend
* @surface: the source #GstVaapiSurface to send to the VA processing pipeline
* for rendering.
* @crop_rect: the @surface crop extents to process for rendering.
* @target_rect: the extents for which the @surface is rendered within the
* output surface.
* @alpha: the alpha value in the range 0.0 to 1.0, inclusive, for blending
* with the output surface background or with previously rendered surfaces.
*
* Renders the @surface in the currently active VA processing pipeline.
*
* This function must only be called after a successful call to
* #gst_vaapi_blend_process_begin and before calling
* #gst_vaapi_process_end.
*
* Returns: %TRUE if successful, %FALSE otherwise.
*/
gboolean
gst_vaapi_blend_process_render (GstVaapiBlend * blend,
const GstVaapiSurface * surface, const GstVaapiRectangle * crop_rect,
const GstVaapiRectangle * target_rect, gdouble alpha)
{
VADisplay va_display;
VAStatus va_status;
VAProcPipelineParameterBuffer *param = NULL;
VABufferID id = VA_INVALID_ID;
VARectangle src_rect = { 0, }, dst_rect = {
0,};
#if VA_CHECK_VERSION(1,1,0)
VABlendState blend_state;
#endif
g_return_val_if_fail (blend != NULL, FALSE);
g_return_val_if_fail (surface != NULL, FALSE);
va_display = GST_VAAPI_DISPLAY_VADISPLAY (blend->display);
/* Build surface region (source) */
src_rect.width = GST_VAAPI_SURFACE_WIDTH (surface);
src_rect.height = GST_VAAPI_SURFACE_HEIGHT (surface);
if (crop_rect) {
if ((crop_rect->x + crop_rect->width > src_rect.width) ||
(crop_rect->y + crop_rect->height > src_rect.height))
return FALSE;
src_rect.x = crop_rect->x;
src_rect.y = crop_rect->y;
src_rect.width = crop_rect->width;
src_rect.height = crop_rect->height;
}
/* Build output region (target) */
dst_rect.width = src_rect.width;
dst_rect.height = src_rect.height;
if (target_rect) {
dst_rect.x = target_rect->x;
dst_rect.y = target_rect->y;
dst_rect.width = target_rect->width;
dst_rect.height = target_rect->height;
}
if (!vaapi_create_buffer (va_display, blend->va_context,
VAProcPipelineParameterBufferType, sizeof (*param), NULL, &id,
(gpointer *) & param))
return FALSE;
memset (param, 0, sizeof (*param));
param->surface = GST_VAAPI_SURFACE_ID (surface);
param->surface_region = &src_rect;
param->output_region = &dst_rect;
param->output_background_color = 0xff000000;
#if VA_CHECK_VERSION(1,1,0)
blend_state.flags = VA_BLEND_GLOBAL_ALPHA;
blend_state.global_alpha = alpha;
param->blend_state = &blend_state;
#endif
vaapi_unmap_buffer (va_display, id, NULL);
va_status = vaRenderPicture (va_display, blend->va_context, &id, 1);
if (!vaapi_check_status (va_status, "vaRenderPicture()")) {
vaapi_destroy_buffer (va_display, &id);
return FALSE;
}
vaapi_destroy_buffer (va_display, &id);
return TRUE;
}
/**
* gst_vaapi_blend_process_end:
* @blend: a #GstVaapiBlend
*
* Finalizes all pending render operations in the active VA processing pipeline
* and unlocks the VA display.
*
* This function must always be paired with a call to
* #gst_vaapi_blend_process_begin to ensure the VA display gets unlocked.
*
* Returns: %TRUE if successful, %FALSE otherwise.
*/
gboolean
gst_vaapi_blend_process_end (GstVaapiBlend * blend)
{
VAStatus va_status;
g_return_val_if_fail (blend != NULL, FALSE);
va_status = vaEndPicture (GST_VAAPI_DISPLAY_VADISPLAY (blend->display),
blend->va_context);
GST_VAAPI_DISPLAY_UNLOCK (blend->display);
if (!vaapi_check_status (va_status, "vaEndPicture()"))
return FALSE;
return TRUE;
}
static gboolean
gst_vaapi_blend_process_unlocked (GstVaapiBlend * blend,
GstVaapiSurface * output, GstVaapiBlendSurfaceGenerator * generator)

View file

@ -62,18 +62,6 @@ gboolean
gst_vaapi_blend_process (GstVaapiBlend * blend, GstVaapiSurface * output,
GstVaapiBlendSurfaceGenerator * generator);
gboolean
gst_vaapi_blend_process_begin (GstVaapiBlend * blend,
GstVaapiSurface * surface);
gboolean
gst_vaapi_blend_process_render (GstVaapiBlend * blend,
const GstVaapiSurface * surface, const GstVaapiRectangle * crop_rect,
const GstVaapiRectangle * target_rect, gdouble alpha);
gboolean
gst_vaapi_blend_process_end (GstVaapiBlend * blend);
GType
gst_vaapi_blend_get_type (void) G_GNUC_CONST;