nemo: Add basic ready-for-capture handling to CameraBinSession
This property is provided and controlled by the camera source and should be used to tell whether the camera source can capture more or not Conflicts: src/plugins/gstreamer/camerabin/camerabinsession.h
This commit is contained in:
committed by
Martin Jones
parent
1992c78705
commit
b04854b489
@@ -116,6 +116,7 @@ CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *pa
|
|||||||
m_pendingState(QCamera::UnloadedState),
|
m_pendingState(QCamera::UnloadedState),
|
||||||
m_muted(false),
|
m_muted(false),
|
||||||
m_busy(false),
|
m_busy(false),
|
||||||
|
m_readyForCapture(false),
|
||||||
m_captureMode(QCamera::CaptureStillImage),
|
m_captureMode(QCamera::CaptureStillImage),
|
||||||
m_audioInputFactory(0),
|
m_audioInputFactory(0),
|
||||||
m_videoInputFactory(0),
|
m_videoInputFactory(0),
|
||||||
@@ -530,8 +531,11 @@ GstElement *CameraBinSession::buildCameraSource()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_cameraSrc != camSrc)
|
if (m_cameraSrc != camSrc) {
|
||||||
g_object_set(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, m_cameraSrc, NULL);
|
g_object_set(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, m_cameraSrc, NULL);
|
||||||
|
g_signal_connect(G_OBJECT(m_cameraSrc), "notify::ready-for-capture", G_CALLBACK(updateReadyForCapture), this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (camSrc)
|
if (camSrc)
|
||||||
gst_object_unref(GST_OBJECT(camSrc));
|
gst_object_unref(GST_OBJECT(camSrc));
|
||||||
@@ -841,6 +845,11 @@ bool CameraBinSession::isBusy() const
|
|||||||
return m_busy;
|
return m_busy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CameraBinSession::isReadyForCapture() const
|
||||||
|
{
|
||||||
|
return m_readyForCapture;
|
||||||
|
}
|
||||||
|
|
||||||
void CameraBinSession::updateBusyStatus(GObject *o, GParamSpec *p, gpointer d)
|
void CameraBinSession::updateBusyStatus(GObject *o, GParamSpec *p, gpointer d)
|
||||||
{
|
{
|
||||||
Q_UNUSED(p);
|
Q_UNUSED(p);
|
||||||
@@ -858,6 +867,21 @@ void CameraBinSession::updateBusyStatus(GObject *o, GParamSpec *p, gpointer d)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CameraBinSession::updateReadyForCapture(GObject *o, GParamSpec *p, gpointer d)
|
||||||
|
{
|
||||||
|
Q_UNUSED(o);
|
||||||
|
Q_UNUSED(p);
|
||||||
|
|
||||||
|
CameraBinSession *session = reinterpret_cast<CameraBinSession *>(d);
|
||||||
|
gboolean ready = false;
|
||||||
|
g_object_get(o, "ready-for-capture", &ready, NULL);
|
||||||
|
if (session->m_readyForCapture != ready) {
|
||||||
|
session->m_readyForCapture = ready;
|
||||||
|
QMetaObject::invokeMethod(session, "handleReadyForCaptureChanged",
|
||||||
|
Qt::QueuedConnection, Q_ARG(bool, ready));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
qint64 CameraBinSession::duration() const
|
qint64 CameraBinSession::duration() const
|
||||||
{
|
{
|
||||||
if (m_camerabin) {
|
if (m_camerabin) {
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ public:
|
|||||||
QCamera::Status status() const;
|
QCamera::Status status() const;
|
||||||
QCamera::State pendingState() const;
|
QCamera::State pendingState() const;
|
||||||
bool isBusy() const;
|
bool isBusy() const;
|
||||||
|
bool isReadyForCapture() const;
|
||||||
|
|
||||||
qint64 duration() const;
|
qint64 duration() const;
|
||||||
|
|
||||||
@@ -169,6 +170,7 @@ signals:
|
|||||||
void viewfinderChanged();
|
void viewfinderChanged();
|
||||||
void readyChanged(bool);
|
void readyChanged(bool);
|
||||||
void busyChanged(bool);
|
void busyChanged(bool);
|
||||||
|
void handleReadyForCaptureChanged(bool);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setDevice(const QString &device);
|
void setDevice(const QString &device);
|
||||||
@@ -197,6 +199,7 @@ private:
|
|||||||
GstCaps *supportedCaps(QCamera::CaptureModes mode) const;
|
GstCaps *supportedCaps(QCamera::CaptureModes mode) const;
|
||||||
void updateSupportedViewfinderSettings();
|
void updateSupportedViewfinderSettings();
|
||||||
static void updateBusyStatus(GObject *o, GParamSpec *p, gpointer d);
|
static void updateBusyStatus(GObject *o, GParamSpec *p, gpointer d);
|
||||||
|
static void updateReadyForCapture(GObject *o, GParamSpec *p, gpointer d);
|
||||||
|
|
||||||
QString currentContainerFormat() const;
|
QString currentContainerFormat() const;
|
||||||
|
|
||||||
@@ -212,6 +215,7 @@ private:
|
|||||||
QString m_inputDevice;
|
QString m_inputDevice;
|
||||||
bool m_muted;
|
bool m_muted;
|
||||||
bool m_busy;
|
bool m_busy;
|
||||||
|
bool m_readyForCapture;
|
||||||
QMediaStorageLocation m_mediaStorageLocation;
|
QMediaStorageLocation m_mediaStorageLocation;
|
||||||
|
|
||||||
QCamera::CaptureModes m_captureMode;
|
QCamera::CaptureModes m_captureMode;
|
||||||
|
|||||||
Reference in New Issue
Block a user