photography: Add manual control of exposure, focus and white balance
authorLasse Laukkanen <ext-lasse.2.laukkanen@nokia.com>
Thu, 14 Oct 2010 07:49:55 +0000 (10:49 +0300)
committerTim-Philipp Müller <tim@centricular.net>
Tue, 10 Jul 2012 23:10:55 +0000 (00:10 +0100)
Add new interface properties and mode for better manual control of
exposure, focus and white balance.

https://bugzilla.gnome.org/show_bug.cgi?id=622482

gst-libs/gst/interfaces/photography.c
gst-libs/gst/interfaces/photography.h

index 3761a86..b5a50e4 100644 (file)
@@ -591,7 +591,7 @@ gst_photography_iface_class_init (gpointer g_class)
 
   /* Exposure */
   g_object_interface_install_property (g_class,
-      g_param_spec_uint (GST_PHOTOGRAPHY_PROP_EXPOSURE,
+      g_param_spec_uint (GST_PHOTOGRAPHY_PROP_EXPOSURE_TIME,
           "Exposure time in milliseconds",
           "Exposure time defines how long the shutter will stay open (0 = auto)",
           0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
@@ -617,6 +617,83 @@ gst_photography_iface_class_init (gpointer g_class)
           "How much the resulted image will be zoomed",
           1.0f, 10.0f, 1.0f, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  /**
+   * GstPhotography:color-temperature:
+   *
+   * Color temperature parameter for manual white balance.
+   * Control color temperature in Kelvin units.
+   */
+  g_object_interface_install_property (g_class,
+      g_param_spec_uint (GST_PHOTOGRAPHY_PROP_COLOR_TEMPERATURE,
+          "Color temperature in Kelvin units",
+          "Color temperature in Kelvin units for manual white balance",
+          0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstPhotography:white-point:
+   *
+   * White point parameter for manual white balance.
+   * Describes the color "white" as raw values.
+   *
+   * FIXME: check and document correct representation for white point
+   */
+  g_object_interface_install_property (g_class,
+      g_param_spec_value_array (GST_PHOTOGRAPHY_PROP_WHITE_POINT,
+          "White point",
+          "Describe color white as raw values",
+          g_param_spec_uint ("raw-value", "Raw value",
+              "Raw value", 0, G_MAXUINT, 0,
+              G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS),
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstPhotography:analog-gain:
+   *
+   * Linear multiplicative value how much amplification is applied to the signal
+   * before A-D conversion.
+   */
+  g_object_interface_install_property (g_class,
+      g_param_spec_float (GST_PHOTOGRAPHY_PROP_ANALOG_GAIN,
+          "Analog gain applied to the sensor",
+          "Analog gain applied to the sensor",
+          1.0f, G_MAXFLOAT, 1.0f, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstPhotography:lens-focus:
+   *
+   * Manual changing of lens focus in diopter units.
+   * Inteded use with GST_PHOTOGRAPHY_FOCUS_MODE_MANUAL focus mode, otherwise
+   * to be ignored.
+   *
+   */
+  g_object_interface_install_property (g_class,
+      g_param_spec_float (GST_PHOTOGRAPHY_PROP_LENS_FOCUS,
+          "Manual lens focus",
+          "Focus point in diopter units",
+          0.0f, G_MAXFLOAT, 0.0f, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstPhotography:min-exposure-time:
+   *
+   * Minimum exposure time for automatic exposure mode.
+   */
+  g_object_interface_install_property (g_class,
+      g_param_spec_uint (GST_PHOTOGRAPHY_PROP_MIN_EXPOSURE_TIME,
+          "Minimum exposure time",
+          "Minimum exposure time for automatic exposure mode",
+          0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstPhotography:max-exposure-time:
+   *
+   * Maximum exposure time for automatic exposure mode.
+   */
+  g_object_interface_install_property (g_class,
+      g_param_spec_uint (GST_PHOTOGRAPHY_PROP_MAX_EXPOSURE_TIME,
+          "Maximum exposure time",
+          "Maximum exposure time for automatic exposure mode",
+          0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
   /* Noise Reduction, Bayer an YCC noise reduction are enabled by default */
   g_object_interface_install_property (g_class,
       g_param_spec_flags (GST_PHOTOGRAPHY_PROP_NOISE_REDUCTION,
index 27c55eb..f0351bf 100644 (file)
@@ -51,6 +51,9 @@ G_BEGIN_DECLS
 /* Custom GstMessage name that will be sent to GstBus when shake risk changes */
 #define GST_PHOTOGRAPHY_SHAKE_RISK "shake-risk"
 
+/* Maximum white point values used in #GstPhotographySettings */
+#define MAX_WHITE_POINT_VALUES 4
+
 /* Interface property names */
 #define GST_PHOTOGRAPHY_PROP_WB_MODE      "white-balance-mode"
 #define GST_PHOTOGRAPHY_PROP_COLOR_TONE   "color-tone-mode"
@@ -63,7 +66,7 @@ G_BEGIN_DECLS
 #define GST_PHOTOGRAPHY_PROP_EV_COMP      "ev-compensation"
 #define GST_PHOTOGRAPHY_PROP_ISO_SPEED    "iso-speed"
 #define GST_PHOTOGRAPHY_PROP_APERTURE     "aperture"
-#define GST_PHOTOGRAPHY_PROP_EXPOSURE     "exposure"
+#define GST_PHOTOGRAPHY_PROP_EXPOSURE_TIME     "exposure-time"
 #define GST_PHOTOGRAPHY_PROP_IMAGE_CAPTURE_SUPPORTED_CAPS \
     "image-capture-supported-caps"
 #define GST_PHOTOGRAPHY_PROP_IMAGE_PREVIEW_SUPPORTED_CAPS \
@@ -71,6 +74,13 @@ G_BEGIN_DECLS
 #define GST_PHOTOGRAPHY_PROP_FLICKER_MODE "flicker-mode"
 #define GST_PHOTOGRAPHY_PROP_FOCUS_MODE   "focus-mode"
 #define GST_PHOTOGRAPHY_PROP_ZOOM   "zoom"
+#define GST_PHOTOGRAPHY_PROP_COLOR_TEMPERATURE "color-temperature"
+#define GST_PHOTOGRAPHY_PROP_WHITE_POINT  "white-point"
+#define GST_PHOTOGRAPHY_PROP_ANALOG_GAIN  "analog-gain"
+#define GST_PHOTOGRAPHY_PROP_EXPOSURE_MODE     "exposure-mode"
+#define GST_PHOTOGRAPHY_PROP_LENS_FOCUS   "lens-focus"
+#define GST_PHOTOGRAPHY_PROP_MIN_EXPOSURE_TIME "min-exposure-time"
+#define GST_PHOTOGRAPHY_PROP_MAX_EXPOSURE_TIME "max-exposure-time"
 
 /**
  * GstPhotography:
@@ -114,7 +124,8 @@ typedef enum
   GST_PHOTOGRAPHY_WB_MODE_CLOUDY,
   GST_PHOTOGRAPHY_WB_MODE_SUNSET,
   GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN,
-  GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT
+  GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT,
+  GST_PHOTOGRAPHY_WB_MODE_MANUAL
 } GstPhotographyWhiteBalanceMode;
 
 typedef enum
@@ -175,8 +186,9 @@ typedef enum
   GST_PHOTOGRAPHY_CAPS_APERTURE = (1 << 8),
   GST_PHOTOGRAPHY_CAPS_EXPOSURE = (1 << 9),
   GST_PHOTOGRAPHY_CAPS_SHAKE = (1 << 10),
-  GST_PHOTOGRAPHY_CAPS_NOISE_REDUCTION = (1 << 11),
-  GST_PHOTOGRAPHY_CAPS_FLICKER_REDUCTION = (1 << 12),
+  GST_PHOTOGRAPHY_CAPS_WHITE_BALANCE = (1 << 11),
+  GST_PHOTOGRAPHY_CAPS_NOISE_REDUCTION = (1 << 12),
+  GST_PHOTOGRAPHY_CAPS_FLICKER_REDUCTION = (1 << 13),
   GST_PHOTOGRAPHY_CAPS_ALL = (~0)
 } GstPhotographyCaps;
 
@@ -204,15 +216,21 @@ typedef enum {
     GST_PHOTOGRAPHY_FOCUS_MODE_EXTENDED,
     GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL,
     GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_EXTENDED,
+    GST_PHOTOGRAPHY_FOCUS_MODE_MANUAL
 } GstPhotographyFocusMode;
 
+typedef enum {
+    GST_PHOTOGRAPHY_EXPOSURE_MODE_AUTO = 0,
+    GST_PHOTOGRAPHY_EXPOSURE_MODE_MANUAL
+} GstPhotographyExposureMode;
+
 typedef struct
 {
   GstPhotographyWhiteBalanceMode wb_mode;
   GstPhotographyColorToneMode tone_mode;
   GstPhotographySceneMode scene_mode;
   GstPhotographyFlashMode flash_mode;
-  guint32 exposure;
+  guint32 exposure_time;
   guint aperture;
   gfloat ev_compensation;
   guint iso_speed;
@@ -220,6 +238,13 @@ typedef struct
   GstPhotographyFlickerReductionMode flicker_mode;
   GstPhotographyFocusMode focus_mode;
   GstPhotographyNoiseReduction noise_reduction;
+  GstPhotographyExposureMode exposure_mode;
+  guint color_temperature;
+  guint white_point[MAX_WHITE_POINT_VALUES];
+  gfloat analog_gain;
+  gfloat lens_focus;
+  guint min_exposure_time;
+  guint max_exposure_time;
 } GstPhotographySettings;
 
 /**