Refactor and rename isWrapperReady to isReadyForCapture()
authorMohammed Sameer <msameer@foolab.org>
Mon, 29 Jul 2013 02:07:29 +0000 (05:07 +0300)
committerMohammed Sameer <msameer@foolab.org>
Wed, 31 Jul 2013 17:11:17 +0000 (20:11 +0300)
This better describes what the function should do.
We will check the "ready-for-capture" property on video source
if we don't have a wrapper instead of returning false.

lib/qtcamdevice_p.h
lib/qtcamimagemode.cpp

index 3334cb4..b0cb65d 100644 (file)
@@ -181,13 +181,18 @@ public:
     }
   }
 
     }
   }
 
-  bool isWrapperReady() {
-    if (!wrapperVideoSource) {
+  bool isReadyForCapture() {
+    GstElement *src = videoSource;
+    if (wrapperVideoSource) {
+      src = wrapperVideoSource;
+    }
+
+    if (!src) {
       return false;
     }
 
     gboolean ready = FALSE;
       return false;
     }
 
     gboolean ready = FALSE;
-    g_object_get(wrapperVideoSource, "ready-for-capture", &ready, NULL);
+    g_object_get(src, "ready-for-capture", &ready, NULL);
 
     return ready == TRUE;
   }
 
     return ready == TRUE;
   }
index 073bf24..09af7f7 100644 (file)
@@ -64,7 +64,7 @@ QtCamImageMode::~QtCamImageMode() {
 }
 
 bool QtCamImageMode::canCapture() {
 }
 
 bool QtCamImageMode::canCapture() {
-  return QtCamMode::canCapture() && d_ptr->dev->isWrapperReady();
+  return QtCamMode::canCapture() && d_ptr->dev->isReadyForCapture();
 }
 
 void QtCamImageMode::applySettings() {
 }
 
 void QtCamImageMode::applySettings() {