Move qt_cam_copy_register to QtCamera
authorMohammed Sameer <msameer@foolab.org>
Wed, 11 Sep 2013 23:35:24 +0000 (02:35 +0300)
committerMohammed Sameer <msameer@foolab.org>
Wed, 11 Sep 2013 23:35:24 +0000 (02:35 +0300)
This ensures we do it only once per application instead of once per device.

lib/qtcamdevice.cpp
lib/qtcamera.cpp

index 38da29b..ed00c5e 100644 (file)
@@ -29,7 +29,6 @@
 #include "qtcamimagemode.h"
 #include "qtcamvideomode.h"
 #include "qtcamnotifications.h"
-#include "gst/gstcopy.h"
 #include "qtcampropertysetter.h"
 #include "qtcamanalysisbin.h"
 
@@ -37,12 +36,6 @@ QtCamDevice::QtCamDevice(QtCamConfig *config, const QString& name,
                         const QVariant& id, QObject *parent) :
   QObject(parent), d_ptr(new QtCamDevicePrivate) {
 
-  static gboolean register_copy = TRUE;
-  if (register_copy) {
-    qt_cam_copy_register();
-    register_copy = FALSE;
-  }
-
   d_ptr->q_ptr = this;
   d_ptr->name = name;
   d_ptr->id = id;
index 6fc24d7..46c01df 100644 (file)
 #include "qtcamscanner.h"
 #include "qtcamconfig.h"
 #include "qtcamdevice.h"
+#include "gst/gstcopy.h"
 #include <gst/gst.h>
 
 class QtCameraPrivate {
 public:
+  QtCameraPrivate() {
+    qt_cam_copy_register();
+  }
+
   QtCamConfig *conf;
   QtCamScanner *scanner;
 };