diff options
author | Tommi Myöhänen <ext-tommi.1.myohanen@nokia.com> | 2009-08-27 14:35:26 +0300 |
---|---|---|
committer | René Stadler <rene.stadler@nokia.com> | 2009-10-01 18:06:55 +0300 |
commit | 0d48f7353286e06a18fbf1965829ee18fceeabd0 (patch) | |
tree | 230b44b2dc28876403e6c647f8db3654b7ff9704 | |
parent | 99f1f4510a2784b1b1e4317c615f6d538a3454b2 (diff) |
camerabin: handle preview-caps only in image mode and only when they change
This prevents camerabin to create preview pipeline every time when
application re-sets the same caps again.
-rw-r--r-- | gst/camerabin/gstcamerabin.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c index 6d0285038..40ba83714 100644 --- a/gst/camerabin/gstcamerabin.c +++ b/gst/camerabin/gstcamerabin.c @@ -2891,11 +2891,23 @@ gst_camerabin_set_property (GObject * object, guint prop_id, } break; case ARG_PREVIEW_CAPS: - GST_OBJECT_LOCK (camera); - gst_caps_replace (&camera->preview_caps, - (GstCaps *) gst_value_get_caps (value)); - GST_OBJECT_UNLOCK (camera); - gst_camerabin_preview_create_pipeline (camera); + /* Currently camerabin only provides preview for images, so we don't + * even handle video mode */ + if (camera->mode == MODE_IMAGE) { + GstCaps *new_caps = NULL; + + new_caps = (GstCaps *) gst_value_get_caps (value); + GST_DEBUG_OBJECT (camera, + "setting preview caps: %" GST_PTR_FORMAT " -> %" GST_PTR_FORMAT, + camera->preview_caps, new_caps); + + if (!gst_caps_is_equal (camera->preview_caps, new_caps)) { + GST_OBJECT_LOCK (camera); + gst_caps_replace (&camera->preview_caps, new_caps); + GST_OBJECT_UNLOCK (camera); + gst_camerabin_preview_create_pipeline (camera); + } + } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |