mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
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.
This commit is contained in:
parent
99f1f4510a
commit
0d48f73532
1 changed files with 17 additions and 5 deletions
|
@ -2891,11 +2891,23 @@ gst_camerabin_set_property (GObject * object, guint prop_id,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ARG_PREVIEW_CAPS:
|
case ARG_PREVIEW_CAPS:
|
||||||
GST_OBJECT_LOCK (camera);
|
/* Currently camerabin only provides preview for images, so we don't
|
||||||
gst_caps_replace (&camera->preview_caps,
|
* even handle video mode */
|
||||||
(GstCaps *) gst_value_get_caps (value));
|
if (camera->mode == MODE_IMAGE) {
|
||||||
GST_OBJECT_UNLOCK (camera);
|
GstCaps *new_caps = NULL;
|
||||||
gst_camerabin_preview_create_pipeline (camera);
|
|
||||||
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
|
Loading…
Reference in a new issue