From 95de9e6154d75688e81a3b79007dfe6c56d3b65b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 21 Nov 2016 10:44:47 +0100 Subject: Use QT_CONFIG macro to check for features And remove many custom defines. Change-Id: I658cc8430d1d99ed3c0aafe03a77adce76621a29 Reviewed-by: Yoann Lopes --- src/plugins/gstreamer/camerabin/camerabin.pro | 8 ---- .../gstreamer/camerabin/camerabinaudioencoder.cpp | 9 ++-- .../gstreamer/camerabin/camerabinaudioencoder.h | 7 +-- .../gstreamer/camerabin/camerabincontainer.cpp | 13 +++--- .../gstreamer/camerabin/camerabincontainer.h | 7 +-- .../gstreamer/camerabin/camerabincontrol.cpp | 1 + .../camerabin/camerabinimageprocessing.cpp | 51 +++++++++++----------- .../gstreamer/camerabin/camerabinimageprocessing.h | 11 ++--- .../gstreamer/camerabin/camerabinrecorder.cpp | 4 +- .../gstreamer/camerabin/camerabinrecorder.h | 5 ++- .../camerabin/camerabinresourcepolicy.cpp | 18 ++++---- .../gstreamer/camerabin/camerabinservice.cpp | 5 ++- .../gstreamer/camerabin/camerabinsession.cpp | 14 +++--- src/plugins/gstreamer/camerabin/camerabinsession.h | 9 ++-- .../gstreamer/camerabin/camerabinvideoencoder.cpp | 9 ++-- .../gstreamer/camerabin/camerabinvideoencoder.h | 7 +-- 16 files changed, 92 insertions(+), 86 deletions(-) (limited to 'src/plugins/gstreamer/camerabin') diff --git a/src/plugins/gstreamer/camerabin/camerabin.pro b/src/plugins/gstreamer/camerabin/camerabin.pro index d214d61c6..183ddf2d4 100644 --- a/src/plugins/gstreamer/camerabin/camerabin.pro +++ b/src/plugins/gstreamer/camerabin/camerabin.pro @@ -53,8 +53,6 @@ SOURCES += \ $$PWD/camerabininfocontrol.cpp qtConfig(gstreamer_photography) { - DEFINES += HAVE_GST_PHOTOGRAPHY - HEADERS += \ $$PWD/camerabinfocus.h \ $$PWD/camerabinexposure.h \ @@ -71,13 +69,7 @@ qtConfig(gstreamer_photography) { DEFINES += GST_USE_UNSTABLE_API #prevents warnings because of unstable photography API } -qtConfig(gstreamer_encodingprofiles) { - DEFINES += HAVE_GST_ENCODING_PROFILES -} - qtConfig(linux_v4l) { - DEFINES += USE_V4L - HEADERS += \ $$PWD/camerabinv4limageprocessing.h diff --git a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp b/src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp index c638e087f..79c915aad 100644 --- a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp @@ -37,6 +37,7 @@ ** ****************************************************************************/ +#include #include "camerabinaudioencoder.h" #include "camerabincontainer.h" #include @@ -47,7 +48,7 @@ QT_BEGIN_NAMESPACE CameraBinAudioEncoder::CameraBinAudioEncoder(QObject *parent) :QAudioEncoderSettingsControl(parent) -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) , m_codecs(QGstCodecsInfo::AudioEncoder) #endif { @@ -59,7 +60,7 @@ CameraBinAudioEncoder::~CameraBinAudioEncoder() QStringList CameraBinAudioEncoder::supportedAudioCodecs() const { -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) return m_codecs.supportedCodecs(); #else return QStringList(); @@ -68,7 +69,7 @@ QStringList CameraBinAudioEncoder::supportedAudioCodecs() const QString CameraBinAudioEncoder::codecDescription(const QString &codecName) const { -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) return m_codecs.codecDescription(codecName); #else Q_UNUSED(codecName) @@ -112,7 +113,7 @@ void CameraBinAudioEncoder::resetActualSettings() m_actualAudioSettings = m_audioSettings; } -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) GstEncodingProfile *CameraBinAudioEncoder::createProfile() { diff --git a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h b/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h index cb3d895c7..943ef19b0 100644 --- a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h +++ b/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h @@ -40,6 +40,7 @@ #ifndef CAMERABINAUDIOENCODE_H #define CAMERABINAUDIOENCODE_H +#include #include #include @@ -49,7 +50,7 @@ #include #include -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) #include #include #endif @@ -85,7 +86,7 @@ public: void setActualAudioSettings(const QAudioEncoderSettings&); void resetActualSettings(); -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) GstEncodingProfile *createProfile(); #endif @@ -95,7 +96,7 @@ Q_SIGNALS: void settingsChanged(); private: -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) QGstCodecsInfo m_codecs; #endif diff --git a/src/plugins/gstreamer/camerabin/camerabincontainer.cpp b/src/plugins/gstreamer/camerabin/camerabincontainer.cpp index e72bf0e3c..1479b4ba6 100644 --- a/src/plugins/gstreamer/camerabin/camerabincontainer.cpp +++ b/src/plugins/gstreamer/camerabin/camerabincontainer.cpp @@ -37,6 +37,7 @@ ** ****************************************************************************/ +#include #include "camerabincontainer.h" #include @@ -46,7 +47,7 @@ QT_BEGIN_NAMESPACE CameraBinContainer::CameraBinContainer(QObject *parent) :QMediaContainerControl(parent) -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) , m_supportedContainers(QGstCodecsInfo::Muxer) #endif { @@ -62,7 +63,7 @@ CameraBinContainer::CameraBinContainer(QObject *parent) QStringList CameraBinContainer::supportedContainers() const { -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) return m_supportedContainers.supportedCodecs(); #else return QStringList(); @@ -71,7 +72,7 @@ QStringList CameraBinContainer::supportedContainers() const QString CameraBinContainer::containerDescription(const QString &formatMimeType) const { -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) return m_supportedContainers.codecDescription(formatMimeType); #else Q_UNUSED(formatMimeType) @@ -86,7 +87,7 @@ QString CameraBinContainer::containerFormat() const void CameraBinContainer::setContainerFormat(const QString &format) { -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) if (m_format != format) { m_format = format; m_actualFormat = format; @@ -102,7 +103,7 @@ QString CameraBinContainer::actualContainerFormat() const void CameraBinContainer::setActualContainerFormat(const QString &containerFormat) { -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) m_actualFormat = containerFormat; #endif } @@ -112,7 +113,7 @@ void CameraBinContainer::resetActualContainerFormat() m_actualFormat = m_format; } -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) GstEncodingContainerProfile *CameraBinContainer::createProfile() { diff --git a/src/plugins/gstreamer/camerabin/camerabincontainer.h b/src/plugins/gstreamer/camerabin/camerabincontainer.h index 8e9f21eaf..25de50095 100644 --- a/src/plugins/gstreamer/camerabin/camerabincontainer.h +++ b/src/plugins/gstreamer/camerabin/camerabincontainer.h @@ -41,6 +41,7 @@ #ifndef CAMERABINMEDIACONTAINERCONTROL_H #define CAMERABINMEDIACONTAINERCONTROL_H +#include #include #include #include @@ -48,7 +49,7 @@ #include #include -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) #include #include #endif @@ -74,7 +75,7 @@ public: QString suggestedFileExtension(const QString &containerFormat) const; -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) GstEncodingContainerProfile *createProfile(); #endif @@ -86,7 +87,7 @@ private: QString m_actualFormat; QMap m_fileExtensions; -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) QGstCodecsInfo m_supportedContainers; #endif }; diff --git a/src/plugins/gstreamer/camerabin/camerabincontrol.cpp b/src/plugins/gstreamer/camerabin/camerabincontrol.cpp index 48642d51b..a34315b8a 100644 --- a/src/plugins/gstreamer/camerabin/camerabincontrol.cpp +++ b/src/plugins/gstreamer/camerabin/camerabincontrol.cpp @@ -37,6 +37,7 @@ ** ****************************************************************************/ +#include #include "camerabincontrol.h" #include "camerabincontainer.h" #include "camerabinaudioencoder.h" diff --git a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp index e30441f86..f819c9f24 100644 --- a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp @@ -37,10 +37,11 @@ ** ****************************************************************************/ +#include #include "camerabinimageprocessing.h" #include "camerabinsession.h" -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) #include "camerabinv4limageprocessing.h" #endif @@ -56,11 +57,11 @@ CameraBinImageProcessing::CameraBinImageProcessing(CameraBinSession *session) : QCameraImageProcessingControl(session) , m_session(session) , m_whiteBalanceMode(QCameraImageProcessing::WhiteBalanceAuto) -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) , m_v4lImageControl(Q_NULLPTR) #endif { -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) if (m_session->photography()) { m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_AUTO] = QCameraImageProcessing::WhiteBalanceAuto; m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT] = QCameraImageProcessing::WhiteBalanceSunlight; @@ -96,7 +97,7 @@ CameraBinImageProcessing::CameraBinImageProcessing(CameraBinSession *session) #endif #endif -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) m_v4lImageControl = new CameraBinV4LImageProcessing(m_session); connect(m_session, &CameraBinSession::statusChanged, m_v4lImageControl, &CameraBinV4LImageProcessing::updateParametersInfo); @@ -181,7 +182,7 @@ QCameraImageProcessing::WhiteBalanceMode CameraBinImageProcessing::whiteBalanceM bool CameraBinImageProcessing::setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode) { -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) if (isWhiteBalanceModeSupported(mode)) { m_whiteBalanceMode = mode; #if GST_CHECK_VERSION(1, 2, 0) @@ -202,7 +203,7 @@ bool CameraBinImageProcessing::setWhiteBalanceMode(QCameraImageProcessing::White bool CameraBinImageProcessing::isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode mode) const { -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) return m_mappedWbValues.values().contains(mode); #else Q_UNUSED(mode); @@ -212,7 +213,7 @@ bool CameraBinImageProcessing::isWhiteBalanceModeSupported(QCameraImageProcessin bool CameraBinImageProcessing::isParameterSupported(QCameraImageProcessingControl::ProcessingParameter parameter) const { -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) if (parameter == QCameraImageProcessingControl::WhiteBalancePreset || parameter == QCameraImageProcessingControl::ColorFilter) { if (m_session->photography()) @@ -227,7 +228,7 @@ bool CameraBinImageProcessing::isParameterSupported(QCameraImageProcessingContro return true; } -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) if (m_v4lImageControl->isParameterSupported(parameter)) return true; #endif @@ -243,14 +244,14 @@ bool CameraBinImageProcessing::isParameterValueSupported(QCameraImageProcessingC case SaturationAdjustment: { const bool isGstColorBalanceValueSupported = GST_IS_COLOR_BALANCE(m_session->cameraBin()) && qAbs(value.toReal()) <= 1.0; -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) if (!isGstColorBalanceValueSupported) return m_v4lImageControl->isParameterValueSupported(parameter, value); #endif return isGstColorBalanceValueSupported; } case SharpeningAdjustment: { -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) return m_v4lImageControl->isParameterValueSupported(parameter, value); #else return false; @@ -260,14 +261,14 @@ bool CameraBinImageProcessing::isParameterValueSupported(QCameraImageProcessingC const QCameraImageProcessing::WhiteBalanceMode mode = value.value(); const bool isPhotographyWhiteBalanceSupported = isWhiteBalanceModeSupported(mode); -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) if (!isPhotographyWhiteBalanceSupported) return m_v4lImageControl->isParameterValueSupported(parameter, value); #endif return isPhotographyWhiteBalanceSupported; } case ColorTemperature: { -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) return m_v4lImageControl->isParameterValueSupported(parameter, value); #else return false; @@ -275,7 +276,7 @@ bool CameraBinImageProcessing::isParameterValueSupported(QCameraImageProcessingC } case ColorFilter: { const QCameraImageProcessing::ColorFilter filter = value.value(); -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) return m_filterMap.contains(filter); #else return filter == QCameraImageProcessing::ColorFilterNone; @@ -294,7 +295,7 @@ QVariant CameraBinImageProcessing::parameter( switch (parameter) { case QCameraImageProcessingControl::WhiteBalancePreset: { const QCameraImageProcessing::WhiteBalanceMode mode = whiteBalanceMode(); -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) if (mode == QCameraImageProcessing::WhiteBalanceAuto || mode == QCameraImageProcessing::WhiteBalanceManual) { return m_v4lImageControl->parameter(parameter); @@ -303,14 +304,14 @@ QVariant CameraBinImageProcessing::parameter( return QVariant::fromValue(mode); } case QCameraImageProcessingControl::ColorTemperature: { -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) return m_v4lImageControl->parameter(parameter); #else return QVariant(); #endif } case QCameraImageProcessingControl::ColorFilter: -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) if (GstPhotography *photography = m_session->photography()) { #if GST_CHECK_VERSION(1, 0, 0) GstPhotographyColorToneMode mode = GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL; @@ -325,7 +326,7 @@ QVariant CameraBinImageProcessing::parameter( return QVariant::fromValue(QCameraImageProcessing::ColorFilterNone); default: { const bool isGstParameterSupported = m_values.contains(parameter); -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) if (!isGstParameterSupported) { if (parameter == QCameraImageProcessingControl::BrightnessAdjustment || parameter == QCameraImageProcessingControl::ContrastAdjustment @@ -348,7 +349,7 @@ void CameraBinImageProcessing::setParameter(QCameraImageProcessingControl::Proce switch (parameter) { case ContrastAdjustment: { if (!setColorBalanceValue("contrast", value.toReal())) { -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) m_v4lImageControl->setParameter(parameter, value); #endif } @@ -356,7 +357,7 @@ void CameraBinImageProcessing::setParameter(QCameraImageProcessingControl::Proce break; case BrightnessAdjustment: { if (!setColorBalanceValue("brightness", value.toReal())) { -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) m_v4lImageControl->setParameter(parameter, value); #endif } @@ -364,21 +365,21 @@ void CameraBinImageProcessing::setParameter(QCameraImageProcessingControl::Proce break; case SaturationAdjustment: { if (!setColorBalanceValue("saturation", value.toReal())) { -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) m_v4lImageControl->setParameter(parameter, value); #endif } } break; case SharpeningAdjustment: { -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) m_v4lImageControl->setParameter(parameter, value); #endif } break; case WhiteBalancePreset: { if (!setWhiteBalanceMode(value.value())) { -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) const QCameraImageProcessing::WhiteBalanceMode mode = value.value(); if (mode == QCameraImageProcessing::WhiteBalanceAuto @@ -391,13 +392,13 @@ void CameraBinImageProcessing::setParameter(QCameraImageProcessingControl::Proce } break; case QCameraImageProcessingControl::ColorTemperature: { -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) m_v4lImageControl->setParameter(parameter, value); #endif break; } case QCameraImageProcessingControl::ColorFilter: -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) if (GstPhotography *photography = m_session->photography()) { #if GST_CHECK_VERSION(1, 0, 0) gst_photography_set_color_tone_mode(photography, m_filterMap.value( @@ -418,7 +419,7 @@ void CameraBinImageProcessing::setParameter(QCameraImageProcessingControl::Proce updateColorBalanceValues(); } -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) void CameraBinImageProcessing::lockWhiteBalance() { #if GST_CHECK_VERSION(1, 2, 0) diff --git a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h index 82c6e1678..b09c8d52b 100644 --- a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h +++ b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h @@ -40,13 +40,14 @@ #ifndef CAMERABINIMAGEPROCESSINGCONTROL_H #define CAMERABINIMAGEPROCESSINGCONTROL_H +#include #include #include #include #include -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) # include # if !GST_CHECK_VERSION(1,0,0) typedef GstWhiteBalanceMode GstPhotographyWhiteBalanceMode; @@ -56,7 +57,7 @@ typedef GstColourToneMode GstPhotographyColorToneMode; QT_BEGIN_NAMESPACE -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) class CameraBinV4LImageProcessing; #endif @@ -79,7 +80,7 @@ public: QVariant parameter(ProcessingParameter parameter) const; void setParameter(ProcessingParameter parameter, const QVariant &value); -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) void lockWhiteBalance(); void unlockWhiteBalance(); #endif @@ -91,13 +92,13 @@ private: private: CameraBinSession *m_session; QMap m_values; -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) QMap m_mappedWbValues; QMap m_filterMap; #endif QCameraImageProcessing::WhiteBalanceMode m_whiteBalanceMode; -#ifdef USE_V4L +#if QT_CONFIG(linux_v4l) CameraBinV4LImageProcessing *m_v4lImageControl; #endif }; diff --git a/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp b/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp index 548752a16..e9e8e0f71 100644 --- a/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp @@ -136,7 +136,7 @@ qint64 CameraBinRecorder::duration() const void CameraBinRecorder::applySettings() { -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) CameraBinContainer *containerControl = m_session->mediaContainerControl(); CameraBinAudioEncoder *audioEncoderControl = m_session->audioEncodeControl(); CameraBinVideoEncoder *videoEncoderControl = m_session->videoEncodeControl(); @@ -181,7 +181,7 @@ void CameraBinRecorder::applySettings() #endif } -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) GstEncodingContainerProfile *CameraBinRecorder::videoProfile() { diff --git a/src/plugins/gstreamer/camerabin/camerabinrecorder.h b/src/plugins/gstreamer/camerabin/camerabinrecorder.h index c5280ebd7..86aa2fb94 100644 --- a/src/plugins/gstreamer/camerabin/camerabinrecorder.h +++ b/src/plugins/gstreamer/camerabin/camerabinrecorder.h @@ -41,10 +41,11 @@ #ifndef CAMERABINRECORDERCONTROL_H #define CAMERABINRECORDERCONTROL_H +#include #include #include "camerabinsession.h" -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) #include #endif @@ -71,7 +72,7 @@ public: void applySettings(); -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) GstEncodingContainerProfile *videoProfile(); #endif diff --git a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp b/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp index 3f14ffcc5..6da86e569 100644 --- a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp @@ -37,13 +37,13 @@ ** ****************************************************************************/ +#include "QtMultimedia/private/qtmultimediaglobal_p.h" #include "camerabinresourcepolicy.h" - //#define DEBUG_RESOURCE_POLICY #include #include -#ifdef HAVE_RESOURCE_POLICY +#if QT_CONFIG(resourcepolicy) #include #include #include @@ -57,7 +57,7 @@ CamerabinResourcePolicy::CamerabinResourcePolicy(QObject *parent) : m_releasingResources(false), m_canCapture(false) { -#ifdef HAVE_RESOURCE_POLICY +#if QT_CONFIG(resourcepolicy) //loaded resource set is also kept requested for image and video capture sets m_resource = new ResourcePolicy::ResourceSet("camera"); m_resource->setAlwaysReply(); @@ -76,7 +76,7 @@ CamerabinResourcePolicy::CamerabinResourcePolicy(QObject *parent) : CamerabinResourcePolicy::~CamerabinResourcePolicy() { -#ifdef HAVE_RESOURCE_POLICY +#if QT_CONFIG(resourcepolicy) //ensure the resources are released if (m_resourceSet != NoResources) setResourceSet(NoResources); @@ -106,7 +106,7 @@ void CamerabinResourcePolicy::setResourceSet(CamerabinResourcePolicy::ResourceSe qDebug() << Q_FUNC_INFO << set; #endif -#ifdef HAVE_RESOURCE_POLICY +#if QT_CONFIG(resourcepolicy) QSet requestedTypes; switch (set) { @@ -178,7 +178,7 @@ void CamerabinResourcePolicy::setResourceSet(CamerabinResourcePolicy::ResourceSe bool CamerabinResourcePolicy::isResourcesGranted() const { -#ifdef HAVE_RESOURCE_POLICY +#if QT_CONFIG(resourcepolicy) const auto resources = m_resource->resources(); for (ResourcePolicy::Resource *resource : resources) if (!resource->isOptional() && !resource->isGranted()) @@ -201,7 +201,7 @@ void CamerabinResourcePolicy::handleResourcesGranted() void CamerabinResourcePolicy::handleResourcesReleased() { -#ifdef HAVE_RESOURCE_POLICY +#if QT_CONFIG(resourcepolicy) #ifdef DEBUG_RESOURCE_POLICY qDebug() << Q_FUNC_INFO; #endif @@ -212,7 +212,7 @@ void CamerabinResourcePolicy::handleResourcesReleased() void CamerabinResourcePolicy::resourcesAvailable() { -#ifdef HAVE_RESOURCE_POLICY +#if QT_CONFIG(resourcepolicy) if (m_resourceSet != NoResources) { m_resource->acquire(); } @@ -228,7 +228,7 @@ void CamerabinResourcePolicy::updateCanCapture() { const bool wasAbleToRecord = m_canCapture; m_canCapture = (m_resourceSet == VideoCaptureResources) || (m_resourceSet == ImageCaptureResources); -#ifdef HAVE_RESOURCE_POLICY +#if QT_CONFIG(resourcepolicy) const auto resources = m_resource->resources(); for (ResourcePolicy::Resource *resource : resources) { if (resource->type() != ResourcePolicy::LensCoverType) diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.cpp b/src/plugins/gstreamer/camerabin/camerabinservice.cpp index 3fbd1a60e..f11cfea6d 100644 --- a/src/plugins/gstreamer/camerabin/camerabinservice.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinservice.cpp @@ -37,6 +37,7 @@ ** ****************************************************************************/ +#include #include "camerabinservice.h" #include "camerabinsession.h" #include "camerabinrecorder.h" @@ -48,7 +49,7 @@ #include "camerabinmetadata.h" #include "camerabininfocontrol.h" -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) #include "camerabinexposure.h" #include "camerabinflash.h" #include "camerabinfocus.h" @@ -202,7 +203,7 @@ QMediaControl *CameraBinService::requestControl(const char *name) if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0) return m_imageCaptureControl; -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) if (qstrcmp(name, QCameraExposureControl_iid) == 0) return m_captureSession->cameraExposureControl(); diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp index 64c8780d3..b0a11bb44 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp @@ -36,6 +36,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#include #include "camerabinsession.h" #include "camerabincontrol.h" #include "camerabinrecorder.h" @@ -44,7 +46,7 @@ #include "camerabinvideoencoder.h" #include "camerabinimageencoder.h" -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) #include "camerabinexposure.h" #include "camerabinflash.h" #include "camerabinfocus.h" @@ -63,7 +65,7 @@ #include #include -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) #include #endif @@ -127,7 +129,7 @@ CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *pa m_videoInputFactory(0), m_viewfinder(0), m_viewfinderInterface(0), -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) m_cameraExposureControl(0), m_cameraFlashControl(0), m_cameraFocusControl(0), @@ -212,7 +214,7 @@ CameraBinSession::~CameraBinSession() gst_object_unref(GST_OBJECT(m_sourceFactory)); } -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) GstPhotography *CameraBinSession::photography() { if (GST_IS_PHOTOGRAPHY(m_camerabin)) { @@ -807,7 +809,7 @@ void CameraBinSession::start() m_recorderControl->applySettings(); -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) GstEncodingContainerProfile *profile = m_recorderControl->videoProfile(); g_object_set (G_OBJECT(m_camerabin), "video-profile", @@ -952,7 +954,7 @@ bool CameraBinSession::processSyncMessage(const QGstreamerMessage &message) } return true; } -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) if (gst_structure_has_name(st, GST_PHOTOGRAPHY_AUTOFOCUS_DONE)) m_cameraFocusControl->handleFocusMessage(gm); #endif diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.h b/src/plugins/gstreamer/camerabin/camerabinsession.h index ca0b22761..8966a2ece 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.h +++ b/src/plugins/gstreamer/camerabin/camerabinsession.h @@ -40,13 +40,14 @@ #ifndef CAMERABINCAPTURESESSION_H #define CAMERABINCAPTURESESSION_H +#include #include #include #include #include -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) #include #endif @@ -93,7 +94,7 @@ public: CameraBinSession(GstElementFactory *sourceFactory, QObject *parent); ~CameraBinSession(); -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) GstPhotography *photography(); #endif GstElement *cameraBin() { return m_camerabin; } @@ -117,7 +118,7 @@ public: CameraBinVideoEncoder *videoEncodeControl() const { return m_videoEncodeControl; } CameraBinImageEncoder *imageEncodeControl() const { return m_imageEncodeControl; } -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) CameraBinExposure *cameraExposureControl(); CameraBinFlash *cameraFlashControl(); CameraBinFocus *cameraFocusControl(); @@ -238,7 +239,7 @@ private: CameraBinImageEncoder *m_imageEncodeControl; CameraBinRecorder *m_recorderControl; CameraBinContainer *m_mediaContainerControl; -#ifdef HAVE_GST_PHOTOGRAPHY +#if QT_CONFIG(gstreamer_photography) CameraBinExposure *m_cameraExposureControl; CameraBinFlash *m_cameraFlashControl; CameraBinFocus *m_cameraFocusControl; diff --git a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp index 7eb8644b4..86585da9e 100644 --- a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp @@ -37,6 +37,7 @@ ** ****************************************************************************/ +#include #include "camerabinvideoencoder.h" #include "camerabinsession.h" #include "camerabincontainer.h" @@ -49,7 +50,7 @@ QT_BEGIN_NAMESPACE CameraBinVideoEncoder::CameraBinVideoEncoder(CameraBinSession *session) :QVideoEncoderSettingsControl(session) , m_session(session) -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) , m_codecs(QGstCodecsInfo::VideoEncoder) #endif { @@ -89,7 +90,7 @@ QList< qreal > CameraBinVideoEncoder::supportedFrameRates(const QVideoEncoderSet QStringList CameraBinVideoEncoder::supportedVideoCodecs() const { -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) return m_codecs.supportedCodecs(); #else return QStringList(); @@ -98,7 +99,7 @@ QStringList CameraBinVideoEncoder::supportedVideoCodecs() const QString CameraBinVideoEncoder::videoCodecDescription(const QString &codecName) const { -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) return m_codecs.codecDescription(codecName); #else Q_UNUSED(codecName) @@ -167,7 +168,7 @@ QPair CameraBinVideoEncoder::rateAsRational(qreal frameRate) const return QPair(); } -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) GstEncodingProfile *CameraBinVideoEncoder::createProfile() { diff --git a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h index 7abcd66d5..922b6f464 100644 --- a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h +++ b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h @@ -40,6 +40,7 @@ #ifndef CAMERABINVIDEOENCODE_H #define CAMERABINVIDEOENCODE_H +#include #include #include @@ -49,7 +50,7 @@ #include #include -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) #include #include #endif @@ -83,7 +84,7 @@ public: void setActualVideoSettings(const QVideoEncoderSettings&); void resetActualSettings(); -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) GstEncodingProfile *createProfile(); #endif @@ -95,7 +96,7 @@ Q_SIGNALS: private: CameraBinSession *m_session; -#ifdef HAVE_GST_ENCODING_PROFILES +#if QT_CONFIG(gstreamer_encodingprofiles) QGstCodecsInfo m_codecs; #endif -- cgit v1.2.3