mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
vaapipostproc: fix output buffer to have a GstVaapiVideoMemory.
https://bugzilla.gnome.org/show_bug.cgi?id=720311 [used new infrastructure through base decide_allocation() impl] Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
bc8e7a6734
commit
db111fe72a
2 changed files with 38 additions and 1 deletions
|
@ -280,6 +280,7 @@ gst_vaapipostproc_destroy_filter(GstVaapiPostproc *postproc)
|
||||||
}
|
}
|
||||||
gst_vaapi_filter_replace(&postproc->filter, NULL);
|
gst_vaapi_filter_replace(&postproc->filter, NULL);
|
||||||
gst_vaapi_video_pool_replace(&postproc->filter_pool, NULL);
|
gst_vaapi_video_pool_replace(&postproc->filter_pool, NULL);
|
||||||
|
postproc->filter_pool_active = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -313,6 +314,7 @@ gst_vaapipostproc_stop(GstBaseTransform *trans)
|
||||||
|
|
||||||
ds_reset(&postproc->deinterlace_state);
|
ds_reset(&postproc->deinterlace_state);
|
||||||
gst_vaapi_plugin_base_close(GST_VAAPI_PLUGIN_BASE(postproc));
|
gst_vaapi_plugin_base_close(GST_VAAPI_PLUGIN_BASE(postproc));
|
||||||
|
postproc->filter_pool_active = FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,18 +356,44 @@ create_output_buffer(GstVaapiPostproc *postproc)
|
||||||
{
|
{
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
|
|
||||||
|
#if GST_CHECK_VERSION(1,0,0)
|
||||||
|
GstBufferPool * const pool =
|
||||||
|
GST_VAAPI_PLUGIN_BASE(postproc)->srcpad_buffer_pool;
|
||||||
|
GstBufferPoolAcquireParams params = { 0, };
|
||||||
|
GstFlowReturn ret;
|
||||||
|
|
||||||
|
g_return_val_if_fail(pool != NULL, NULL);
|
||||||
|
|
||||||
|
if (!postproc->filter_pool_active) {
|
||||||
|
if (!gst_buffer_pool_set_active(pool, TRUE))
|
||||||
|
goto error_activate_pool;
|
||||||
|
postproc->filter_pool_active = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
outbuf = NULL;
|
||||||
|
params.flags = GST_VAAPI_VIDEO_BUFFER_POOL_ACQUIRE_FLAG_NO_ALLOC;
|
||||||
|
ret = gst_buffer_pool_acquire_buffer(pool, &outbuf, ¶ms);
|
||||||
|
if (ret != GST_FLOW_OK || !outbuf)
|
||||||
|
goto error_create_buffer;
|
||||||
|
#else
|
||||||
/* Create a raw VA video buffer without GstVaapiVideoMeta attached
|
/* Create a raw VA video buffer without GstVaapiVideoMeta attached
|
||||||
to it yet, as this will be done next in the transform() hook */
|
to it yet, as this will be done next in the transform() hook */
|
||||||
outbuf = gst_vaapi_video_buffer_new_empty();
|
outbuf = gst_vaapi_video_buffer_new_empty();
|
||||||
if (!outbuf)
|
if (!outbuf)
|
||||||
goto error_create_buffer;
|
goto error_create_buffer;
|
||||||
|
|
||||||
#if !GST_CHECK_VERSION(1,0,0)
|
|
||||||
gst_buffer_set_caps(outbuf, GST_VAAPI_PLUGIN_BASE_SRC_PAD_CAPS(postproc));
|
gst_buffer_set_caps(outbuf, GST_VAAPI_PLUGIN_BASE_SRC_PAD_CAPS(postproc));
|
||||||
#endif
|
#endif
|
||||||
return outbuf;
|
return outbuf;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
#if GST_CHECK_VERSION(1,0,0)
|
||||||
|
error_activate_pool:
|
||||||
|
{
|
||||||
|
GST_ERROR("failed to activate output video buffer pool");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
error_create_buffer:
|
error_create_buffer:
|
||||||
{
|
{
|
||||||
GST_ERROR("failed to create output video buffer");
|
GST_ERROR("failed to create output video buffer");
|
||||||
|
@ -1239,6 +1267,13 @@ gst_vaapipostproc_propose_allocation(GstBaseTransform *trans,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_vaapipostproc_decide_allocation(GstBaseTransform *trans, GstQuery *query)
|
||||||
|
{
|
||||||
|
return gst_vaapi_plugin_base_decide_allocation(GST_VAAPI_PLUGIN_BASE(trans),
|
||||||
|
query, 0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1392,6 +1427,7 @@ gst_vaapipostproc_class_init(GstVaapiPostprocClass *klass)
|
||||||
|
|
||||||
#if GST_CHECK_VERSION(1,0,0)
|
#if GST_CHECK_VERSION(1,0,0)
|
||||||
trans_class->propose_allocation = gst_vaapipostproc_propose_allocation;
|
trans_class->propose_allocation = gst_vaapipostproc_propose_allocation;
|
||||||
|
trans_class->decide_allocation = gst_vaapipostproc_decide_allocation;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
trans_class->prepare_output_buffer =
|
trans_class->prepare_output_buffer =
|
||||||
|
|
|
@ -139,6 +139,7 @@ struct _GstVaapiPostproc {
|
||||||
GPtrArray *filter_ops;
|
GPtrArray *filter_ops;
|
||||||
GstVaapiVideoPool *filter_pool;
|
GstVaapiVideoPool *filter_pool;
|
||||||
GstVideoInfo filter_pool_info;
|
GstVideoInfo filter_pool_info;
|
||||||
|
gboolean filter_pool_active;
|
||||||
GArray *filter_formats;
|
GArray *filter_formats;
|
||||||
GstVideoFormat format; /* output video format (encoded) */
|
GstVideoFormat format; /* output video format (encoded) */
|
||||||
guint width;
|
guint width;
|
||||||
|
|
Loading…
Reference in a new issue