summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-10-11 07:45:03 +0200
committerLiang Qi <liang.qi@qt.io>2016-10-11 07:45:03 +0200
commit1c6c85cd7c619cc15c099ae63a5d22bcf661847c (patch)
tree5a803feb71e725853317ee1df50a19afe3c87e7a /src
parent4d3dae3fa63d64cc97226969c4bf7d6d91b63b57 (diff)
parent20e65d4dbd43d133d663b4733ffb09629935e731 (diff)
downloadqtmultimedia-1c6c85cd7c619cc15c099ae63a5d22bcf661847c.tar.gz
Merge remote-tracking branch 'origin/5.8' into dev
Change-Id: I7291f7a3bd5851eafe2bf0a4bd5c5f8e705a90bc
Diffstat (limited to 'src')
-rw-r--r--src/imports/multimedia/qdeclarativeplaylist.cpp3
-rw-r--r--src/multimedia/audio/qsoundeffect_pulse_p.cpp61
-rw-r--r--src/multimedia/doc/src/multimedia.qdoc2
-rw-r--r--src/multimedia/doc/src/qtmultimedia-index.qdoc2
-rw-r--r--src/multimedia/doc/src/qtmultimedia5.qdoc4
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinservice.cpp3
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp13
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.cpp7
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.h10
-rw-r--r--src/plugins/plugins.pro2
-rw-r--r--src/plugins/pulseaudio/qpulseaudioengine.cpp65
11 files changed, 128 insertions, 44 deletions
diff --git a/src/imports/multimedia/qdeclarativeplaylist.cpp b/src/imports/multimedia/qdeclarativeplaylist.cpp
index b338c33e5..e8df8c376 100644
--- a/src/imports/multimedia/qdeclarativeplaylist.cpp
+++ b/src/imports/multimedia/qdeclarativeplaylist.cpp
@@ -94,9 +94,6 @@ void QDeclarativePlaylistItem::setSource(const QUrl &source)
item's source URL can be accessed using the \c source role.
\qml
- import QtQuick 2.0
- import QtMultimedia 5.6
-
Item {
width: 400;
height: 300;
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.cpp b/src/multimedia/audio/qsoundeffect_pulse_p.cpp
index 6e4aadd0b..fcf4fee35 100644
--- a/src/multimedia/audio/qsoundeffect_pulse_p.cpp
+++ b/src/multimedia/audio/qsoundeffect_pulse_p.cpp
@@ -443,7 +443,11 @@ void QSoundEffectPrivate::setSource(const QUrl &url)
if (m_pulseStream && !pa_stream_is_corked(m_pulseStream)) {
pa_stream_set_write_callback(m_pulseStream, 0, 0);
pa_stream_set_underflow_callback(m_pulseStream, 0, 0);
- pa_operation_unref(pa_stream_cork(m_pulseStream, 1, 0, 0));
+ pa_operation *op = pa_stream_cork(m_pulseStream, 1, 0, 0);
+ if (op)
+ pa_operation_unref(op);
+ else
+ qWarning("QSoundEffect(pulseaudio): failed to cork stream");
}
setPlaying(false);
@@ -625,7 +629,11 @@ void QSoundEffectPrivate::emptyStream(EmptyStreamOptions options)
m_emptying = true;
pa_stream_set_write_callback(m_pulseStream, 0, 0);
pa_stream_set_underflow_callback(m_pulseStream, 0, 0);
- pa_operation_unref(pa_stream_flush(m_pulseStream, flushCompleteCb, m_ref->getRef()));
+ pa_operation *op = pa_stream_flush(m_pulseStream, flushCompleteCb, m_ref->getRef());
+ if (op)
+ pa_operation_unref(op);
+ else
+ qWarning("QSoundEffect(pulseaudio): failed to flush stream");
}
void QSoundEffectPrivate::emptyComplete(void *stream, bool reload)
@@ -637,8 +645,13 @@ void QSoundEffectPrivate::emptyComplete(void *stream, bool reload)
m_emptying = false;
- if ((pa_stream *)stream == m_pulseStream)
- pa_operation_unref(pa_stream_cork(m_pulseStream, 1, reload ? stream_cork_callback : 0, m_ref->getRef()));
+ if ((pa_stream *)stream == m_pulseStream) {
+ pa_operation *op = pa_stream_cork(m_pulseStream, 1, reload ? stream_cork_callback : 0, m_ref->getRef());
+ if (op)
+ pa_operation_unref(op);
+ else
+ qWarning("QSoundEffect(pulseaudio): failed to cork stream");
+ }
}
void QSoundEffectPrivate::sampleReady()
@@ -672,7 +685,11 @@ void QSoundEffectPrivate::sampleReady()
pa_buffer_attr newBufferAttr;
newBufferAttr = *bufferAttr;
newBufferAttr.prebuf = m_sample->data().size();
- pa_operation_unref(pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, m_ref->getRef()));
+ pa_operation *op = pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, m_ref->getRef());
+ if (op)
+ pa_operation_unref(op);
+ else
+ qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute");
} else {
streamReady();
}
@@ -685,12 +702,20 @@ void QSoundEffectPrivate::sampleReady()
newBufferAttr.minreq = bufferAttr->tlength / 2;
newBufferAttr.prebuf = -1;
newBufferAttr.fragsize = -1;
- pa_operation_unref(pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_reset_buffer_callback, m_ref->getRef()));
+ pa_operation *op = pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_reset_buffer_callback, m_ref->getRef());
+ if (op)
+ pa_operation_unref(op);
+ else
+ qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute");
} else if (bufferAttr->prebuf > uint32_t(m_sample->data().size())) {
pa_buffer_attr newBufferAttr;
newBufferAttr = *bufferAttr;
newBufferAttr.prebuf = m_sample->data().size();
- pa_operation_unref(pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, m_ref->getRef()));
+ pa_operation *op = pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, m_ref->getRef());
+ if (op)
+ pa_operation_unref(op);
+ else
+ qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute");
} else {
streamReady();
}
@@ -995,7 +1020,11 @@ void QSoundEffectPrivate::stream_state_callback(pa_stream *s, void *userdata)
pa_buffer_attr newBufferAttr;
newBufferAttr = *bufferAttr;
newBufferAttr.prebuf = self->m_sample->data().size();
- pa_stream_set_buffer_attr(self->m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, self->m_ref->getRef());
+ pa_operation *op = pa_stream_set_buffer_attr(self->m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, self->m_ref->getRef());
+ if (op)
+ pa_operation_unref(op);
+ else
+ qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute");
} else {
QMetaObject::invokeMethod(self, "streamReady", Qt::QueuedConnection);
}
@@ -1032,7 +1061,7 @@ void QSoundEffectPrivate::stream_reset_buffer_callback(pa_stream *s, int success
return;
if (!success)
- qWarning("QSoundEffect(pulseaudio): faild to reset buffer attribute");
+ qWarning("QSoundEffect(pulseaudio): failed to reset buffer attribute");
#ifdef QT_PA_DEBUG
qDebug() << self << "stream_reset_buffer_callback";
#endif
@@ -1042,7 +1071,11 @@ void QSoundEffectPrivate::stream_reset_buffer_callback(pa_stream *s, int success
pa_buffer_attr newBufferAttr;
newBufferAttr = *bufferAttr;
newBufferAttr.prebuf = self->m_sample->data().size();
- pa_stream_set_buffer_attr(self->m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, userdata);
+ pa_operation *op = pa_stream_set_buffer_attr(self->m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, userdata);
+ if (op)
+ pa_operation_unref(op);
+ else
+ qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute");
} else {
QMetaObject::invokeMethod(self, "streamReady", Qt::QueuedConnection);
}
@@ -1061,7 +1094,7 @@ void QSoundEffectPrivate::stream_adjust_prebuffer_callback(pa_stream *s, int suc
return;
if (!success)
- qWarning("QSoundEffect(pulseaudio): faild to adjust pre-buffer attribute");
+ qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute");
#ifdef QT_PA_DEBUG
qDebug() << self << "stream_adjust_prebuffer_callback";
#endif
@@ -1096,7 +1129,7 @@ void QSoundEffectPrivate::stream_cork_callback(pa_stream *s, int success, void *
return;
if (!success)
- qWarning("QSoundEffect(pulseaudio): faild to stop");
+ qWarning("QSoundEffect(pulseaudio): failed to stop");
#ifdef QT_PA_DEBUG
qDebug() << self << "stream_cork_callback";
#endif
@@ -1116,7 +1149,7 @@ void QSoundEffectPrivate::stream_flush_callback(pa_stream *s, int success, void
return;
if (!success)
- qWarning("QSoundEffect(pulseaudio): faild to drain");
+ qWarning("QSoundEffect(pulseaudio): failed to drain");
QMetaObject::invokeMethod(self, "emptyComplete", Qt::QueuedConnection, Q_ARG(void*, s), Q_ARG(bool, false));
}
@@ -1134,7 +1167,7 @@ void QSoundEffectPrivate::stream_flush_reload_callback(pa_stream *s, int success
return;
if (!success)
- qWarning("QSoundEffect(pulseaudio): faild to drain");
+ qWarning("QSoundEffect(pulseaudio): failed to drain");
QMetaObject::invokeMethod(self, "emptyComplete", Qt::QueuedConnection, Q_ARG(void*, s), Q_ARG(bool, true));
}
diff --git a/src/multimedia/doc/src/multimedia.qdoc b/src/multimedia/doc/src/multimedia.qdoc
index 813847d88..944d8c4d7 100644
--- a/src/multimedia/doc/src/multimedia.qdoc
+++ b/src/multimedia/doc/src/multimedia.qdoc
@@ -177,7 +177,7 @@ what changed, and what you might need to change when porting code.
\section2 QML Types
The QML types are accessed by using:
\code
-import QtMultimedia 5.6
+import QtMultimedia 5.8
\endcode
\annotatedlist multimedia_qml
The following types are accessed by using \l{Qt Audio Engine QML Types}{Qt Audio Engine}:
diff --git a/src/multimedia/doc/src/qtmultimedia-index.qdoc b/src/multimedia/doc/src/qtmultimedia-index.qdoc
index 989b8886e..484338dc8 100644
--- a/src/multimedia/doc/src/qtmultimedia-index.qdoc
+++ b/src/multimedia/doc/src/qtmultimedia-index.qdoc
@@ -54,7 +54,7 @@
import statement in your \c {.qml} file.
\code
- import QtMultimedia 5.6
+ import QtMultimedia 5.8
\endcode
If you intend to use the C++ classes in your application, include the C++
diff --git a/src/multimedia/doc/src/qtmultimedia5.qdoc b/src/multimedia/doc/src/qtmultimedia5.qdoc
index 21854ae7c..29ef2734e 100644
--- a/src/multimedia/doc/src/qtmultimedia5.qdoc
+++ b/src/multimedia/doc/src/qtmultimedia5.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
-\qmlmodule QtMultimedia 5.6
+\qmlmodule QtMultimedia 5.8
\title Qt Multimedia QML Types
\ingroup qmlmodules
\brief Provides QML types for multimedia support.
@@ -42,7 +42,7 @@ The QML types for \l{Qt Multimedia} support the basic use cases such as:
The QML types can be imported into your application using the following import
statement in your .qml file:
\code
-import QtMultimedia 5.6
+import QtMultimedia 5.8
\endcode
\section1 QML types
diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.cpp b/src/plugins/gstreamer/camerabin/camerabinservice.cpp
index d9131e545..2be4e345a 100644
--- a/src/plugins/gstreamer/camerabin/camerabinservice.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinservice.cpp
@@ -189,6 +189,9 @@ QMediaControl *CameraBinService::requestControl(const char *name)
}
}
+ if (qstrcmp(name, QMediaVideoProbeControl_iid) == 0)
+ return m_captureSession->videoProbe();
+
if (qstrcmp(name,QAudioInputSelectorControl_iid) == 0)
return m_audioInputSelector;
diff --git a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp
index b810e2b02..2d3c7c2ea 100644
--- a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp
@@ -66,8 +66,19 @@ QMediaService* CameraBinServicePlugin::create(const QString &key)
{
QGstUtils::initializeGst();
- if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
+ if (key == QLatin1String(Q_MEDIASERVICE_CAMERA)) {
+ if (!CameraBinService::isCameraBinAvailable()) {
+ guint major, minor, micro, nano;
+ gst_version(&major, &minor, &micro, &nano);
+ qWarning("Error: cannot create camera service, the 'camerabin' plugin is missing for "
+ "GStreamer %u.%u."
+ "\nPlease install the 'bad' GStreamer plugin package.",
+ major, minor);
+ return Q_NULLPTR;
+ }
+
return new CameraBinService(sourceFactory());
+ }
qWarning() << "Gstreamer camerabin service plugin: unsupported key:" << key;
return 0;
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
index 8947af8f1..1e075f58d 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
@@ -674,6 +674,8 @@ QCameraViewfinderSettings CameraBinSession::viewfinderSettings() const
void CameraBinSession::ViewfinderProbe::probeCaps(GstCaps *caps)
{
+ QGstreamerVideoProbeControl::probeCaps(caps);
+
// Update actual viewfinder settings on viewfinder caps change
const GstStructure *s = gst_caps_get_structure(caps, 0);
const QPair<qreal, qreal> frameRate = QGstUtils::structureFrameRateRange(s);
@@ -1074,6 +1076,11 @@ bool CameraBinSession::processBusMessage(const QGstreamerMessage &message)
return false;
}
+QGstreamerVideoProbeControl *CameraBinSession::videoProbe()
+{
+ return &m_viewfinderProbe;
+}
+
QString CameraBinSession::currentContainerFormat() const
{
if (!m_muxer)
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.h b/src/plugins/gstreamer/camerabin/camerabinsession.h
index 44faaf701..41398087d 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.h
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.h
@@ -51,7 +51,7 @@
#endif
#include <private/qgstreamerbushelper_p.h>
-#include <private/qgstreamerbufferprobe_p.h>
+#include <private/qgstreamervideoprobecontrol_p.h>
#include <private/qmediastoragelocation_p.h>
#include "qcamera.h"
@@ -164,6 +164,8 @@ public:
bool processSyncMessage(const QGstreamerMessage &message);
bool processBusMessage(const QGstreamerMessage &message);
+ QGstreamerVideoProbeControl *videoProbe();
+
signals:
void statusChanged(QCamera::Status status);
void pendingStateChanged(QCamera::State state);
@@ -258,14 +260,14 @@ private:
bool m_inputDeviceHasChanged;
bool m_usingWrapperCameraBinSrc;
- class ViewfinderProbe : public QGstreamerBufferProbe {
+ class ViewfinderProbe : public QGstreamerVideoProbeControl {
public:
ViewfinderProbe(CameraBinSession *s)
- : QGstreamerBufferProbe(QGstreamerBufferProbe::ProbeCaps)
+ : QGstreamerVideoProbeControl(s)
, session(s)
{}
- void probeCaps(GstCaps *caps);
+ void probeCaps(GstCaps *caps) override;
private:
CameraBinSession * const session;
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 269437149..f113f68b3 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -57,7 +57,7 @@ unix:!mac:!android {
# }
}
-darwin:!watchos:!simulator {
+darwin:!watchos {
SUBDIRS += audiocapture coreaudio
config_avfoundation: SUBDIRS += avfoundation
diff --git a/src/plugins/pulseaudio/qpulseaudioengine.cpp b/src/plugins/pulseaudio/qpulseaudioengine.cpp
index 967a696b0..67ad10af1 100644
--- a/src/plugins/pulseaudio/qpulseaudioengine.cpp
+++ b/src/plugins/pulseaudio/qpulseaudioengine.cpp
@@ -176,15 +176,30 @@ static void event_cb(pa_context* context, pa_subscription_event_type_t t, uint32
case PA_SUBSCRIPTION_EVENT_NEW:
case PA_SUBSCRIPTION_EVENT_CHANGE:
switch (facility) {
- case PA_SUBSCRIPTION_EVENT_SERVER:
- pa_operation_unref(pa_context_get_server_info(context, serverInfoCallback, userdata));
+ case PA_SUBSCRIPTION_EVENT_SERVER: {
+ pa_operation *op = pa_context_get_server_info(context, serverInfoCallback, userdata);
+ if (op)
+ pa_operation_unref(op);
+ else
+ qWarning("PulseAudioService: failed to get server info");
break;
- case PA_SUBSCRIPTION_EVENT_SINK:
- pa_operation_unref(pa_context_get_sink_info_by_index(context, index, sinkInfoCallback, userdata));
+ }
+ case PA_SUBSCRIPTION_EVENT_SINK: {
+ pa_operation *op = pa_context_get_sink_info_by_index(context, index, sinkInfoCallback, userdata);
+ if (op)
+ pa_operation_unref(op);
+ else
+ qWarning("PulseAudioService: failed to get sink info");
break;
- case PA_SUBSCRIPTION_EVENT_SOURCE:
- pa_operation_unref(pa_context_get_source_info_by_index(context, index, sourceInfoCallback, userdata));
+ }
+ case PA_SUBSCRIPTION_EVENT_SOURCE: {
+ pa_operation *op = pa_context_get_source_info_by_index(context, index, sourceInfoCallback, userdata);
+ if (op)
+ pa_operation_unref(op);
+ else
+ qWarning("PulseAudioService: failed to get source info");
break;
+ }
default:
break;
}
@@ -334,11 +349,15 @@ void QPulseAudioEngine::prepare()
pa_context_set_state_callback(m_context, contextStateCallback, this);
pa_context_set_subscribe_callback(m_context, event_cb, this);
- pa_operation_unref(pa_context_subscribe(m_context,
+ pa_operation *op = pa_context_subscribe(m_context,
pa_subscription_mask_t(PA_SUBSCRIPTION_MASK_SINK |
PA_SUBSCRIPTION_MASK_SOURCE |
PA_SUBSCRIPTION_MASK_SERVER),
- NULL, NULL));
+ NULL, NULL);
+ if (op)
+ pa_operation_unref(op);
+ else
+ qWarning("PulseAudioService: failed to subscribe to context notifications");
} else {
pa_context_unref(m_context);
m_context = 0;
@@ -382,21 +401,33 @@ void QPulseAudioEngine::updateDevices()
// Get default input and output devices
pa_operation *operation = pa_context_get_server_info(m_context, serverInfoCallback, this);
- while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
- pa_threaded_mainloop_wait(m_mainLoop);
- pa_operation_unref(operation);
+ if (operation) {
+ while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
+ pa_threaded_mainloop_wait(m_mainLoop);
+ pa_operation_unref(operation);
+ } else {
+ qWarning("PulseAudioService: failed to get server info");
+ }
// Get output devices
operation = pa_context_get_sink_info_list(m_context, sinkInfoCallback, this);
- while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
- pa_threaded_mainloop_wait(m_mainLoop);
- pa_operation_unref(operation);
+ if (operation) {
+ while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
+ pa_threaded_mainloop_wait(m_mainLoop);
+ pa_operation_unref(operation);
+ } else {
+ qWarning("PulseAudioService: failed to get sink info");
+ }
// Get input devices
operation = pa_context_get_source_info_list(m_context, sourceInfoCallback, this);
- while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
- pa_threaded_mainloop_wait(m_mainLoop);
- pa_operation_unref(operation);
+ if (operation) {
+ while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
+ pa_threaded_mainloop_wait(m_mainLoop);
+ pa_operation_unref(operation);
+ } else {
+ qWarning("PulseAudioService: failed to get source info");
+ }
unlock();
}