diff options
author | Liang Qi <liang.qi@qt.io> | 2016-10-11 07:45:03 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-10-11 07:45:03 +0200 |
commit | 1c6c85cd7c619cc15c099ae63a5d22bcf661847c (patch) | |
tree | 5a803feb71e725853317ee1df50a19afe3c87e7a /src/plugins | |
parent | 4d3dae3fa63d64cc97226969c4bf7d6d91b63b57 (diff) | |
parent | 20e65d4dbd43d133d663b4733ffb09629935e731 (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Change-Id: I7291f7a3bd5851eafe2bf0a4bd5c5f8e705a90bc
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinservice.cpp | 3 | ||||
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp | 13 | ||||
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinsession.cpp | 7 | ||||
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinsession.h | 10 | ||||
-rw-r--r-- | src/plugins/plugins.pro | 2 | ||||
-rw-r--r-- | src/plugins/pulseaudio/qpulseaudioengine.cpp | 65 |
6 files changed, 77 insertions, 23 deletions
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, µ, &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(); } |