[gst-cvs] gst-plugins-bad: camerabin: add api to query supported image capture resolution

Thiago Sousa Santos thiagoss at kemper.freedesktop.org
Tue Apr 13 08:46:25 PDT 2010


Module: gst-plugins-bad
Branch: master
Commit: 2c05df08b2daf3979efe94eb221511ccd21ef0c9
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=2c05df08b2daf3979efe94eb221511ccd21ef0c9

Author: Lasse Laukkanen <ext-lasse.2.laukkanen at nokia.com>
Date:   Mon Sep 21 17:47:20 2009 +0300

camerabin: add api to query supported image capture resolution

Adds new property 'image-capture-supported-caps' to GstPhotography
to query the supported image capture caps.
Also implement it in camerabin.

---

 gst-libs/gst/interfaces/photography.c   |    7 +++++++
 gst-libs/gst/interfaces/photography.h   |    3 +++
 gst/camerabin/gstcamerabin-enum.h       |    3 ++-
 gst/camerabin/gstcamerabin.c            |    4 ++++
 gst/camerabin/gstcamerabinphotography.c |   12 ++++++++++++
 5 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/gst-libs/gst/interfaces/photography.c b/gst-libs/gst/interfaces/photography.c
index 29c3996..0f98d1b 100644
--- a/gst-libs/gst/interfaces/photography.c
+++ b/gst-libs/gst/interfaces/photography.c
@@ -500,4 +500,11 @@ gst_photography_iface_class_init (gpointer g_class)
           "Exposure time in milliseconds",
           "Exposure time defines how long the shutter will stay open (0 = auto)",
           0, G_MAXUINT32, 0, G_PARAM_READWRITE));
+
+  /* Image capture caps */
+  g_object_interface_install_property (g_class,
+      g_param_spec_boxed (GST_PHOTOGRAPHY_PROP_IMAGE_CAPTURE_SUPPORTED_CAPS,
+          "Image capture supported caps",
+          "Caps describing supported image capture formats", GST_TYPE_CAPS,
+          G_PARAM_READABLE));
 }
diff --git a/gst-libs/gst/interfaces/photography.h b/gst-libs/gst/interfaces/photography.h
index 651f667..65a638f 100644
--- a/gst-libs/gst/interfaces/photography.h
+++ b/gst-libs/gst/interfaces/photography.h
@@ -63,6 +63,8 @@ G_BEGIN_DECLS
 #define GST_PHOTOGRAPHY_PROP_ISO_SPEED    "iso-speed"
 #define GST_PHOTOGRAPHY_PROP_APERTURE     "aperture"
 #define GST_PHOTOGRAPHY_PROP_EXPOSURE     "exposure"
+#define GST_PHOTOGRAPHY_PROP_IMAGE_CAPTURE_SUPPORTED_CAPS \
+    "image-capture-supported-caps"
 
 /**
  * GstPhotography:
@@ -196,6 +198,7 @@ typedef void (*GstPhotoCapturePrepared) (gpointer data,
  * @set_autofocus: vmethod to set autofocus on/off
  * @set_config: vmethod to set all configuration parameters at once
  * @get_config: vmethod to get all configuration parameters at once
+ * @get_image_capture_supported_caps: vmethod to get caps describing supported image capture formats
  *
  * #GstPhotographyInterface interface.
  */
diff --git a/gst/camerabin/gstcamerabin-enum.h b/gst/camerabin/gstcamerabin-enum.h
index 776a774..675b605 100644
--- a/gst/camerabin/gstcamerabin-enum.h
+++ b/gst/camerabin/gstcamerabin-enum.h
@@ -56,7 +56,8 @@ enum
   ARG_ISO_SPEED,
   ARG_APERTURE,
   ARG_EXPOSURE,
-  ARG_VIDEO_SOURCE_FILTER
+  ARG_VIDEO_SOURCE_FILTER,
+  ARG_IMAGE_CAPTURE_SUPPORTED_CAPS
 };
 
 /**
diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c
index 90f49f6..c592ded 100644
--- a/gst/camerabin/gstcamerabin.c
+++ b/gst/camerabin/gstcamerabin.c
@@ -2926,6 +2926,10 @@ gst_camerabin_override_photo_properties (GObjectClass * gobject_class)
 
   g_object_class_override_property (gobject_class, ARG_EXPOSURE,
       GST_PHOTOGRAPHY_PROP_EXPOSURE);
+
+  g_object_class_override_property (gobject_class,
+      ARG_IMAGE_CAPTURE_SUPPORTED_CAPS,
+      GST_PHOTOGRAPHY_PROP_IMAGE_CAPTURE_SUPPORTED_CAPS);
 }
 
 static void
diff --git a/gst/camerabin/gstcamerabinphotography.c b/gst/camerabin/gstcamerabinphotography.c
index a5940f4..33721d6 100644
--- a/gst/camerabin/gstcamerabinphotography.c
+++ b/gst/camerabin/gstcamerabinphotography.c
@@ -544,6 +544,18 @@ gst_camerabin_photography_get_property (GstCameraBin * camera, guint prop_id,
       ret = TRUE;
       break;
     }
+    case ARG_IMAGE_CAPTURE_SUPPORTED_CAPS:
+    {
+      GST_DEBUG_OBJECT (camera, "==== GETTING PROP_IMAGE_CAPTURE_CAPS ====");
+      if (PHOTOGRAPHY_IS_OK (camera->src_vid_src)) {
+        g_object_get_property (G_OBJECT (camera->src_vid_src),
+            "image-capture-supported-caps", value);
+      } else {
+        g_object_get_property (G_OBJECT (camera), "video-source-caps", value);
+      }
+      ret = TRUE;
+      break;
+    }
     default:
       break;
   }





More information about the Gstreamer-commits mailing list