summaryrefslogtreecommitdiffstats
path: root/src/uca-camera.c
diff options
context:
space:
mode:
authorMihael Koep <koep@schneide.com>2012-10-25 17:47:14 +0200
committerMihael Koep <koep@schneide.com>2012-10-25 17:47:14 +0200
commit620871c0c8e742af5f55ae9a2d6fe2066aa35193 (patch)
tree74e6c4568338d81c8074eb39139cdd5acc721fdc /src/uca-camera.c
parent9c6732c05f35bb06f92593b46990473aa7a0f799 (diff)
parentf68bda1ebebcf589fdab832abfecf997b7f223a6 (diff)
downloaduca-620871c0c8e742af5f55ae9a2d6fe2066aa35193.tar.gz
uca-620871c0c8e742af5f55ae9a2d6fe2066aa35193.tar.bz2
uca-620871c0c8e742af5f55ae9a2d6fe2066aa35193.tar.xz
uca-620871c0c8e742af5f55ae9a2d6fe2066aa35193.zip
Merge remote branch 'origin/master' into dexela
Diffstat (limited to 'src/uca-camera.c')
-rw-r--r--src/uca-camera.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/uca-camera.c b/src/uca-camera.c
index 53b2d7a..8905a95 100644
--- a/src/uca-camera.c
+++ b/src/uca-camera.c
@@ -110,6 +110,7 @@ const gchar *uca_camera_props[N_BASE_PROPERTIES] = {
};
static GParamSpec *camera_properties[N_BASE_PROPERTIES] = { NULL, };
+static GStaticMutex access_lock = G_STATIC_MUTEX_INIT;
struct _UcaCameraPrivate {
gboolean is_recording;
@@ -457,7 +458,9 @@ uca_camera_start_recording (UcaCamera *camera, GError **error)
goto start_recording_unlock;
}
+ g_static_mutex_lock (&access_lock);
(*klass->start_recording)(camera, &tmp_error);
+ g_static_mutex_unlock (&access_lock);
if (tmp_error == NULL) {
camera->priv->is_readout = FALSE;
@@ -501,7 +504,9 @@ uca_camera_stop_recording (UcaCamera *camera, GError **error)
else {
GError *tmp_error = NULL;
+ g_static_mutex_lock (&access_lock);
(*klass->stop_recording)(camera, &tmp_error);
+ g_static_mutex_unlock (&access_lock);
if (tmp_error == NULL) {
camera->priv->is_readout = FALSE;
@@ -548,7 +553,9 @@ uca_camera_start_readout (UcaCamera *camera, GError **error)
else {
GError *tmp_error = NULL;
+ g_static_mutex_lock (&access_lock);
(*klass->start_readout) (camera, &tmp_error);
+ g_static_mutex_unlock (&access_lock);
if (tmp_error == NULL) {
camera->priv->is_readout = TRUE;
@@ -593,7 +600,9 @@ uca_camera_stop_readout (UcaCamera *camera, GError **error)
else {
GError *tmp_error = NULL;
+ g_static_mutex_lock (&access_lock);
(*klass->stop_readout) (camera, &tmp_error);
+ g_static_mutex_unlock (&access_lock);
if (tmp_error == NULL) {
camera->priv->is_readout = FALSE;
@@ -648,8 +657,11 @@ uca_camera_trigger (UcaCamera *camera, GError **error)
if (!camera->priv->is_recording)
g_set_error (error, UCA_CAMERA_ERROR, UCA_CAMERA_ERROR_NOT_RECORDING, "Camera is not recording");
- else
+ else {
+ g_static_mutex_lock (&access_lock);
(*klass->trigger) (camera, error);
+ g_static_mutex_unlock (&access_lock);
+ }
g_static_mutex_unlock (&mutex);
}
@@ -690,8 +702,11 @@ uca_camera_grab (UcaCamera *camera, gpointer *data, GError **error)
if (!camera->priv->is_recording && !camera->priv->is_readout)
g_set_error (error, UCA_CAMERA_ERROR, UCA_CAMERA_ERROR_NOT_RECORDING, "Camera is neither recording nor in readout mode");
- else
+ else {
+ g_static_mutex_lock (&access_lock);
(*klass->grab) (camera, data, error);
+ g_static_mutex_unlock (&access_lock);
+ }
g_static_mutex_unlock (&mutex);
}