Add photography interface.
authorNokia Corporation <multimedia@maemo.org>
Fri, 6 Feb 2009 10:06:23 +0000 (12:06 +0200)
committerRené Stadler <rene.stadler@nokia.com>
Mon, 9 Feb 2009 08:22:08 +0000 (10:22 +0200)
configure.ac
gst-libs/gst/Makefile.am
gst-libs/gst/interfaces/Makefile.am [new file with mode: 0644]
gst-libs/gst/interfaces/photography-enumtypes.c [new file with mode: 0644]
gst-libs/gst/interfaces/photography-enumtypes.h [new file with mode: 0644]
gst-libs/gst/interfaces/photography.c [new file with mode: 0644]
gst-libs/gst/interfaces/photography.h [new file with mode: 0644]

index 7f23dcd..7ec7cea 100644 (file)
@@ -1449,6 +1449,7 @@ gst/y4m/Makefile
 gst-libs/Makefile
 gst-libs/gst/Makefile
 gst-libs/gst/dshow/Makefile
+gst-libs/gst/interfaces/Makefile
 sys/Makefile
 sys/dshowdecwrapper/Makefile
 sys/acmenc/Makefile
index 45b1d4f..462f565 100644 (file)
@@ -1,5 +1,5 @@
 
-SUBDIRS = 
+SUBDIRS = interfaces
 
 noinst_HEADERS = gst-i18n-plugin.h gettext.h
 DIST_SUBDIRS = dshow
