summaryrefslogtreecommitdiff
path: root/src/plugins/gstreamer/camerabin/camerabinsession.cpp
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den.exter@jollamobile.com>2013-12-10 17:20:59 +1000
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-17 13:03:49 +0100
commitdda1bb47163a39e07ba559d16684b9891193cc85 (patch)
tree5965b1904f5a0172cd19f7681777b152a3b76bf1 /src/plugins/gstreamer/camerabin/camerabinsession.cpp
parent4565cf26af8131a5c060598fd22e597f8aa9ba5d (diff)
downloadqtmultimedia-dda1bb47163a39e07ba559d16684b9891193cc85.tar.gz
Fix incorrect/missing application of recording settings in camerabin.
Don't set profiles if no settings are specified. Apply all settings before starting a pipeline as the mode can switch without being restarted and incompatible video recording settings can prevent the pipeline starting even in image capture mode. Set audio encoding settings and encoder profiles if they are supplied. Change-Id: I06febf977c2cae306383f9dbaae0f81f531b4757 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/plugins/gstreamer/camerabin/camerabinsession.cpp')
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.cpp41
1 files changed, 34 insertions, 7 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
index f85811e22..70ed3e236 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
@@ -94,6 +94,7 @@
#define SUPPORTED_IMAGE_CAPTURE_CAPS_PROPERTY "image-capture-supported-caps"
#define SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY "video-capture-supported-caps"
#define SUPPORTED_VIEWFINDER_CAPS_PROPERTY "viewfinder-supported-caps"
+#define AUDIO_CAPTURE_CAPS_PROPERTY "audio-capture-caps"
#define IMAGE_CAPTURE_CAPS_PROPERTY "image-capture-caps"
#define VIDEO_CAPTURE_CAPS_PROPERTY "video-capture-caps"
#define VIEWFINDER_CAPS_PROPERTY "viewfinder-caps"
@@ -346,6 +347,32 @@ void CameraBinSession::setupCaptureResolution()
}
}
+void CameraBinSession::setAudioCaptureCaps()
+{
+ QAudioEncoderSettings settings = m_audioEncodeControl->audioSettings();
+ const int sampleRate = settings.sampleRate();
+ const int channelCount = settings.channelCount();
+
+ if (sampleRate == -1 && channelCount == -1)
+ return;
+
+ GstStructure *structure = gst_structure_new(
+ "audio/x-raw-int",
+ "endianness", G_TYPE_INT, 1234,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "width", G_TYPE_INT, 16,
+ "depth", G_TYPE_INT, 16,
+ NULL);
+ if (sampleRate != -1)
+ gst_structure_set(structure, "rate", G_TYPE_INT, sampleRate, NULL);
+ if (channelCount != -1)
+ gst_structure_set(structure, "channels", G_TYPE_INT, channelCount, NULL);
+
+ GstCaps *caps = gst_caps_new_full(structure, NULL);
+ g_object_set(G_OBJECT(m_camerabin), AUDIO_CAPTURE_CAPS_PROPERTY, caps, NULL);
+ gst_caps_unref(caps);
+}
+
GstElement *CameraBinSession::buildCameraSource()
{
#if CAMERABIN_DEBUG
@@ -651,14 +678,14 @@ void CameraBinSession::setState(QCamera::State newState)
GstState pending = GST_STATE_NULL;
gst_element_get_state(m_camerabin, &binState, &pending, 0);
- if (captureMode() == QCamera::CaptureVideo) {
- m_recorderControl->applySettings();
+ m_recorderControl->applySettings();
- g_object_set (G_OBJECT(m_camerabin),
- "video-profile",
- m_recorderControl->videoProfile(),
- NULL);
- }
+ g_object_set (G_OBJECT(m_camerabin),
+ "video-profile",
+ m_recorderControl->videoProfile(),
+ NULL);
+
+ setAudioCaptureCaps();
setupCaptureResolution();