vaapipostproc: allow user defined scaling mode.

Add new "scale-method" property to expose the scaling mode to use during
video processing. Note that this is only a hint, and the actual behaviour
may differ from implementation (VA driver) to implementation.
This commit is contained in:
Gwenole Beauchesne 2014-10-29 17:30:30 +01:00
parent 3656659d1c
commit eeb43989c1
2 changed files with 27 additions and 0 deletions

View file

@ -122,6 +122,7 @@ enum {
PROP_SATURATION,
PROP_BRIGHTNESS,
PROP_CONTRAST,
PROP_SCALE_METHOD,
};
#define DEFAULT_FORMAT GST_VIDEO_FORMAT_ENCODED
@ -559,6 +560,11 @@ gst_vaapipostproc_process_vpp(GstBaseTransform *trans, GstBuffer *inbuf,
postproc->contrast))
return GST_FLOW_NOT_SUPPORTED;
if ((postproc->flags & GST_VAAPI_POSTPROC_FLAG_SCALE) &&
!gst_vaapi_filter_set_scaling(postproc->filter,
postproc->scale_method))
return GST_FLOW_NOT_SUPPORTED;
inbuf_meta = gst_buffer_get_vaapi_video_meta(inbuf);
if (!inbuf_meta)
goto error_invalid_buffer;
@ -1439,6 +1445,10 @@ gst_vaapipostproc_set_property(
postproc->contrast = g_value_get_float(value);
postproc->flags |= GST_VAAPI_POSTPROC_FLAG_CONTRAST;
break;
case PROP_SCALE_METHOD:
postproc->scale_method = g_value_get_enum(value);
postproc->flags |= GST_VAAPI_POSTPROC_FLAG_SCALE;
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@ -1492,6 +1502,9 @@ gst_vaapipostproc_get_property(
case PROP_CONTRAST:
g_value_set_float(value, postproc->contrast);
break;
case PROP_SCALE_METHOD:
g_value_set_enum(value, postproc->scale_method);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@ -1705,6 +1718,17 @@ gst_vaapipostproc_class_init(GstVaapiPostprocClass *klass)
g_object_class_install_property(object_class,
PROP_CONTRAST, filter_op->pspec);
/**
* GstVaapiPostproc:scale-method:
*
* The scaling method to use, expressed as an enum value. See
* #GstVaapiScaleMethod.
*/
filter_op = find_filter_op(filter_ops, GST_VAAPI_FILTER_OP_SCALING);
if (filter_op)
g_object_class_install_property(object_class,
PROP_SCALE_METHOD, filter_op->pspec);
g_ptr_array_unref(filter_ops);
}

View file

@ -93,6 +93,7 @@ typedef enum {
* @GST_VAAPI_POSTPROC_FLAG_CONTRAST: Change contrast.
* @GST_VAAPI_POSTPROC_FLAG_DEINTERLACE: Deinterlacing.
* @GST_VAAPI_POSTPROC_FLAG_SIZE: Video scaling.
* @GST_VAAPI_POSTPROC_FLAG_SCALE: Video scaling mode.
*
* The set of operations that are to be performed for each frame.
*/
@ -105,6 +106,7 @@ typedef enum {
GST_VAAPI_POSTPROC_FLAG_BRIGHTNESS = 1 << GST_VAAPI_FILTER_OP_BRIGHTNESS,
GST_VAAPI_POSTPROC_FLAG_CONTRAST = 1 << GST_VAAPI_FILTER_OP_CONTRAST,
GST_VAAPI_POSTPROC_FLAG_DEINTERLACE = 1 << GST_VAAPI_FILTER_OP_DEINTERLACING,
GST_VAAPI_POSTPROC_FLAG_SCALE = 1 << GST_VAAPI_FILTER_OP_SCALING,
/* Additional custom flags */
GST_VAAPI_POSTPROC_FLAG_CUSTOM = 1 << 20,
@ -162,6 +164,7 @@ struct _GstVaapiPostproc {
gfloat sharpen_level;
/* Color balance filter values */
GstVaapiScaleMethod scale_method;
gfloat hue;
gfloat saturation;
gfloat brightness;