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.
This commit is contained in:
Gwenole Beauchesne 2013-11-21 17:20:28 +01:00
parent a1189301c9
commit 152ffb52d2
3 changed files with 55 additions and 0 deletions

View file

@ -384,6 +384,8 @@ gst_vaapi_filter_unref
gst_vaapi_filter_replace gst_vaapi_filter_replace
gst_vaapi_filter_get_operations gst_vaapi_filter_get_operations
gst_vaapi_filter_get_formats gst_vaapi_filter_get_formats
gst_vaapi_filter_has_operation
gst_vaapi_filter_use_operation
gst_vaapi_filter_set_operation gst_vaapi_filter_set_operation
gst_vaapi_filter_set_format gst_vaapi_filter_set_format
gst_vaapi_filter_set_cropping_rectangle gst_vaapi_filter_set_cropping_rectangle

View file

@ -1116,6 +1116,53 @@ gst_vaapi_filter_get_operations(GstVaapiFilter *filter)
return get_operations(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: * gst_vaapi_filter_set_operation:
* @filter: a #GstVaapiFilter * @filter: a #GstVaapiFilter

View file

@ -149,6 +149,12 @@ gst_vaapi_filter_replace(GstVaapiFilter **old_filter_ptr,
GPtrArray * GPtrArray *
gst_vaapi_filter_get_operations(GstVaapiFilter *filter); 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 gboolean
gst_vaapi_filter_set_operation(GstVaapiFilter *filter, GstVaapiFilterOp op, gst_vaapi_filter_set_operation(GstVaapiFilter *filter, GstVaapiFilterOp op,
const GValue *value); const GValue *value);