From 152ffb52d2f85fc358f4c97ad061b4831611666a Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Thu, 21 Nov 2013 17:20:28 +0100 Subject: [PATCH] filter: add helpers to check for supported/active operation. Add a couple of helper functions: - gst_vaapi_filter_has_operation(): checks whether the VA driver advertises support for the supplied operation ; - gst_vaapi_filter_use_operation(): checks whether the supplied operation was already enabled to its non-default value. --- docs/reference/libs/libs-sections.txt | 2 ++ gst-libs/gst/vaapi/gstvaapifilter.c | 47 +++++++++++++++++++++++++++ gst-libs/gst/vaapi/gstvaapifilter.h | 6 ++++ 3 files changed, 55 insertions(+) diff --git a/docs/reference/libs/libs-sections.txt b/docs/reference/libs/libs-sections.txt index cc00f43012..e0752b73db 100644 --- a/docs/reference/libs/libs-sections.txt +++ b/docs/reference/libs/libs-sections.txt @@ -384,6 +384,8 @@ gst_vaapi_filter_unref gst_vaapi_filter_replace gst_vaapi_filter_get_operations gst_vaapi_filter_get_formats +gst_vaapi_filter_has_operation +gst_vaapi_filter_use_operation gst_vaapi_filter_set_operation gst_vaapi_filter_set_format gst_vaapi_filter_set_cropping_rectangle diff --git a/gst-libs/gst/vaapi/gstvaapifilter.c b/gst-libs/gst/vaapi/gstvaapifilter.c index e185f6ea24..b6e90733e0 100755 --- a/gst-libs/gst/vaapi/gstvaapifilter.c +++ b/gst-libs/gst/vaapi/gstvaapifilter.c @@ -1116,6 +1116,53 @@ gst_vaapi_filter_get_operations(GstVaapiFilter *filter) return get_operations(filter); } +/** + * gst_vaapi_filter_has_operation: + * @filter: a #GstVaapiFilter + * @op: a #GstVaapiFilterOp + * + * Determines whether the underlying VA driver advertises support for + * the supplied operation @op. + * + * Return value: %TRUE if the specified operation may be supported by + * the underlying hardware, %FALSE otherwise + */ +gboolean +gst_vaapi_filter_has_operation(GstVaapiFilter *filter, GstVaapiFilterOp op) +{ + g_return_val_if_fail(filter != NULL, FALSE); + + return find_operation(filter, op) != NULL; +} + +/** + * gst_vaapi_filter_use_operation: + * @filter: a #GstVaapiFilter + * @op: a #GstVaapiFilterOp + * + * Determines whether the supplied operation @op was already enabled + * through a prior call to gst_vaapi_filter_set_operation() or any + * other operation-specific function. + * + * Note: should an operation be set to its default value, this means + * that it is actually not enabled. + * + * Return value: %TRUE if the specified operation was already enabled, + * %FALSE otherwise + */ +gboolean +gst_vaapi_filter_use_operation(GstVaapiFilter *filter, GstVaapiFilterOp op) +{ + GstVaapiFilterOpData *op_data; + + g_return_val_if_fail(filter != NULL, FALSE); + + op_data = find_operation(filter, op); + if (!op_data) + return FALSE; + return op_data->is_enabled; +} + /** * gst_vaapi_filter_set_operation: * @filter: a #GstVaapiFilter diff --git a/gst-libs/gst/vaapi/gstvaapifilter.h b/gst-libs/gst/vaapi/gstvaapifilter.h index 2ea44052b9..5d9ec6598a 100755 --- a/gst-libs/gst/vaapi/gstvaapifilter.h +++ b/gst-libs/gst/vaapi/gstvaapifilter.h @@ -149,6 +149,12 @@ gst_vaapi_filter_replace(GstVaapiFilter **old_filter_ptr, GPtrArray * gst_vaapi_filter_get_operations(GstVaapiFilter *filter); +gboolean +gst_vaapi_filter_has_operation(GstVaapiFilter *filter, GstVaapiFilterOp op); + +gboolean +gst_vaapi_filter_use_operation(GstVaapiFilter *filter, GstVaapiFilterOp op); + gboolean gst_vaapi_filter_set_operation(GstVaapiFilter *filter, GstVaapiFilterOp op, const GValue *value);