Changes to media probing API.

Added flush signals.

Change-Id: I9c124317e843c9b9011e69c44649ae9a4e974161
Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
This commit is contained in:
Lev Zelenskiy
2012-02-09 16:40:10 +10:00
committed by Qt by Nokia
parent 7b3d3ae453
commit 32b68f17f5
8 changed files with 56 additions and 2 deletions

View File

@@ -98,8 +98,10 @@ QAudioProbe::~QAudioProbe()
{
if (d->source) {
// Disconnect
if (d->probee)
if (d->probee) {
disconnect(d->probee.data(), SIGNAL(audioBufferProbed(QAudioBuffer)), this, SIGNAL(audioBufferProbed(QAudioBuffer)));
disconnect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush()));
}
d->source.data()->service()->releaseControl(d->probee.data());
}
}
@@ -127,6 +129,7 @@ bool QAudioProbe::setSource(QMediaObject *source)
if (d->source) {
Q_ASSERT(d->probee);
disconnect(d->probee.data(), SIGNAL(audioBufferProbed(QAudioBuffer)), this, SIGNAL(audioBufferProbed(QAudioBuffer)));
disconnect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush()));
d->source.data()->service()->releaseControl(d->probee.data());
d->source.clear();
d->probee.clear();
@@ -140,6 +143,7 @@ bool QAudioProbe::setSource(QMediaObject *source)
if (d->probee) {
connect(d->probee.data(), SIGNAL(audioBufferProbed(QAudioBuffer)), this, SIGNAL(audioBufferProbed(QAudioBuffer)));
connect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush()));
d->source = source;
}
}
@@ -187,4 +191,19 @@ bool QAudioProbe::isActive() const
return d->probee != 0;
}
/*!
\fn QAudioProbe::audioBufferProbed(const QAudioBuffer &buffer)
This signal should be emitted when an audio buffer is processed in the
media service.
*/
/*!
\fn QAudioProbe::flush()
This signal should be emitted when it is required to release all buffers.
Application must release all outstanding references to audio buffers.
*/
QT_END_NAMESPACE

View File

@@ -69,6 +69,7 @@ public:
Q_SIGNALS:
void audioBufferProbed(const QAudioBuffer &audioBuffer);
void flush();
private:
QAudioProbePrivate *d;

View File

@@ -92,6 +92,13 @@ QMediaAudioProbeControl::~QMediaAudioProbeControl()
media service.
*/
/*!
\fn QMediaAudioProbeControl::flush()
This signal should be emitted when it is required to release all frames.
*/
#include "moc_qmediaaudioprobecontrol.cpp"
QT_END_NAMESPACE

View File

@@ -59,6 +59,7 @@ public:
signals:
void audioBufferProbed(const QAudioBuffer &buffer);
void flush();
protected:
explicit QMediaAudioProbeControl(QObject *parent = 0);

View File

@@ -92,6 +92,12 @@ QMediaVideoProbeControl::~QMediaVideoProbeControl()
media service.
*/
/*!
\fn QMediaVideoProbeControl::flush()
This signal should be emitted when it is required to release all frames.
*/
#include "moc_qmediavideoprobecontrol.cpp"
QT_END_NAMESPACE

View File

@@ -61,6 +61,7 @@ public:
signals:
void videoFrameProbed(const QVideoFrame &frame);
void flush();
protected:
explicit QMediaVideoProbeControl(QObject *parent = 0);

View File

@@ -103,8 +103,10 @@ QVideoProbe::~QVideoProbe()
{
if (d->source) {
// Disconnect
if (d->probee)
if (d->probee) {
disconnect(d->probee.data(), SIGNAL(videoFrameProbed(QVideoFrame)), this, SIGNAL(videoFrameProbed(QVideoFrame)));
disconnect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush()));
}
d->source.data()->service()->releaseControl(d->probee.data());
}
}
@@ -132,6 +134,7 @@ bool QVideoProbe::setSource(QMediaObject *source)
if (d->source) {
Q_ASSERT(d->probee);
disconnect(d->probee.data(), SIGNAL(videoFrameProbed(QVideoFrame)), this, SIGNAL(videoFrameProbed(QVideoFrame)));
disconnect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush()));
d->source.data()->service()->releaseControl(d->probee.data());
d->source.clear();
d->probee.clear();
@@ -145,6 +148,7 @@ bool QVideoProbe::setSource(QMediaObject *source)
if (d->probee) {
connect(d->probee.data(), SIGNAL(videoFrameProbed(QVideoFrame)), this, SIGNAL(videoFrameProbed(QVideoFrame)));
connect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush()));
d->source = source;
}
}
@@ -190,4 +194,18 @@ bool QVideoProbe::isActive() const
return d->probee != 0;
}
/*!
\fn QVideoProbe::videoFrameProbed(const QVideoFrame &frame)
This signal should be emitted when a video frame is processed in the
media service.
*/
/*!
\fn QVideoProbe::flush()
This signal should be emitted when it is required to release all frames.
Application must release all outstanding references to video frames.
*/
QT_END_NAMESPACE

View File

@@ -69,6 +69,7 @@ public:
Q_SIGNALS:
void videoFrameProbed(const QVideoFrame &videoFrame);
void flush();
private:
QVideoProbePrivate *d;