Gst Capture: image capture fixes
Report camera is ready to capture only in image capture modes; Emit capture failed if camera not configured for capture Change-Id: Ia2b92e2f8c760db948185a29c3e5ceae81dd3af4 Reviewed-by: Lev Zelenskiy <lev.zelenskiy@nokia.com> Reviewed-by: Ling Hu <ling.hu@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
b3e8783334
commit
8bdceb9357
@@ -773,6 +773,11 @@ QGstreamerCaptureSession::State QGstreamerCaptureSession::state() const
|
||||
return m_state;
|
||||
}
|
||||
|
||||
QGstreamerCaptureSession::State QGstreamerCaptureSession::pendingState() const
|
||||
{
|
||||
return m_pendingState;
|
||||
}
|
||||
|
||||
void QGstreamerCaptureSession::setState(QGstreamerCaptureSession::State newState)
|
||||
{
|
||||
if (newState == m_pendingState && !m_waitingForEos)
|
||||
|
||||
@@ -127,6 +127,8 @@ public:
|
||||
void captureImage(int requestId, const QString &fileName);
|
||||
|
||||
State state() const;
|
||||
State pendingState() const;
|
||||
|
||||
qint64 duration() const;
|
||||
bool isMuted() const { return m_muted; }
|
||||
|
||||
|
||||
@@ -63,6 +63,21 @@ bool QGstreamerImageCaptureControl::isReadyForCapture() const
|
||||
|
||||
int QGstreamerImageCaptureControl::capture(const QString &fileName)
|
||||
{
|
||||
m_lastId++;
|
||||
|
||||
//it's allowed to request image capture while camera is starting
|
||||
if (m_session->pendingState() == QGstreamerCaptureSession::StoppedState ||
|
||||
!(m_session->captureMode() & QGstreamerCaptureSession::Image)) {
|
||||
//emit error in the next event loop,
|
||||
//so application can associate it with returned request id.
|
||||
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
|
||||
Q_ARG(int, m_lastId),
|
||||
Q_ARG(int, QCameraImageCapture::NotReadyError),
|
||||
Q_ARG(QString,tr("Not ready to capture")));
|
||||
|
||||
return m_lastId;
|
||||
}
|
||||
|
||||
QString path = fileName;
|
||||
if (path.isEmpty()) {
|
||||
int lastImage = 0;
|
||||
@@ -77,7 +92,6 @@ int QGstreamerImageCaptureControl::capture(const QString &fileName)
|
||||
10,
|
||||
QLatin1Char('0'));
|
||||
}
|
||||
m_lastId++;
|
||||
|
||||
m_session->captureImage(m_lastId, path);
|
||||
|
||||
@@ -91,7 +105,9 @@ void QGstreamerImageCaptureControl::cancelCapture()
|
||||
|
||||
void QGstreamerImageCaptureControl::updateState()
|
||||
{
|
||||
bool ready = m_session->state() == QGstreamerCaptureSession::PreviewState;
|
||||
bool ready = (m_session->state() == QGstreamerCaptureSession::PreviewState) &&
|
||||
(m_session->captureMode() & QGstreamerCaptureSession::Image);
|
||||
|
||||
if (m_ready != ready) {
|
||||
emit readyForCaptureChanged(m_ready = ready);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user