Updated declarative camera recorder with C++ API changes.
Added key,value parameters to metadataChanged() signal; Added a separate actualLocation property to desribe the path of recorded file. It may be different from outputLocation when default location is used. Change-Id: I5a4b77833b6458a19ed7e1dcf7e53fc7400cdf21 Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com> Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
00d1e2f65e
commit
96aa2e9af7
@@ -64,6 +64,10 @@ QDeclarativeCameraRecorder::QDeclarativeCameraRecorder(QCamera *camera, QObject
|
|||||||
SLOT(updateRecorderError(QMediaRecorder::Error)));
|
SLOT(updateRecorderError(QMediaRecorder::Error)));
|
||||||
connect(m_recorder, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool)));
|
connect(m_recorder, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool)));
|
||||||
connect(m_recorder, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64)));
|
connect(m_recorder, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64)));
|
||||||
|
connect(m_recorder, SIGNAL(actualLocationChanged(QUrl)),
|
||||||
|
SLOT(updateActualLocation(QUrl)));
|
||||||
|
connect(m_recorder, SIGNAL(metaDataChanged(QString,QVariant)),
|
||||||
|
SIGNAL(metaDataChanged(QString,QVariant)));
|
||||||
}
|
}
|
||||||
|
|
||||||
QDeclarativeCameraRecorder::~QDeclarativeCameraRecorder()
|
QDeclarativeCameraRecorder::~QDeclarativeCameraRecorder()
|
||||||
@@ -242,14 +246,42 @@ void QDeclarativeCameraRecorder::setRecorderState(QDeclarativeCameraRecorder::Re
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\qmlproperty string CameraRecorder::outputLocation
|
||||||
|
\property QDeclarativeCameraRecorder::outputLocation
|
||||||
|
|
||||||
|
\brief the destination location of media content.
|
||||||
|
|
||||||
|
The location can be relative or empty;
|
||||||
|
in this case the recorder uses the system specific place and file naming scheme.
|
||||||
|
*/
|
||||||
|
|
||||||
QString QDeclarativeCameraRecorder::outputLocation() const
|
QString QDeclarativeCameraRecorder::outputLocation() const
|
||||||
{
|
{
|
||||||
return m_recorder->outputLocation().toString();
|
return m_recorder->outputLocation().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeCameraRecorder::setOutputLocation(const QUrl &location)
|
/*!
|
||||||
|
\qmlproperty string CameraRecorder::actualLocation
|
||||||
|
\property QDeclarativeCameraRecorder::actualLocation
|
||||||
|
|
||||||
|
\brief the actual location of the last media content.
|
||||||
|
|
||||||
|
The actual location is usually available after recording starts,
|
||||||
|
and reset when new location is set or new recording starts.
|
||||||
|
*/
|
||||||
|
|
||||||
|
QString QDeclarativeCameraRecorder::actualLocation() const
|
||||||
{
|
{
|
||||||
m_recorder->setOutputLocation(location);
|
return m_recorder->actualLocation().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QDeclarativeCameraRecorder::setOutputLocation(const QString &location)
|
||||||
|
{
|
||||||
|
if (outputLocation() != location) {
|
||||||
|
m_recorder->setOutputLocation(location);
|
||||||
|
emit outputLocationChanged(outputLocation());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 QDeclarativeCameraRecorder::duration() const
|
qint64 QDeclarativeCameraRecorder::duration() const
|
||||||
@@ -277,12 +309,6 @@ void QDeclarativeCameraRecorder::updateRecorderState(QMediaRecorder::State state
|
|||||||
if (state == QMediaRecorder::PausedState)
|
if (state == QMediaRecorder::PausedState)
|
||||||
state = QMediaRecorder::StoppedState;
|
state = QMediaRecorder::StoppedState;
|
||||||
|
|
||||||
if (state == QMediaRecorder::StoppedState) {
|
|
||||||
QString location = outputLocation();
|
|
||||||
if (!location.isEmpty())
|
|
||||||
emit outputLocationChanged(location);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit recorderStateChanged(RecorderState(state));
|
emit recorderStateChanged(RecorderState(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,6 +318,11 @@ void QDeclarativeCameraRecorder::updateRecorderError(QMediaRecorder::Error error
|
|||||||
emit error(errorCode);
|
emit error(errorCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QDeclarativeCameraRecorder::updateActualLocation(const QUrl &url)
|
||||||
|
{
|
||||||
|
emit actualLocationChanged(url.toString());
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#include "moc_qdeclarativecamerarecorder_p.cpp"
|
#include "moc_qdeclarativecamerarecorder_p.cpp"
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ class QDeclarativeCameraRecorder : public QObject
|
|||||||
|
|
||||||
Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
|
Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
|
||||||
Q_PROPERTY(QString outputLocation READ outputLocation WRITE setOutputLocation NOTIFY outputLocationChanged)
|
Q_PROPERTY(QString outputLocation READ outputLocation WRITE setOutputLocation NOTIFY outputLocationChanged)
|
||||||
|
Q_PROPERTY(QString actualLocation READ actualLocation NOTIFY actualLocationChanged)
|
||||||
Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
|
Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
|
||||||
Q_PROPERTY(QString errorString READ errorString NOTIFY error)
|
Q_PROPERTY(QString errorString READ errorString NOTIFY error)
|
||||||
|
|
||||||
@@ -101,6 +102,8 @@ public:
|
|||||||
QSize captureResolution();
|
QSize captureResolution();
|
||||||
|
|
||||||
QString outputLocation() const;
|
QString outputLocation() const;
|
||||||
|
QString actualLocation() const;
|
||||||
|
|
||||||
qint64 duration() const;
|
qint64 duration() const;
|
||||||
bool isMuted() const;
|
bool isMuted() const;
|
||||||
|
|
||||||
@@ -118,7 +121,7 @@ public:
|
|||||||
int audioSampleRate() const;
|
int audioSampleRate() const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void setOutputLocation(const QUrl &location);
|
void setOutputLocation(const QString &location);
|
||||||
|
|
||||||
void record();
|
void record();
|
||||||
void stop();
|
void stop();
|
||||||
@@ -143,12 +146,11 @@ Q_SIGNALS:
|
|||||||
void durationChanged(qint64 duration);
|
void durationChanged(qint64 duration);
|
||||||
void mutedChanged(bool muted);
|
void mutedChanged(bool muted);
|
||||||
void outputLocationChanged(const QString &location);
|
void outputLocationChanged(const QString &location);
|
||||||
|
void actualLocationChanged(const QString &location);
|
||||||
|
|
||||||
void error(QMediaRecorder::Error errorCode);
|
void error(QMediaRecorder::Error errorCode);
|
||||||
|
|
||||||
void metaDataAvailableChanged(bool available);
|
void metaDataChanged(const QString &key, const QVariant &value);
|
||||||
void metaDataWritableChanged(bool writable);
|
|
||||||
void metaDataChanged();
|
|
||||||
|
|
||||||
void captureResolutionChanged(const QSize &);
|
void captureResolutionChanged(const QSize &);
|
||||||
void audioCodecChanged(const QString &codec);
|
void audioCodecChanged(const QString &codec);
|
||||||
@@ -164,6 +166,7 @@ Q_SIGNALS:
|
|||||||
private slots:
|
private slots:
|
||||||
void updateRecorderState(QMediaRecorder::State);
|
void updateRecorderState(QMediaRecorder::State);
|
||||||
void updateRecorderError(QMediaRecorder::Error);
|
void updateRecorderError(QMediaRecorder::Error);
|
||||||
|
void updateActualLocation(const QUrl&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class QDeclarativeCamera;
|
friend class QDeclarativeCamera;
|
||||||
|
|||||||
Reference in New Issue
Block a user