diff --git a/gst-libs/gst/interfaces/Makefile.am b/gst-libs/gst/interfaces/Makefile.am
new file mode 100644 (file)
index 0000000..5b6977f
--- /dev/null
@@ -0,0 +1,41 @@
+lib_LTLIBRARIES = libgstphotography-@GST_MAJORMINOR@.la
+libgstphotographyincludedir = \
+        $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/interfaces
+
+headers_photography =          \
+       photography.h
+
+# variables used for enum/marshal generation
+glib_enum_headers=$(headers_photography)
+glib_enum_define=GST_PHOTOGRAPHY
+glib_enum_prefix=gst_photography
+
+built_sources = \
+       photography-enumtypes.c
+
+built_headers = \
+       photography-enumtypes.h
+
+libgstphotographyinclude_HEADERS = \
+       $(headers_photography)
+
+nodist_libgstphotographyinclude_HEADERS = \
+       photography-enumtypes.h
+
+libgstphotography_@GST_MAJORMINOR@_la_SOURCES = \
+       photography.c
+
+nodist_libgstphotography_@GST_MAJORMINOR@_la_SOURCES =         \
+       $(built_sources)
+
+libgstphotography_@GST_MAJORMINOR@_la_CFLAGS = $(GST_CFLAGS)
+libgstphotography_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) 
+libgstphotography_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
+
+BUILT_SOURCES = \
+       $(built_sources) \
+       $(built_headers)
+
+CLEANFILES = $(BUILT_SOURCES)
+
+include $(top_srcdir)/common/glib-gen.mak
diff --git a/gst-libs/gst/interfaces/photography-enumtypes.c b/gst-libs/gst/interfaces/photography-enumtypes.c
new file mode 100644 (file)
index 0000000..45e7e83
--- /dev/null
@@ -0,0 +1,179 @@
+
+/* Generated data (by glib-mkenums) */
+
+#include "photography-enumtypes.h"
+
+#include "photography.h"
+
+/* enumerations from "photography.h" */
+GType
+gst_white_balance_mode_get_type (void)
+{
+  static GType etype = 0;
+  if (etype == 0) {
+    static const GEnumValue values[] = {
+      {GST_PHOTOGRAPHY_WB_MODE_AUTO, "GST_PHOTOGRAPHY_WB_MODE_AUTO", "auto"},
+      {GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT, "GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT",
+          "daylight"},
+      {GST_PHOTOGRAPHY_WB_MODE_CLOUDY, "GST_PHOTOGRAPHY_WB_MODE_CLOUDY",
+          "cloudy"},
+      {GST_PHOTOGRAPHY_WB_MODE_SUNSET, "GST_PHOTOGRAPHY_WB_MODE_SUNSET",
+          "sunset"},
+      {GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN, "GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN",
+          "tungsten"},
+      {GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT,
+          "GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT", "fluorescent"},
+      {0, NULL, NULL}
+    };
+    etype = g_enum_register_static ("GstWhiteBalanceMode", values);
+  }
+  return etype;
+}
+
+GType
+gst_colour_tone_mode_get_type (void)
+{
+  static GType etype = 0;
+  if (etype == 0) {
+    static const GEnumValue values[] = {
+      {GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL,
+          "GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL", "normal"},
+      {GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SEPIA,
+          "GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SEPIA", "sepia"},
+      {GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NEGATIVE,
+          "GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NEGATIVE", "negative"},
+      {GST_PHOTOGRAPHY_COLOUR_TONE_MODE_GRAYSCALE,
+          "GST_PHOTOGRAPHY_COLOUR_TONE_MODE_GRAYSCALE", "grayscale"},
+      {GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NATURAL,
+          "GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NATURAL", "natural"},
+      {GST_PHOTOGRAPHY_COLOUR_TONE_MODE_VIVID,
+          "GST_PHOTOGRAPHY_COLOUR_TONE_MODE_VIVID", "vivid"},
+      {GST_PHOTOGRAPHY_COLOUR_TONE_MODE_COLORSWAP,
+          "GST_PHOTOGRAPHY_COLOUR_TONE_MODE_COLORSWAP", "colorswap"},
+      {GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SOLARIZE,
+          "GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SOLARIZE", "solarize"},
+      {GST_PHOTOGRAPHY_COLOUR_TONE_MODE_OUT_OF_FOCUS,
+          "GST_PHOTOGRAPHY_COLOUR_TONE_MODE_OUT_OF_FOCUS", "out-of-focus"},
+      {0, NULL, NULL}
+    };
+    etype = g_enum_register_static ("GstColourToneMode", values);
+  }
+  return etype;
+}
+
+GType
+gst_scene_mode_get_type (void)
+{
+  static GType etype = 0;
+  if (etype == 0) {
+    static const GEnumValue values[] = {
+      {GST_PHOTOGRAPHY_SCENE_MODE_MANUAL, "GST_PHOTOGRAPHY_SCENE_MODE_MANUAL",
+          "manual"},
+      {GST_PHOTOGRAPHY_SCENE_MODE_CLOSEUP, "GST_PHOTOGRAPHY_SCENE_MODE_CLOSEUP",
+          "closeup"},
+      {GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT,
+          "GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT", "portrait"},
+      {GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE,
+          "GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE", "landscape"},
+      {GST_PHOTOGRAPHY_SCENE_MODE_SPORT, "GST_PHOTOGRAPHY_SCENE_MODE_SPORT",
+          "sport"},
+      {GST_PHOTOGRAPHY_SCENE_MODE_NIGHT, "GST_PHOTOGRAPHY_SCENE_MODE_NIGHT",
+          "night"},
+      {GST_PHOTOGRAPHY_SCENE_MODE_AUTO, "GST_PHOTOGRAPHY_SCENE_MODE_AUTO",
+          "auto"},
+      {0, NULL, NULL}
+    };
+    etype = g_enum_register_static ("GstSceneMode", values);
+  }
+  return etype;
+}
+
+GType
+gst_flash_mode_get_type (void)
+{
+  static GType etype = 0;
+  if (etype == 0) {
+    static const GEnumValue values[] = {
+      {GST_PHOTOGRAPHY_FLASH_MODE_AUTO, "GST_PHOTOGRAPHY_FLASH_MODE_AUTO",
+          "auto"},
+      {GST_PHOTOGRAPHY_FLASH_MODE_OFF, "GST_PHOTOGRAPHY_FLASH_MODE_OFF", "off"},
+      {GST_PHOTOGRAPHY_FLASH_MODE_ON, "GST_PHOTOGRAPHY_FLASH_MODE_ON", "on"},
+      {GST_PHOTOGRAPHY_FLASH_MODE_FILL_IN, "GST_PHOTOGRAPHY_FLASH_MODE_FILL_IN",
+          "fill-in"},
+      {GST_PHOTOGRAPHY_FLASH_MODE_RED_EYE, "GST_PHOTOGRAPHY_FLASH_MODE_RED_EYE",
+          "red-eye"},
+      {0, NULL, NULL}
+    };
+    etype = g_enum_register_static ("GstFlashMode", values);
+  }
+  return etype;
+}
+
+GType
+gst_focus_status_get_type (void)
+{
+  static GType etype = 0;
+  if (etype == 0) {
+    static const GEnumValue values[] = {
+      {GST_PHOTOGRAPHY_FOCUS_STATUS_NONE, "GST_PHOTOGRAPHY_FOCUS_STATUS_NONE",
+          "none"},
+      {GST_PHOTOGRAPHY_FOCUS_STATUS_RUNNING,
+          "GST_PHOTOGRAPHY_FOCUS_STATUS_RUNNING", "running"},
+      {GST_PHOTOGRAPHY_FOCUS_STATUS_FAIL, "GST_PHOTOGRAPHY_FOCUS_STATUS_FAIL",
+          "fail"},
+      {GST_PHOTOGRAPHY_FOCUS_STATUS_SUCCESS,
+          "GST_PHOTOGRAPHY_FOCUS_STATUS_SUCCESS", "success"},
+      {0, NULL, NULL}
+    };
+    etype = g_enum_register_static ("GstFocusStatus", values);
+  }
+  return etype;
+}
+
+GType
+gst_photo_caps_get_type (void)
+{
+  static GType etype = 0;
+  if (etype == 0) {
+    static const GFlagsValue values[] = {
+      {GST_PHOTOGRAPHY_CAPS_NONE, "GST_PHOTOGRAPHY_CAPS_NONE", "none"},
+      {GST_PHOTOGRAPHY_CAPS_EV_COMP, "GST_PHOTOGRAPHY_CAPS_EV_COMP", "ev-comp"},
+      {GST_PHOTOGRAPHY_CAPS_ISO_SPEED, "GST_PHOTOGRAPHY_CAPS_ISO_SPEED",
+          "iso-speed"},
+      {GST_PHOTOGRAPHY_CAPS_WB_MODE, "GST_PHOTOGRAPHY_CAPS_WB_MODE", "wb-mode"},
+      {GST_PHOTOGRAPHY_CAPS_TONE, "GST_PHOTOGRAPHY_CAPS_TONE", "tone"},
+      {GST_PHOTOGRAPHY_CAPS_SCENE, "GST_PHOTOGRAPHY_CAPS_SCENE", "scene"},
+      {GST_PHOTOGRAPHY_CAPS_FLASH, "GST_PHOTOGRAPHY_CAPS_FLASH", "flash"},
+      {GST_PHOTOGRAPHY_CAPS_ZOOM, "GST_PHOTOGRAPHY_CAPS_ZOOM", "zoom"},
+      {GST_PHOTOGRAPHY_CAPS_FOCUS, "GST_PHOTOGRAPHY_CAPS_FOCUS", "focus"},
+      {GST_PHOTOGRAPHY_CAPS_APERTURE, "GST_PHOTOGRAPHY_CAPS_APERTURE",
+          "aperture"},
+      {GST_PHOTOGRAPHY_CAPS_EXPOSURE, "GST_PHOTOGRAPHY_CAPS_EXPOSURE",
+          "exposure"},
+      {GST_PHOTOGRAPHY_CAPS_SHAKE, "GST_PHOTOGRAPHY_CAPS_SHAKE", "shake"},
+      {0, NULL, NULL}
+    };
+    etype = g_flags_register_static ("GstPhotoCaps", values);
+  }
+  return etype;
+}
+
+GType
+gst_photo_shake_risk_get_type (void)
+{
+  static GType etype = 0;
+  if (etype == 0) {
+    static const GEnumValue values[] = {
+      {GST_PHOTOGRAPHY_SHAKE_RISK_LOW, "GST_PHOTOGRAPHY_SHAKE_RISK_LOW", "low"},
+      {GST_PHOTOGRAPHY_SHAKE_RISK_MEDIUM, "GST_PHOTOGRAPHY_SHAKE_RISK_MEDIUM",
+          "medium"},
+      {GST_PHOTOGRAPHY_SHAKE_RISK_HIGH, "GST_PHOTOGRAPHY_SHAKE_RISK_HIGH",
+          "high"},
+      {0, NULL, NULL}
+    };
+    etype = g_enum_register_static ("GstPhotoShakeRisk", values);
+  }
+  return etype;
+}
+
+/* Generated data ends here */
diff --git a/gst-libs/gst/interfaces/photography-enumtypes.h b/gst-libs/gst/interfaces/photography-enumtypes.h
new file mode 100644 (file)
index 0000000..8de88b0
--- /dev/null
@@ -0,0 +1,31 @@
+
+/* Generated data (by glib-mkenums) */
+
+#ifndef __GST_PHOTOGRAPHY_ENUM_TYPES_H__
+#define __GST_PHOTOGRAPHY_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* enumerations from "photography.h" */
+GType gst_white_balance_mode_get_type (void);
+#define GST_TYPE_WHITE_BALANCE_MODE (gst_white_balance_mode_get_type())
+GType gst_colour_tone_mode_get_type (void);
+#define GST_TYPE_COLOUR_TONE_MODE (gst_colour_tone_mode_get_type())
+GType gst_scene_mode_get_type (void);
+#define GST_TYPE_SCENE_MODE (gst_scene_mode_get_type())
+GType gst_flash_mode_get_type (void);
+#define GST_TYPE_FLASH_MODE (gst_flash_mode_get_type())
+GType gst_focus_status_get_type (void);
+#define GST_TYPE_FOCUS_STATUS (gst_focus_status_get_type())
+GType gst_photo_caps_get_type (void);
+#define GST_TYPE_PHOTO_CAPS (gst_photo_caps_get_type())
+GType gst_photo_shake_risk_get_type (void);
+#define GST_TYPE_PHOTO_SHAKE_RISK (gst_photo_shake_risk_get_type())
+G_END_DECLS
+
+#endif /* __GST_PHOTOGRAPHY_ENUM_TYPES_H__ */
+
+/* Generated data ends here */
+
diff --git a/gst-libs/gst/interfaces/photography.c b/gst-libs/gst/interfaces/photography.c
new file mode 100644 (file)
index 0000000..7e93b50
--- /dev/null
@@ -0,0 +1,364 @@
+/* GStreamer
+ *
+ * Copyright (C) 2008 Nokia Corporation <multimedia@maemo.org>
+ *
+ * photography.c: photography interface for digital imaging
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "photography.h"
+
+/**
+ * SECTION:photography
+ * @short_description: Interface for elements having digital imaging controls
+ *
+ * The interface allows access to some common digital imaging controls
+ */
+
+static void gst_photography_iface_init (GstPhotographyInterface * iface);
+
+GType
+gst_photography_get_type (void)
+{
+  static GType gst_photography_type = 0;
+
+  if (!gst_photography_type) {
+    static const GTypeInfo gst_photography_info = {
+      sizeof (GstPhotographyInterface),
+      (GBaseInitFunc) gst_photography_iface_init,
+      NULL,
+      NULL,
+      NULL,
+      NULL,
+      0,
+      0,
+      NULL,
+    };
+
+    gst_photography_type = g_type_register_static (G_TYPE_INTERFACE,
+        "GstPhotography", &gst_photography_info, 0);
+    g_type_interface_add_prerequisite (gst_photography_type,
+        GST_TYPE_IMPLEMENTS_INTERFACE);
+  }
+
+  return gst_photography_type;
+}
+
+static void
+gst_photography_iface_init (GstPhotographyInterface * iface)
+{
+  /* default virtual functions */
+  iface->get_ev_compensation = NULL;
+  iface->get_iso_speed = NULL;
+  iface->get_aperture = NULL;
+  iface->get_exposure = NULL;
+  iface->get_white_balance_mode = NULL;
+  iface->get_colour_tone_mode = NULL;
+  iface->get_scene_mode = NULL;
+  iface->get_flash_mode = NULL;
+  iface->get_zoom = NULL;
+
+  iface->set_ev_compensation = NULL;
+  iface->set_iso_speed = NULL;
+  iface->set_aperture = NULL;
+  iface->set_exposure = NULL;
+  iface->set_white_balance_mode = NULL;
+  iface->set_colour_tone_mode = NULL;
+  iface->set_scene_mode = NULL;
+  iface->set_flash_mode = NULL;
+  iface->set_zoom = NULL;
+
+  iface->get_capabilities = NULL;
+  iface->prepare_for_capture = NULL;
+  iface->set_autofocus = NULL;
+}
+
+#define GST_PHOTOGRAPHY_FUNC_TEMPLATE(function_name, param_type) \
+gboolean \
+gst_photography_set_ ## function_name (GstPhotography * photo, param_type param) \
+{ \
+  GstPhotographyInterface *iface; \
+  g_return_val_if_fail (photo != NULL, FALSE); \
+  iface = GST_PHOTOGRAPHY_GET_IFACE (photo); \
+  if (iface->set_ ## function_name) { \
+    return iface->set_ ## function_name (photo, param); \
+  } \
+  return FALSE; \
+} \
+gboolean \
+gst_photography_get_ ## function_name (GstPhotography * photo, param_type * param) \
+{ \
+  GstPhotographyInterface *iface; \
+  g_return_val_if_fail (photo != NULL, FALSE); \
+  iface = GST_PHOTOGRAPHY_GET_IFACE (photo); \
+  if (iface->get_ ## function_name) { \
+    return iface->get_ ## function_name (photo, param); \
+  } \
+  return FALSE; \
+}
+
+
+/**
+ * gst_photography_set_ev_compensation:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @ev_comp: ev compensation value to set
+ *
+ * Set the ev compensation value for the #GstElement
+ *
+ * Returns: %TRUE if setting the value succeeded, %FALSE otherwise
+ */
+/**
+ * gst_photography_get_ev_compensation:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @ev_comp: ev compensation value to get
+ *
+ * Get the ev compensation value for the #GstElement
+ *
+ * Returns: %TRUE if getting the value succeeded, %FALSE otherwise
+ */
+GST_PHOTOGRAPHY_FUNC_TEMPLATE (ev_compensation, gfloat);
+
+/**
+ * gst_photography_set_iso_speed:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @iso_speed: ISO speed value to set
+ *
+ * Set the ISO value (light sensivity) for the #GstElement
+ *
+ * Returns: %TRUE if setting the value succeeded, %FALSE otherwise
+ */
+/**
+ * gst_photography_get_iso_speed:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @iso_speed: ISO speed value to get
+ *
+ * Get the ISO value (light sensivity) for the #GstElement
+ *
+ * Returns: %TRUE if getting the value succeeded, %FALSE otherwise
+ */
+GST_PHOTOGRAPHY_FUNC_TEMPLATE (iso_speed, guint);
+
+/**
+ * gst_photography_set_aperture:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @aperture: aperture value to set
+ *
+ * Set the aperture value for the #GstElement
+ *
+ * Returns: %TRUE if setting the value succeeded, %FALSE otherwise
+ */
+/**
+ * gst_photography_get_aperture:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @aperture: aperture value to get
+ *
+ * Get the aperture value for the #GstElement
+ *
+ * Returns: %TRUE if getting the value succeeded, %FALSE otherwise
+ */
+GST_PHOTOGRAPHY_FUNC_TEMPLATE (aperture, guint);
+
+/**
+ * gst_photography_set_exposure:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @exposure: exposure time to set
+ *
+ * Set the fixed exposure time (in us) for the #GstElement
+ *
+ * Returns: %TRUE if setting the value succeeded, %FALSE otherwise
+ */
+/**
+ * gst_photography_get_exposure:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @exposure: exposure time to get
+ *
+ * Get the fixed exposure time (in us) for the #GstElement
+ *
+ * Returns: %TRUE if getting the value succeeded, %FALSE otherwise
+ */
+GST_PHOTOGRAPHY_FUNC_TEMPLATE (exposure, guint32);
+
+/**
+ * gst_photography_set_white_balance_mode:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @wb_mode: #GstWhiteBalanceMode to set
+ *
+ * Set the white balance mode for the #GstElement
+ *
+ * Returns: %TRUE if setting the value succeeded, %FALSE otherwise
+ */
+/**
+ * gst_photography_get_white_balance_mode:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @wb_mode: #GstWhiteBalanceMode to get
+ *
+ * Get the white balance mode for the #GstElement
+ *
+ * Returns: %TRUE if getting the value succeeded, %FALSE otherwise
+ */
+GST_PHOTOGRAPHY_FUNC_TEMPLATE (white_balance_mode, GstWhiteBalanceMode);
+
+/**
+ * gst_photography_set_colour_tone_mode:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @tone_mode: #GstColourToneMode to set
+ *
+ * Set the colour tone mode for the #GstElement
+ *
+ * Returns: %TRUE if setting the value succeeded, %FALSE otherwise
+ */
+/**
+ * gst_photography_get_colour_tone_mode:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @tone_mode: #GstColourToneMode to get
+ *
+ * Get the colour tone mode for the #GstElement
+ *
+ * Returns: %TRUE if getting the value succeeded, %FALSE otherwise
+ */
+GST_PHOTOGRAPHY_FUNC_TEMPLATE (colour_tone_mode, GstColourToneMode);
+
+/**
+ * gst_photography_set_scene_mode:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @scene_mode: #GstSceneMode to set
+ *
+ * Set the scene mode for the #GstElement
+ *
+ * Returns: %TRUE if setting the value succeeded, %FALSE otherwise
+ */
+/**
+ * gst_photography_get_scene_mode:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @scene_mode: #GstSceneMode to get
+ *
+ * Get the scene mode for the #GstElement
+ *
+ * Returns: %TRUE if getting the value succeeded, %FALSE otherwise
+ */
+GST_PHOTOGRAPHY_FUNC_TEMPLATE (scene_mode, GstSceneMode);
+
+/**
+ * gst_photography_set_flash_mode:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @flash_mode: #GstFlashMode to set
+ *
+ * Set the flash mode for the #GstElement
+ *
+ * Returns: %TRUE if setting the value succeeded, %FALSE otherwise
+ */
+/**
+ * gst_photography_get_flash_mode:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @flash_mode: #GstFlashMode to get
+ *
+ * Get the flash mode for the #GstElement
+ *
+ * Returns: %TRUE if getting the value succeeded, %FALSE otherwise
+ */
+GST_PHOTOGRAPHY_FUNC_TEMPLATE (flash_mode, GstFlashMode);
+
+/**
+ * gst_photography_set_zoom:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @zoom: zoom value to set
+ *
+ * Set the zoom value for the #GstElement.
+ * E.g. 1.0 to get original image and 3.0 for 3x zoom and so on.
+ *
+ * Returns: %TRUE if setting the value succeeded, %FALSE otherwise
+ */
+/**
+ * gst_photography_get_zoom:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @zoom: zoom value to get
+ *
+ * Get the zoom value for the #GstElement
+ *
+ * Returns: %TRUE if getting the value succeeded, %FALSE otherwise
+ */
+GST_PHOTOGRAPHY_FUNC_TEMPLATE (zoom, gfloat);
+
+/**
+ * gst_photography_get_capabilities:
+ * @photo: #GstPhotography interface of a #GstElement
+ *
+ * Get #GstPhotoCaps bitmask value that indicates what photography
+ * interface features the #GstElement supports
+ *
+ * Returns: #GstPhotoCaps value
+ */
+GstPhotoCaps
+gst_photography_get_capabilities (GstPhotography * photo)
+{
+  GstPhotographyInterface *iface;
+  g_return_val_if_fail (photo != NULL, GST_PHOTOGRAPHY_CAPS_NONE);
+
+  iface = GST_PHOTOGRAPHY_GET_IFACE (photo);
+  if (iface->get_capabilities) {
+    return iface->get_capabilities (photo);
+  } else {
+    return GST_PHOTOGRAPHY_CAPS_NONE;
+  }
+}
+
+/**
+ * gst_photography_prepare_for_capture:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @func: callback that is called after capturing has been prepared
+ * @user_data: user data that will be passed to the callback @func
+ *
+ * Start preparations for capture. @func callback is called after
+ * preparations are done.
+ */
+void
+gst_photography_prepare_for_capture (GstPhotography * photo,
+    GstPhotoCapturePrepared func, gpointer user_data)
+{
+  GstPhotographyInterface *iface;
+  g_return_if_fail (photo != NULL);
+
+  iface = GST_PHOTOGRAPHY_GET_IFACE (photo);
+  if (iface->prepare_for_capture) {
+    iface->prepare_for_capture (photo, func, user_data);
+  }
+}
+
+/**
+ * gst_photography_set_autofocus:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @on: %TRUE to start autofocusing, %FALSE to stop autofocusing
+ *
+ * Start or stop autofocusing. %GST_PHOTOGRAPHY_AUTOFOCUS_DONE
+ * message is posted to bus when autofocusing has finished.
+ */
+void
+gst_photography_set_autofocus (GstPhotography * photo, gboolean on)
+{
+  GstPhotographyInterface *iface;
+  g_return_if_fail (photo != NULL);
+
+  iface = GST_PHOTOGRAPHY_GET_IFACE (photo);
+  if (iface->set_autofocus) {
+    iface->set_autofocus (photo, on);
+  }
+}
diff --git a/gst-libs/gst/interfaces/photography.h b/gst-libs/gst/interfaces/photography.h
new file mode 100644 (file)
index 0000000..199a700
--- /dev/null
@@ -0,0 +1,267 @@
+/* GStreamer
+ *
+ * Copyright (C) 2008 Nokia Corporation <multimedia@maemo.org>
+ *
+ * photography.h: photography interface for digital imaging
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_PHOTOGRAPHY_H__
+#define __GST_PHOTOGRAPHY_H__
+
+#include <gst/gst.h>
+#include <gst/interfaces/photography-enumtypes.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PHOTOGRAPHY \
+  (gst_photography_get_type ())
+#define GST_PHOTOGRAPHY(obj) \
+  (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PHOTOGRAPHY, GstPhotography))
+#define GST_IS_PHOTOGRAPHY(obj) \
+  (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PHOTOGRAPHY))
+#define GST_PHOTOGRAPHY_GET_IFACE(inst) \
+  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_PHOTOGRAPHY, GstPhotographyInterface))
+
+
+/* Custom GstMessage name that will be sent to GstBus when autofocusing
+   is complete */
+#define GST_PHOTOGRAPHY_AUTOFOCUS_DONE "autofocus-done"
+
+/* Custom GstMessage name that will be sent to GstBus when shake risk changes */
+#define GST_PHOTOGRAPHY_SHAKE_RISK "shake-risk"
+
+/**
+ * GstPhotography:
+ *
+ * Opaque #GstPhotography data structure.
+ */
+typedef struct _GstPhotography GstPhotography;
+
+typedef enum
+{
+  GST_PHOTOGRAPHY_WB_MODE_AUTO = 0,
+  GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT,
+  GST_PHOTOGRAPHY_WB_MODE_CLOUDY,
+  GST_PHOTOGRAPHY_WB_MODE_SUNSET,
+  GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN,
+  GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT
+} GstWhiteBalanceMode;
+
+typedef enum
+{
+  GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL = 0,
+  GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SEPIA,
+  GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NEGATIVE,
+  GST_PHOTOGRAPHY_COLOUR_TONE_MODE_GRAYSCALE,
+  GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NATURAL,
+  GST_PHOTOGRAPHY_COLOUR_TONE_MODE_VIVID,
+  GST_PHOTOGRAPHY_COLOUR_TONE_MODE_COLORSWAP,
+  GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SOLARIZE,
+  GST_PHOTOGRAPHY_COLOUR_TONE_MODE_OUT_OF_FOCUS
+} GstColourToneMode;
+
+typedef enum
+{
+  GST_PHOTOGRAPHY_SCENE_MODE_MANUAL = 0,
+  GST_PHOTOGRAPHY_SCENE_MODE_CLOSEUP,
+  GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT,
+  GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE,
+  GST_PHOTOGRAPHY_SCENE_MODE_SPORT,
+  GST_PHOTOGRAPHY_SCENE_MODE_NIGHT,
+  GST_PHOTOGRAPHY_SCENE_MODE_AUTO
+} GstSceneMode;
+
+typedef enum
+{
+  GST_PHOTOGRAPHY_FLASH_MODE_AUTO = 0,
+  GST_PHOTOGRAPHY_FLASH_MODE_OFF,
+  GST_PHOTOGRAPHY_FLASH_MODE_ON,
+  GST_PHOTOGRAPHY_FLASH_MODE_FILL_IN,
+  GST_PHOTOGRAPHY_FLASH_MODE_RED_EYE
+} GstFlashMode;
+
+typedef enum
+{
+  GST_PHOTOGRAPHY_FOCUS_STATUS_NONE = 0,
+  GST_PHOTOGRAPHY_FOCUS_STATUS_RUNNING,
+  GST_PHOTOGRAPHY_FOCUS_STATUS_FAIL,
+  GST_PHOTOGRAPHY_FOCUS_STATUS_SUCCESS
+} GstFocusStatus;
+
+typedef enum
+{
+  GST_PHOTOGRAPHY_CAPS_NONE = (0 << 0),
+  GST_PHOTOGRAPHY_CAPS_EV_COMP = (1 << 0),
+  GST_PHOTOGRAPHY_CAPS_ISO_SPEED = (1 << 1),
+  GST_PHOTOGRAPHY_CAPS_WB_MODE = (1 << 2),
+  GST_PHOTOGRAPHY_CAPS_TONE = (1 << 3),
+  GST_PHOTOGRAPHY_CAPS_SCENE = (1 << 4),
+  GST_PHOTOGRAPHY_CAPS_FLASH = (1 << 5),
+  GST_PHOTOGRAPHY_CAPS_ZOOM = (1 << 6),
+  GST_PHOTOGRAPHY_CAPS_FOCUS = (1 << 7),
+  GST_PHOTOGRAPHY_CAPS_APERTURE = (1 << 8),
+  GST_PHOTOGRAPHY_CAPS_EXPOSURE = (1 << 9),
+  GST_PHOTOGRAPHY_CAPS_SHAKE = (1 << 10)
+} GstPhotoCaps;
+
+typedef enum
+{
+  GST_PHOTOGRAPHY_SHAKE_RISK_LOW = 0,
+  GST_PHOTOGRAPHY_SHAKE_RISK_MEDIUM,
+  GST_PHOTOGRAPHY_SHAKE_RISK_HIGH,
+} GstPhotoShakeRisk;
+
+typedef struct
+{
+  GstWhiteBalanceMode wb_mode;
+  GstColourToneMode tone_mode;
+  GstSceneMode scene_mode;
+  GstFlashMode flash_mode;
+  guint32 exposure;
+  guint aperture;
+  gfloat ev_compensation;
+  guint iso_speed;
+  gfloat zoom;
+} GstPhotoSettings;
+
+/**
+ * GstPhotoCapturePrepared:
+ * @data: user data that has been given, when registering the callback
+ *
+ * This callback will be called when the element has finished preparations
+ * for photo capture.
+ */
+typedef void (*GstPhotoCapturePrepared) (gpointer data);
+
+/**
+ * GstPhotographyInterface:
+ * @parent: parent interface type.
+ * @get_ev_compensation: vmethod to get ev exposure compensation value
+ * @get_iso_speed: vmethod to get iso speed (light sensitivity) value
+ * @get_aperture: vmethod to get aperture value
+ * @get_exposure: vmethod to get exposure time value
+ * @get_white_balance_mode: vmethod to get white balance mode value
+ * @get_colour_tone_mode: vmethod to get colour tone mode value
+ * @get_scene_mode: vmethod to get scene mode value
+ * @get_flash_mode: vmethod to get flash mode value
+ * @get_zoom: vmethod to get zoom factor value
+ * @set_ev_compensation: vmethod to set ev exposure compensation value
+ * @set_iso_speed: vmethod to set iso speed (light sensitivity) value
+ * @set_aperture: vmethod to set aperture value
+ * @set_exposure: vmethod to set exposure time value
+ * @set_white_balance_mode: vmethod to set white balance mode value
+ * @set_colour_tone_mode: vmethod to set colour tone mode value
+ * @set_scene_mode: vmethod to set scene mode value
+ * @set_flash_mode: vmethod to set flash mode value
+ * @set_zoom: vmethod to set zoom factor value
+ * @get_capabilities: vmethod to get supported capabilities of the interface
+ * @prepare_for_capture: vmethod to tell the element to prepare for capturing
+ * @set_autofocus: vmethod to set autofocus on/off
+ *
+ * #GstPhotographyInterface interface.
+ */
+typedef struct _GstPhotographyInterface
+{
+  GTypeInterface parent;
+
+  /* virtual functions */
+    gboolean (*get_ev_compensation) (GstPhotography * photo, gfloat * ev_comp);
+    gboolean (*get_iso_speed) (GstPhotography * photo, guint * iso_speed);
+    gboolean (*get_aperture) (GstPhotography * photo, guint * aperture);
+    gboolean (*get_exposure) (GstPhotography * photo, guint32 * exposure);
+    gboolean (*get_white_balance_mode) (GstPhotography * photo,
+      GstWhiteBalanceMode * wb_mode);
+    gboolean (*get_colour_tone_mode) (GstPhotography * photo,
+      GstColourToneMode * tone_mode);
+    gboolean (*get_scene_mode) (GstPhotography * photo,
+      GstSceneMode * scene_mode);
+    gboolean (*get_flash_mode) (GstPhotography * photo,
+      GstFlashMode * flash_mode);
+    gboolean (*get_zoom) (GstPhotography * photo, gfloat * zoom);
+
+    gboolean (*set_ev_compensation) (GstPhotography * photo, gfloat ev_comp);
+    gboolean (*set_iso_speed) (GstPhotography * photo, guint iso_speed);
+    gboolean (*set_aperture) (GstPhotography * photo, guint aperture);
+    gboolean (*set_exposure) (GstPhotography * photo, guint32 exposure);
+    gboolean (*set_white_balance_mode) (GstPhotography * photo,
+      GstWhiteBalanceMode wb_mode);
+    gboolean (*set_colour_tone_mode) (GstPhotography * photo,
+      GstColourToneMode tone_mode);
+    gboolean (*set_scene_mode) (GstPhotography * photo,
+      GstSceneMode scene_mode);
+    gboolean (*set_flash_mode) (GstPhotography * photo,
+      GstFlashMode flash_mode);
+    gboolean (*set_zoom) (GstPhotography * photo, gfloat zoom);
+
+    GstPhotoCaps (*get_capabilities) (GstPhotography * photo);
+  void (*prepare_for_capture) (GstPhotography * photo,
+      GstPhotoCapturePrepared func, gpointer user_data);
+  void (*set_autofocus) (GstPhotography * photo, gboolean on);
+
+  /*< private > */
+  gpointer _gst_reserved[GST_PADDING];
+} GstPhotographyInterface;
+
+GType gst_photography_get_type (void);
+
+/* virtual class function wrappers */
+gboolean gst_photography_get_ev_compensation (GstPhotography * photo,
+    gfloat * ev_comp);
+gboolean gst_photography_get_iso_speed (GstPhotography * photo,
+    guint * iso_speed);
+gboolean gst_photography_get_aperture (GstPhotography * photo,
+    guint * aperture);
+gboolean gst_photography_get_exposure (GstPhotography * photo,
+    guint32 * exposure);
+gboolean gst_photography_get_white_balance_mode (GstPhotography * photo,
+    GstWhiteBalanceMode * wb_mode);
+gboolean gst_photography_get_colour_tone_mode (GstPhotography * photo,
+    GstColourToneMode * tone_mode);
+gboolean gst_photography_get_scene_mode (GstPhotography * photo,
+    GstSceneMode * scene_mode);
+gboolean gst_photography_get_flash_mode (GstPhotography * photo,
+    GstFlashMode * flash_mode);
+gboolean gst_photography_get_zoom (GstPhotography * photo, gfloat * zoom);
+
+gboolean gst_photography_set_ev_compensation (GstPhotography * photo,
+    gfloat ev_comp);
+gboolean gst_photography_set_iso_speed (GstPhotography * photo,
+    guint iso_speed);
+gboolean gst_photography_set_aperture (GstPhotography * photo, guint aperture);
+gboolean gst_photography_set_exposure (GstPhotography * photo, guint exposure);
+gboolean gst_photography_set_white_balance_mode (GstPhotography * photo,
+    GstWhiteBalanceMode wb_mode);
+gboolean gst_photography_set_colour_tone_mode (GstPhotography * photo,
+    GstColourToneMode tone_mode);
+gboolean gst_photography_set_scene_mode (GstPhotography * photo,
+    GstSceneMode scene_mode);
+gboolean gst_photography_set_flash_mode (GstPhotography * photo,
+    GstFlashMode flash_mode);
+gboolean gst_photography_set_zoom (GstPhotography * photo, gfloat zoom);
+
+GstPhotoCaps gst_photography_get_capabilities (GstPhotography * photo);
+
+void gst_photography_prepare_for_capture (GstPhotography * photo,
+    GstPhotoCapturePrepared func, gpointer user_data);
+
+void gst_photography_set_autofocus (GstPhotography * photo, gboolean on);
+
+G_END_DECLS
+
+#endif /* __GST_PHOTOGRAPHY_H__ */