#include "qtcamimagemode.h"
#include "qtcamvideomode.h"
#include "qtcamnotifications.h"
-#include "gst/gstcopy.h"
#include "qtcampropertysetter.h"
#include "qtcamanalysisbin.h"
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;
g_signal_connect(d_ptr->cameraBin, "notify::idle",
G_CALLBACK(QtCamDevicePrivate::on_idle_changed), d_ptr);
- g_signal_connect(d_ptr->wrapperVideoSource, "notify::ready-for-capture",
- G_CALLBACK(QtCamDevicePrivate::on_ready_for_capture_changed), d_ptr);
+ if (d_ptr->wrapperVideoSource) {
+ g_signal_connect(d_ptr->wrapperVideoSource, "notify::ready-for-capture",
+ G_CALLBACK(QtCamDevicePrivate::on_ready_for_capture_changed), d_ptr);
+ }
+ else {
+ g_signal_connect(d_ptr->videoSource, "notify::ready-for-capture",
+ G_CALLBACK(QtCamDevicePrivate::on_ready_for_capture_changed), d_ptr);
+ }
d_ptr->image = new QtCamImageMode(d_ptr, this);
d_ptr->video = new QtCamVideoMode(d_ptr, this);
}
if (!viewfinder) {
- qWarning() << "QtCamDevice: viewfinder cannot be unset.";
- return false;
- }
+ if (d_ptr->cameraBin) {
+ g_object_set(d_ptr->cameraBin, "viewfinder-sink", NULL, NULL);
+ }
- if (d_ptr->viewfinder) {
- qWarning() << "QtCamDevice: viewfinder cannot be replaced.";
- return false;
- }
+ d_ptr->sink = 0;
- if (!viewfinder->setDevice(this)) {
- return false;
+ d_ptr->viewfinder = 0;
+ return true;
}
d_ptr->viewfinder = viewfinder;
+ d_ptr->sink = 0;
return true;
}