resampler: add some options
authorWim Taymans <wtaymans@redhat.com>
Fri, 24 Oct 2014 14:23:53 +0000 (16:23 +0200)
committerWim Taymans <wtaymans@redhat.com>
Wed, 29 Oct 2014 15:26:10 +0000 (16:26 +0100)
gst-libs/gst/video/resampler.c
gst-libs/gst/video/resampler.h

index 4c82f25..54cbde4 100644 (file)
@@ -290,9 +290,18 @@ gst_resampler_init (GstResampler * resampler,
     {
       gdouble resample_inc = in_size / (gdouble) out_size;
 
-      params.envelope = 2.0;
-      params.sharpness = 1.0;
-      params.sharpen = 0.0;
+      if (!options
+          || !gst_structure_get_double (options, GST_RESAMPLER_OPT_ENVELOPE,
+              &params.envelope))
+        params.envelope = 2.0;
+      if (!options
+          || !gst_structure_get_double (options, GST_RESAMPLER_OPT_SHARPNESS,
+              &params.sharpness))
+        params.sharpness = 1.0;
+      if (!options
+          || !gst_structure_get_double (options, GST_RESAMPLER_OPT_SHARPEN,
+              &params.sharpen))
+        params.sharpen = 0.0;
 
       if (resample_inc > 1.0) {
         params.fx = (1.0 / resample_inc) * params.sharpness;
index 95df197..e11096e 100644 (file)
@@ -49,6 +49,33 @@ typedef enum {
 } GstResamplerMethod;
 
 /**
+ * GST_RESAMPLER_OPT_ENVELOPE:
+ *
+ * G_TYPE_DOUBLE, specifies the size of filter envelope for
+ * @GST_RESAMPLER_METHOD_LANCZOS. values are clamped between
+ * 1.0 and 5.0. 2.0 is the default.
+ */
+#define GST_RESAMPLER_OPT_ENVELOPE      "GstResampler.envelope"
+
+/**
+ * GST_RESAMPLER_OPT_SHARPNESS:
+ *
+ * G_TYPE_DOUBLE, specifies sharpness of the filter for
+ * @GST_RESAMPLER_METHOD_LANCZOS. values are clamped between
+ * 0.5 and 1.5. 1.0 is the default.
+ */
+#define GST_RESAMPLER_OPT_SHARPNESS     "GstResampler.sharpness"
+
+/**
+ * GST_RESAMPLER_OPT_SHARPEN:
+ *
+ * G_TYPE_DOUBLE, specifies sharpening of the filter for
+ * @GST_RESAMPLER_METHOD_LANCZOS. values are clamped between
+ * 0.0 and 1.0. 0.0 is the default.
+ */
+#define GST_RESAMPLER_OPT_SHARPEN      "GstResampler.sharpen"
+
+/**
  * GstResamplerFlags:
  * @GST_RESAMPLER_FLAG_NONE: no flags
  *