From e4bf7d90bf32031641892783cc53f7712cb1c072 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Mon, 19 Jan 2015 14:20:53 +0100 Subject: [PATCH] GStreamer: implemented QCameraViewfinderSettingsControl2. Change-Id: I4436e39c152f6c251792c1504d4a7b57db7b9d9a Reviewed-by: Christian Stromme --- src/gsttools/qgstutils.cpp | 220 ++++++++++----- src/multimedia/gsttools_headers/qgstutils_p.h | 9 +- src/plugins/gstreamer/camerabin/camerabin.pro | 2 + .../gstreamer/camerabin/camerabincontrol.cpp | 1 + .../gstreamer/camerabin/camerabinservice.cpp | 18 +- src/plugins/gstreamer/camerabin/camerabinservice.h | 5 + .../gstreamer/camerabin/camerabinsession.cpp | 296 ++++++++++++++------- src/plugins/gstreamer/camerabin/camerabinsession.h | 29 +- .../camerabin/camerabinviewfindersettings.cpp | 53 ++-- .../camerabin/camerabinviewfindersettings.h | 15 +- .../camerabin/camerabinviewfindersettings2.cpp | 67 +++++ .../camerabin/camerabinviewfindersettings2.h | 61 +++++ 12 files changed, 572 insertions(+), 204 deletions(-) create mode 100644 src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.cpp create mode 100644 src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp index 72cf17a..55a0be1 100644 --- a/src/gsttools/qgstutils.cpp +++ b/src/gsttools/qgstutils.cpp @@ -149,15 +149,10 @@ QMap QGstUtils::gstTagListToMap(const GstTagList *tags) */ QSize QGstUtils::capsResolution(const GstCaps *caps) { - QSize size; - - if (caps) { - const GstStructure *structure = gst_caps_get_structure(caps, 0); - gst_structure_get_int(structure, "width", &size.rwidth()); - gst_structure_get_int(structure, "height", &size.rheight()); - } + if (gst_caps_get_size(caps) == 0) + return QSize(); - return size; + return structureResolution(gst_caps_get_structure(caps, 0)); } /*! @@ -169,14 +164,12 @@ QSize QGstUtils::capsCorrectedResolution(const GstCaps *caps) QSize size; if (caps) { - const GstStructure *structure = gst_caps_get_structure(caps, 0); - gst_structure_get_int(structure, "width", &size.rwidth()); - gst_structure_get_int(structure, "height", &size.rheight()); + size = capsResolution(caps); gint aspectNum = 0; gint aspectDenum = 0; if (!size.isEmpty() && gst_structure_get_fraction( - structure, "pixel-aspect-ratio", &aspectNum, &aspectDenum)) { + gst_caps_get_structure(caps, 0), "pixel-aspect-ratio", &aspectNum, &aspectDenum)) { if (aspectDenum > 0) size.setWidth(size.width()*aspectNum/aspectDenum); } @@ -1048,20 +1041,23 @@ static int indexOfRgbColor( QVideoSurfaceFormat QGstUtils::formatForCaps( GstCaps *caps, GstVideoInfo *info, QAbstractVideoBuffer::HandleType handleType) { - if (gst_video_info_from_caps(info, caps)) { - int index = indexOfVideoFormat(info->finfo->format); + GstVideoInfo vidInfo; + GstVideoInfo *infoPtr = info ? info : &vidInfo; + + if (gst_video_info_from_caps(infoPtr, caps)) { + int index = indexOfVideoFormat(infoPtr->finfo->format); if (index != -1) { QVideoSurfaceFormat format( - QSize(info->width, info->height), + QSize(infoPtr->width, infoPtr->height), qt_videoFormatLookup[index].pixelFormat, handleType); - if (info->fps_d > 0) - format.setFrameRate(qreal(info->fps_n) / info->fps_d); + if (infoPtr->fps_d > 0) + format.setFrameRate(qreal(infoPtr->fps_n) / infoPtr->fps_d); - if (info->par_d > 0) - format.setPixelAspectRatio(info->par_n, info->par_d); + if (infoPtr->par_d > 0) + format.setPixelAspectRatio(infoPtr->par_n, infoPtr->par_d); return format; } @@ -1076,60 +1072,18 @@ QVideoSurfaceFormat QGstUtils::formatForCaps( { const GstStructure *structure = gst_caps_get_structure(caps, 0); - QVideoFrame::PixelFormat pixelFormat = QVideoFrame::Format_Invalid; int bitsPerPixel = 0; - - QSize size; - gst_structure_get_int(structure, "width", &size.rwidth()); - gst_structure_get_int(structure, "height", &size.rheight()); - - if (qstrcmp(gst_structure_get_name(structure), "video/x-raw-yuv") == 0) { - guint32 fourcc = 0; - gst_structure_get_fourcc(structure, "format", &fourcc); - - int index = indexOfYuvColor(fourcc); - if (index != -1) { - pixelFormat = qt_yuvColorLookup[index].pixelFormat; - bitsPerPixel = qt_yuvColorLookup[index].bitsPerPixel; - } - } else if (qstrcmp(gst_structure_get_name(structure), "video/x-raw-rgb") == 0) { - int depth = 0; - int endianness = 0; - int red = 0; - int green = 0; - int blue = 0; - int alpha = 0; - - gst_structure_get_int(structure, "bpp", &bitsPerPixel); - gst_structure_get_int(structure, "depth", &depth); - gst_structure_get_int(structure, "endianness", &endianness); - gst_structure_get_int(structure, "red_mask", &red); - gst_structure_get_int(structure, "green_mask", &green); - gst_structure_get_int(structure, "blue_mask", &blue); - gst_structure_get_int(structure, "alpha_mask", &alpha); - - int index = indexOfRgbColor(bitsPerPixel, depth, endianness, red, green, blue, alpha); - - if (index != -1) - pixelFormat = qt_rgbColorLookup[index].pixelFormat; - } + QSize size = structureResolution(structure); + QVideoFrame::PixelFormat pixelFormat = structurePixelFormat(structure, &bitsPerPixel); if (pixelFormat != QVideoFrame::Format_Invalid) { QVideoSurfaceFormat format(size, pixelFormat, handleType); - QPair rate; - gst_structure_get_fraction(structure, "framerate", &rate.first, &rate.second); - + QPair rate = structureFrameRateRange(structure); if (rate.second) - format.setFrameRate(qreal(rate.first)/rate.second); + format.setFrameRate(rate.second); - gint aspectNum = 0; - gint aspectDenum = 0; - if (gst_structure_get_fraction( - structure, "pixel-aspect-ratio", &aspectNum, &aspectDenum)) { - if (aspectDenum > 0) - format.setPixelAspectRatio(aspectNum, aspectDenum); - } + format.setPixelAspectRatio(structurePixelAspectRatio(structure)); if (bytesPerLine) *bytesPerLine = ((size.width() * bitsPerPixel / 8) + 3) & ~3; @@ -1304,6 +1258,118 @@ GstCaps *QGstUtils::videoFilterCaps() return gst_caps_make_writable(gst_static_caps_get(&staticCaps)); } +QSize QGstUtils::structureResolution(const GstStructure *s) +{ + QSize size; + + int w, h; + if (s && gst_structure_get_int(s, "width", &w) && gst_structure_get_int(s, "height", &h)) { + size.rwidth() = w; + size.rheight() = h; + } + + return size; +} + +QVideoFrame::PixelFormat QGstUtils::structurePixelFormat(const GstStructure *structure, int *bpp) +{ + QVideoFrame::PixelFormat pixelFormat = QVideoFrame::Format_Invalid; + + if (!structure) + return pixelFormat; + +#if GST_CHECK_VERSION(1,0,0) + Q_UNUSED(bpp); + + if (gst_structure_has_name(structure, "video/x-raw")) { + const gchar *s = gst_structure_get_string(structure, "format"); + if (s) { + GstVideoFormat format = gst_video_format_from_string(s); + int index = indexOfVideoFormat(format); + + if (index != -1) + pixelFormat = qt_videoFormatLookup[index].pixelFormat; + } + } +#else + if (qstrcmp(gst_structure_get_name(structure), "video/x-raw-yuv") == 0) { + guint32 fourcc = 0; + gst_structure_get_fourcc(structure, "format", &fourcc); + + int index = indexOfYuvColor(fourcc); + if (index != -1) { + pixelFormat = qt_yuvColorLookup[index].pixelFormat; + if (bpp) + *bpp = qt_yuvColorLookup[index].bitsPerPixel; + } + } else if (qstrcmp(gst_structure_get_name(structure), "video/x-raw-rgb") == 0) { + int bitsPerPixel = 0; + int depth = 0; + int endianness = 0; + int red = 0; + int green = 0; + int blue = 0; + int alpha = 0; + + gst_structure_get_int(structure, "bpp", &bitsPerPixel); + gst_structure_get_int(structure, "depth", &depth); + gst_structure_get_int(structure, "endianness", &endianness); + gst_structure_get_int(structure, "red_mask", &red); + gst_structure_get_int(structure, "green_mask", &green); + gst_structure_get_int(structure, "blue_mask", &blue); + gst_structure_get_int(structure, "alpha_mask", &alpha); + + int index = indexOfRgbColor(bitsPerPixel, depth, endianness, red, green, blue, alpha); + + if (index != -1) { + pixelFormat = qt_rgbColorLookup[index].pixelFormat; + if (bpp) + *bpp = qt_rgbColorLookup[index].bitsPerPixel; + } + } +#endif + + return pixelFormat; +} + +QSize QGstUtils::structurePixelAspectRatio(const GstStructure *s) +{ + QSize ratio(1, 1); + + gint aspectNum = 0; + gint aspectDenum = 0; + if (s && gst_structure_get_fraction(s, "pixel-aspect-ratio", &aspectNum, &aspectDenum)) { + if (aspectDenum > 0) { + ratio.rwidth() = aspectNum; + ratio.rheight() = aspectDenum; + } + } + + return ratio; +} + +QPair QGstUtils::structureFrameRateRange(const GstStructure *s) +{ + QPair rate; + + if (!s) + return rate; + + int n, d; + if (gst_structure_get_fraction(s, "framerate", &n, &d)) { + rate.second = qreal(n) / d; + rate.first = rate.second; + } else if (gst_structure_get_fraction(s, "max-framerate", &n, &d)) { + rate.second = qreal(n) / d; + if (gst_structure_get_fraction(s, "min-framerate", &n, &d)) + rate.first = qreal(n) / d; + else + rate.first = qreal(1); + } + + return rate; +} + void qt_gst_object_ref_sink(gpointer object) { #if GST_CHECK_VERSION(0,10,24) @@ -1331,6 +1397,15 @@ GstCaps *qt_gst_pad_get_current_caps(GstPad *pad) #endif } +GstCaps *qt_gst_pad_get_caps(GstPad *pad) +{ +#if GST_CHECK_VERSION(1,0,0) + return gst_pad_query_caps(pad, NULL); +#else + return gst_pad_get_caps_reffed(pad); +#endif +} + GstStructure *qt_gst_structure_new_empty(const char *name) { #if GST_CHECK_VERSION(1,0,0) @@ -1358,6 +1433,19 @@ gboolean qt_gst_element_query_duration(GstElement *element, GstFormat format, gi #endif } +GstCaps *qt_gst_caps_normalize(GstCaps *caps) +{ +#if GST_CHECK_VERSION(1,0,0) + // gst_caps_normalize() takes ownership of the argument in 1.0 + return gst_caps_normalize(caps); +#else + // in 0.10, it doesn't. Unref the argument to mimic the 1.0 behavior + GstCaps *res = gst_caps_normalize(caps); + gst_caps_unref(caps); + return res; +#endif +} + QDebug operator <<(QDebug debug, GstCaps *caps) { if (caps) { diff --git a/src/multimedia/gsttools_headers/qgstutils_p.h b/src/multimedia/gsttools_headers/qgstutils_p.h index 2ebf42b..d7e26ad 100644 --- a/src/multimedia/gsttools_headers/qgstutils_p.h +++ b/src/multimedia/gsttools_headers/qgstutils_p.h @@ -115,7 +115,7 @@ namespace QGstUtils { QImage bufferToImage(GstBuffer *buffer, const GstVideoInfo &info); QVideoSurfaceFormat formatForCaps( GstCaps *caps, - GstVideoInfo *info, + GstVideoInfo *info = 0, QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle); #else QImage bufferToImage(GstBuffer *buffer); @@ -133,13 +133,20 @@ namespace QGstUtils { GstCaps *videoFilterCaps(); + QSize structureResolution(const GstStructure *s); + QVideoFrame::PixelFormat structurePixelFormat(const GstStructure *s, int *bpp = 0); + QSize structurePixelAspectRatio(const GstStructure *s); + QPair structureFrameRateRange(const GstStructure *s); + } void qt_gst_object_ref_sink(gpointer object); GstCaps *qt_gst_pad_get_current_caps(GstPad *pad); +GstCaps *qt_gst_pad_get_caps(GstPad *pad); GstStructure *qt_gst_structure_new_empty(const char *name); gboolean qt_gst_element_query_position(GstElement *element, GstFormat format, gint64 *cur); gboolean qt_gst_element_query_duration(GstElement *element, GstFormat format, gint64 *cur); +GstCaps *qt_gst_caps_normalize(GstCaps *caps); QDebug operator <<(QDebug debug, GstCaps *caps); diff --git a/src/plugins/gstreamer/camerabin/camerabin.pro b/src/plugins/gstreamer/camerabin/camerabin.pro index 64fee3e..bfbb357 100644 --- a/src/plugins/gstreamer/camerabin/camerabin.pro +++ b/src/plugins/gstreamer/camerabin/camerabin.pro @@ -31,6 +31,7 @@ HEADERS += \ $$PWD/camerabincapturedestination.h \ $$PWD/camerabincapturebufferformat.h \ $$PWD/camerabinviewfindersettings.h \ + $$PWD/camerabinviewfindersettings2.h \ $$PWD/camerabininfocontrol.h SOURCES += \ @@ -49,6 +50,7 @@ SOURCES += \ $$PWD/camerabinresourcepolicy.cpp \ $$PWD/camerabincapturedestination.cpp \ $$PWD/camerabinviewfindersettings.cpp \ + $$PWD/camerabinviewfindersettings2.cpp \ $$PWD/camerabincapturebufferformat.cpp \ $$PWD/camerabininfocontrol.cpp diff --git a/src/plugins/gstreamer/camerabin/camerabincontrol.cpp b/src/plugins/gstreamer/camerabin/camerabincontrol.cpp index cd7e376..8d1f9fd 100644 --- a/src/plugins/gstreamer/camerabin/camerabincontrol.cpp +++ b/src/plugins/gstreamer/camerabin/camerabincontrol.cpp @@ -256,6 +256,7 @@ bool CameraBinControl::canChangeProperty(PropertyChangeType changeType, QCamera: case QCameraControl::VideoEncodingSettings: case QCameraControl::Viewfinder: return true; + case QCameraControl::ViewfinderSettings: default: return false; } diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.cpp b/src/plugins/gstreamer/camerabin/camerabinservice.cpp index 4bcddb3..706907e 100644 --- a/src/plugins/gstreamer/camerabin/camerabinservice.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinservice.cpp @@ -55,6 +55,7 @@ #include "camerabincapturebufferformat.h" #include "camerabincapturedestination.h" #include "camerabinviewfindersettings.h" +#include "camerabinviewfindersettings2.h" #include #include @@ -84,7 +85,9 @@ QT_BEGIN_NAMESPACE CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *parent): QMediaService(parent), - m_cameraInfoControl(0) + m_cameraInfoControl(0), + m_viewfinderSettingsControl(0), + m_viewfinderSettingsControl2(0) { m_captureSession = 0; m_metaDataControl = 0; @@ -224,8 +227,17 @@ QMediaControl *CameraBinService::requestControl(const char *name) if (qstrcmp(name, QCameraCaptureBufferFormatControl_iid) == 0) return m_captureSession->captureBufferFormatControl(); - if (qstrcmp(name, QCameraViewfinderSettingsControl_iid) == 0) - return m_captureSession->viewfinderSettingsControl(); + if (qstrcmp(name, QCameraViewfinderSettingsControl_iid) == 0) { + if (!m_viewfinderSettingsControl) + m_viewfinderSettingsControl = new CameraBinViewfinderSettings(m_captureSession); + return m_viewfinderSettingsControl; + } + + if (qstrcmp(name, QCameraViewfinderSettingsControl2_iid) == 0) { + if (!m_viewfinderSettingsControl2) + m_viewfinderSettingsControl2 = new CameraBinViewfinderSettings2(m_captureSession); + return m_viewfinderSettingsControl2; + } if (qstrcmp(name, QCameraInfoControl_iid) == 0) { if (!m_cameraInfoControl) diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.h b/src/plugins/gstreamer/camerabin/camerabinservice.h index 10fe18e..ed181ee 100644 --- a/src/plugins/gstreamer/camerabin/camerabinservice.h +++ b/src/plugins/gstreamer/camerabin/camerabinservice.h @@ -53,6 +53,8 @@ class QGstreamerElementFactory; class CameraBinMetaData; class CameraBinImageCapture; class CameraBinMetaData; +class CameraBinViewfinderSettings; +class CameraBinViewfinderSettings2; class CameraBinService : public QMediaService { @@ -85,6 +87,9 @@ private: #endif CameraBinImageCapture *m_imageCaptureControl; QMediaControl *m_cameraInfoControl; + + CameraBinViewfinderSettings *m_viewfinderSettingsControl; + CameraBinViewfinderSettings2 *m_viewfinderSettingsControl2; }; QT_END_NAMESPACE diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp index 72d72fd..0ed8dcb 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #ifdef HAVE_GST_PHOTOGRAPHY #include @@ -120,11 +121,14 @@ CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *pa m_videoInputFactory(0), m_viewfinder(0), m_viewfinderInterface(0), + m_cameraSrc(0), m_videoSrc(0), m_viewfinderElement(0), m_sourceFactory(sourceFactory), m_viewfinderHasChanged(true), - m_videoInputHasChanged(true), + m_inputDeviceHasChanged(true), + m_usingWrapperCameraBinSrc(false), + m_viewfinderProbe(this), m_audioSrc(0), m_audioConvert(0), m_capsFilter(0), @@ -164,7 +168,6 @@ CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *pa m_imageProcessingControl = new CameraBinImageProcessing(this); m_captureDestinationControl = new CameraBinCaptureDestination(this); m_captureBufferFormatControl = new CameraBinCaptureBufferFormat(this); - m_viewfinderSettingsControl = new CameraBinViewfinderSettings(this); QByteArray envFlags = qgetenv("QT_GSTREAMER_CAMERABIN_FLAGS"); if (!envFlags.isEmpty()) @@ -231,8 +234,12 @@ bool CameraBinSession::setupCameraBin() return false; if (m_viewfinderHasChanged) { - if (m_viewfinderElement) + if (m_viewfinderElement) { + GstPad *pad = gst_element_get_static_pad(m_viewfinderElement, "sink"); + m_viewfinderProbe.removeProbeFromPad(pad); + gst_object_unref(GST_OBJECT(pad)); gst_object_unref(GST_OBJECT(m_viewfinderElement)); + } m_viewfinderElement = m_viewfinderInterface ? m_viewfinderInterface->videoSink() : 0; #if CAMERABIN_DEBUG @@ -244,6 +251,11 @@ bool CameraBinSession::setupCameraBin() qWarning() << "Starting camera without viewfinder available"; m_viewfinderElement = gst_element_factory_make("fakesink", NULL); } + + GstPad *pad = gst_element_get_static_pad(m_viewfinderElement, "sink"); + m_viewfinderProbe.addProbeToPad(pad); + gst_object_unref(GST_OBJECT(pad)); + g_object_set(G_OBJECT(m_viewfinderElement), "sync", FALSE, NULL); qt_gst_object_ref_sink(GST_OBJECT(m_viewfinderElement)); gst_element_set_state(m_camerabin, GST_STATE_NULL); @@ -253,9 +265,15 @@ bool CameraBinSession::setupCameraBin() return true; } -static GstCaps *resolutionToCaps(const QSize &resolution, qreal frameRate = 0.0) +static GstCaps *resolutionToCaps(const QSize &resolution, + qreal frameRate = 0.0, + QVideoFrame::PixelFormat pixelFormat = QVideoFrame::Format_Invalid) { - GstCaps *caps = QGstUtils::videoFilterCaps(); + GstCaps *caps = 0; + if (pixelFormat == QVideoFrame::Format_Invalid) + caps = QGstUtils::videoFilterCaps(); + else + caps = QGstUtils::capsForFormats(QList() << pixelFormat); if (!resolution.isEmpty()) { gst_caps_set_simple( @@ -281,75 +299,92 @@ static GstCaps *resolutionToCaps(const QSize &resolution, qreal frameRate = 0.0) void CameraBinSession::setupCaptureResolution() { - QSize resolution = m_imageEncodeControl->imageSettings().resolution(); - { - GstCaps *caps = resolutionToCaps(resolution); -#if CAMERABIN_DEBUG - qDebug() << Q_FUNC_INFO << "set image resolution" << resolution << caps; -#endif - g_object_set(m_camerabin, IMAGE_CAPTURE_CAPS_PROPERTY, caps, NULL); - if (caps) - gst_caps_unref(caps); - } + QSize viewfinderResolution = m_viewfinderSettings.resolution(); + qreal viewfinderFrameRate = m_viewfinderSettings.maximumFrameRate(); + QVideoFrame::PixelFormat viewfinderPixelFormat = m_viewfinderSettings.pixelFormat(); + const QSize imageResolution = m_imageEncodeControl->imageSettings().resolution(); + const QSize videoResolution = m_videoEncodeControl->actualVideoSettings().resolution(); + + // WrapperCameraBinSrc cannot have different caps on its imgsrc, vidsrc and vfsrc pads. + // If capture resolution is specified, use it also for the viewfinder to avoid caps negotiation + // to fail. + if (m_usingWrapperCameraBinSrc) { + if (m_captureMode == QCamera::CaptureStillImage && !imageResolution.isEmpty()) + viewfinderResolution = imageResolution; + else if (m_captureMode == QCamera::CaptureVideo && !videoResolution.isEmpty()) + viewfinderResolution = videoResolution; + + // Make sure we don't use incompatible frame rate and pixel format with the new resolution + if (viewfinderResolution != m_viewfinderSettings.resolution() && + (!qFuzzyIsNull(viewfinderFrameRate) || viewfinderPixelFormat != QVideoFrame::Format_Invalid)) { + + enum { + Nothing = 0x0, + OnlyFrameRate = 0x1, + OnlyPixelFormat = 0x2, + Both = 0x4 + }; + quint8 found = Nothing; + + for (int i = 0; i < m_supportedViewfinderSettings.count() && !(found & Both); ++i) { + const QCameraViewfinderSettings &s = m_supportedViewfinderSettings.at(i); + if (s.resolution() == viewfinderResolution) { + if ((qFuzzyIsNull(viewfinderFrameRate) || s.maximumFrameRate() == viewfinderFrameRate) + && (viewfinderPixelFormat == QVideoFrame::Format_Invalid || s.pixelFormat() == viewfinderPixelFormat)) + found |= Both; + else if (s.maximumFrameRate() == viewfinderFrameRate) + found |= OnlyFrameRate; + else if (s.pixelFormat() == viewfinderPixelFormat) + found |= OnlyPixelFormat; + } + } - const QSize viewfinderResolution = m_viewfinderSettingsControl->resolution(); - resolution = m_videoEncodeControl->actualVideoSettings().resolution(); - qreal framerate = m_videoEncodeControl->videoSettings().frameRate(); - { - GstCaps *caps = resolutionToCaps( - !resolution.isEmpty() ? resolution : viewfinderResolution, framerate); -#if CAMERABIN_DEBUG - qDebug() << Q_FUNC_INFO << "set video resolution" << resolution << caps; -#endif - g_object_set(m_camerabin, VIDEO_CAPTURE_CAPS_PROPERTY, caps, NULL); - if (caps) - gst_caps_unref(caps); + if (found & Both) { + // no-op + } else if (found & OnlyPixelFormat) { + viewfinderFrameRate = qreal(0); + } else if (found & OnlyFrameRate) { + viewfinderPixelFormat = QVideoFrame::Format_Invalid; + } else { + viewfinderPixelFormat = QVideoFrame::Format_Invalid; + viewfinderFrameRate = qreal(0); + } + } } - if (!viewfinderResolution.isEmpty()) - resolution = viewfinderResolution; + GstCaps *caps = resolutionToCaps(imageResolution); + g_object_set(m_camerabin, IMAGE_CAPTURE_CAPS_PROPERTY, caps, NULL); + gst_caps_unref(caps); - { - GstCaps *caps = resolutionToCaps(resolution); -#if CAMERABIN_DEBUG - qDebug() << Q_FUNC_INFO << "set viewfinder resolution" << resolution << caps; -#endif - g_object_set(m_camerabin, VIEWFINDER_CAPS_PROPERTY, caps, NULL); - if (caps) - gst_caps_unref(caps); - - GstElement *mfw_v4lsrc = 0; - if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSrc), "video-source")) { - GstElement *videoSrc = 0; - g_object_get(G_OBJECT(m_videoSrc), "video-source", &videoSrc, NULL); - if (videoSrc) { - const char *name = gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(gst_element_get_factory(videoSrc))); - if (!qstrcmp(name, "mfw_v4lsrc")) - mfw_v4lsrc = videoSrc; - } - } + qreal framerate = m_videoEncodeControl->videoSettings().frameRate(); + caps = resolutionToCaps(videoResolution, framerate); + g_object_set(m_camerabin, VIDEO_CAPTURE_CAPS_PROPERTY, caps, NULL); + gst_caps_unref(caps); - if (mfw_v4lsrc) { - int capMode = 0; - if (resolution == QSize(320, 240)) - capMode = 1; - else if (resolution == QSize(720, 480)) - capMode = 2; - else if (resolution == QSize(720, 576)) - capMode = 3; - else if (resolution == QSize(1280, 720)) - capMode = 4; - else if (resolution == QSize(1920, 1080)) - capMode = 5; - g_object_set(G_OBJECT(mfw_v4lsrc), "capture-mode", capMode, NULL); - - const qreal maxFps = m_viewfinderSettingsControl->maximumFrameRate(); - if (!qFuzzyIsNull(maxFps)) { - int n, d; - gst_util_double_to_fraction(maxFps, &n, &d); - g_object_set(G_OBJECT(mfw_v4lsrc), "fps-n", n, NULL); - g_object_set(G_OBJECT(mfw_v4lsrc), "fps-d", d, NULL); - } + caps = resolutionToCaps(viewfinderResolution, viewfinderFrameRate, viewfinderPixelFormat); + g_object_set(m_camerabin, VIEWFINDER_CAPS_PROPERTY, caps, NULL); + gst_caps_unref(caps); + + // Special case when using mfw_v4lsrc + if (m_videoSrc && qstrcmp(gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(gst_element_get_factory(m_videoSrc))), "mfw_v4lsrc") == 0) { + int capMode = 0; + if (viewfinderResolution == QSize(320, 240)) + capMode = 1; + else if (viewfinderResolution == QSize(720, 480)) + capMode = 2; + else if (viewfinderResolution == QSize(720, 576)) + capMode = 3; + else if (viewfinderResolution == QSize(1280, 720)) + capMode = 4; + else if (viewfinderResolution == QSize(1920, 1080)) + capMode = 5; + g_object_set(G_OBJECT(m_videoSrc), "capture-mode", capMode, NULL); + + if (!qFuzzyIsNull(viewfinderFrameRate)) { + int n, d; + gst_util_double_to_fraction(viewfinderFrameRate, &n, &d); + g_object_set(G_OBJECT(m_videoSrc), "fps-n", n, NULL); + g_object_set(G_OBJECT(m_videoSrc), "fps-d", d, NULL); } } @@ -395,28 +430,31 @@ GstElement *CameraBinSession::buildCameraSource() #if CAMERABIN_DEBUG qDebug() << Q_FUNC_INFO; #endif - if (!m_videoInputHasChanged) - return m_videoSrc; - m_videoInputHasChanged = false; + if (!m_inputDeviceHasChanged) + return m_cameraSrc; - GstElement *videoSrc = 0; + m_inputDeviceHasChanged = false; + m_usingWrapperCameraBinSrc = false; - if (!videoSrc) - g_object_get(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, &videoSrc, NULL); + GstElement *camSrc = 0; + g_object_get(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, &camSrc, NULL); if (m_sourceFactory) - m_videoSrc = gst_element_factory_create(m_sourceFactory, "camera_source"); + m_cameraSrc = gst_element_factory_create(m_sourceFactory, "camera_source"); // If gstreamer has set a default source use it. - if (!m_videoSrc) - m_videoSrc = videoSrc; + if (!m_cameraSrc) + m_cameraSrc = camSrc; - if (m_videoSrc && !m_inputDevice.isEmpty()) { + if (m_cameraSrc && !m_inputDevice.isEmpty()) { #if CAMERABIN_DEBUG qDebug() << "set camera device" << m_inputDevice; #endif + const char *const cameraSrcName = gst_plugin_feature_get_name( + GST_PLUGIN_FEATURE(gst_element_get_factory(m_cameraSrc))); + m_usingWrapperCameraBinSrc = qstrcmp(cameraSrcName, "wrappercamerabinsrc") == 0; - if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSrc), "video-source")) { + if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_cameraSrc), "video-source")) { GstElement *src = 0; /* QT_GSTREAMER_CAMERABIN_VIDEOSRC can be used to set the video source element. @@ -458,24 +496,25 @@ GstElement *CameraBinSession::buildCameraSource() if (src) { g_object_set(G_OBJECT(src), "device", m_inputDevice.toUtf8().constData(), NULL); - g_object_set(G_OBJECT(m_videoSrc), "video-source", src, NULL); + g_object_set(G_OBJECT(m_cameraSrc), "video-source", src, NULL); + m_videoSrc = src; } - } else if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSrc), "camera-device")) { + } else if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_cameraSrc), "camera-device")) { if (m_inputDevice == QLatin1String("secondary")) { - g_object_set(G_OBJECT(m_videoSrc), "camera-device", 1, NULL); + g_object_set(G_OBJECT(m_cameraSrc), "camera-device", 1, NULL); } else { - g_object_set(G_OBJECT(m_videoSrc), "camera-device", 0, NULL); + g_object_set(G_OBJECT(m_cameraSrc), "camera-device", 0, NULL); } } } - if (m_videoSrc != videoSrc) - g_object_set(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, m_videoSrc, NULL); + if (m_cameraSrc != camSrc) + g_object_set(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, m_cameraSrc, NULL); - if (videoSrc) - gst_object_unref(GST_OBJECT(videoSrc)); + if (camSrc) + gst_object_unref(GST_OBJECT(camSrc)); - return m_videoSrc; + return m_cameraSrc; } void CameraBinSession::captureImage(int requestId, const QString &fileName) @@ -588,7 +627,7 @@ void CameraBinSession::setDevice(const QString &device) { if (m_inputDevice != device) { m_inputDevice = device; - m_videoInputHasChanged = true; + m_inputDeviceHasChanged = true; } } @@ -600,7 +639,7 @@ void CameraBinSession::setAudioInput(QGstreamerElementFactory *audioInput) void CameraBinSession::setVideoInput(QGstreamerElementFactory *videoInput) { m_videoInputFactory = videoInput; - m_videoInputHasChanged = true; + m_inputDeviceHasChanged = true; } bool CameraBinSession::isReady() const @@ -648,6 +687,28 @@ void CameraBinSession::setViewfinder(QObject *viewfinder) } } +QList CameraBinSession::supportedViewfinderSettings() const +{ + return m_supportedViewfinderSettings; +} + +QCameraViewfinderSettings CameraBinSession::viewfinderSettings() const +{ + return m_status == QCamera::ActiveStatus ? m_actualViewfinderSettings : m_viewfinderSettings; +} + +void CameraBinSession::ViewfinderProbe::probeCaps(GstCaps *caps) +{ + // Update actual viewfinder settings on viewfinder caps change + const GstStructure *s = gst_caps_get_structure(caps, 0); + const QPair frameRate = QGstUtils::structureFrameRateRange(s); + session->m_actualViewfinderSettings.setResolution(QGstUtils::structureResolution(s)); + session->m_actualViewfinderSettings.setMinimumFrameRate(frameRate.first); + session->m_actualViewfinderSettings.setMaximumFrameRate(frameRate.second); + session->m_actualViewfinderSettings.setPixelFormat(QGstUtils::structurePixelFormat(s)); + session->m_actualViewfinderSettings.setPixelAspectRatio(QGstUtils::structurePixelAspectRatio(s)); +} + void CameraBinSession::handleViewfinderChange() { //the viewfinder will be reloaded @@ -755,6 +816,8 @@ void CameraBinSession::unload() if (m_busy) emit busyChanged(m_busy = false); + m_supportedViewfinderSettings.clear(); + setStatus(QCamera::UnloadedStatus); } @@ -1010,6 +1073,9 @@ bool CameraBinSession::processBusMessage(const QGstreamerMessage &message) setStatus(QCamera::UnloadedStatus); break; case GST_STATE_READY: + if (oldState == GST_STATE_NULL) + updateSupportedViewfinderSettings(); + setMetaData(m_metaData); setStatus(QCamera::LoadedStatus); break; @@ -1329,6 +1395,54 @@ QList CameraBinSession::supportedResolutions(QPair rate, return res; } +void CameraBinSession::updateSupportedViewfinderSettings() +{ + m_supportedViewfinderSettings.clear(); + + GstCaps *supportedCaps = 0; + + // When using wrappercamerabinsrc, get the supported caps directly from the video source element. + // This makes sure we only get the caps actually supported by the video source element. + if (m_videoSrc) { + GstPad *pad = gst_element_get_static_pad(m_videoSrc, "src"); + if (pad) { + supportedCaps = qt_gst_pad_get_caps(pad); + gst_object_unref(GST_OBJECT(pad)); + } + } + + // Otherwise, let the camerabin handle this. + if (!supportedCaps) + g_object_get(G_OBJECT(m_camerabin), SUPPORTED_VIEWFINDER_CAPS_PROPERTY, &supportedCaps, NULL); + + // Convert caps to QCameraViewfinderSettings + if (supportedCaps) { + supportedCaps = qt_gst_caps_normalize(supportedCaps); + + for (uint i = 0; i < gst_caps_get_size(supportedCaps); i++) { + const GstStructure *structure = gst_caps_get_structure(supportedCaps, i); + + QCameraViewfinderSettings s; + s.setResolution(QGstUtils::structureResolution(structure)); + s.setPixelFormat(QGstUtils::structurePixelFormat(structure)); + s.setPixelAspectRatio(QGstUtils::structurePixelAspectRatio(structure)); + + QPair frameRateRange = QGstUtils::structureFrameRateRange(structure); + s.setMinimumFrameRate(frameRateRange.first); + s.setMaximumFrameRate(frameRateRange.second); + + if (!s.resolution().isEmpty() + && s.pixelFormat() != QVideoFrame::Format_Invalid + && !m_supportedViewfinderSettings.contains(s)) { + + m_supportedViewfinderSettings.append(s); + } + } + + gst_caps_unref(supportedCaps); + } +} + void CameraBinSession::elementAdded(GstBin *, GstElement *element, CameraBinSession *session) { GstElementFactory *factory = gst_element_get_factory(element); diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.h b/src/plugins/gstreamer/camerabin/camerabinsession.h index d4214a6..fa9dba9 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.h +++ b/src/plugins/gstreamer/camerabin/camerabinsession.h @@ -45,6 +45,7 @@ #endif #include +#include #include "qcamera.h" QT_BEGIN_NAMESPACE @@ -74,7 +75,6 @@ public: virtual GstElement *buildElement() = 0; }; - class CameraBinSession : public QObject, public QGstreamerBusMessageFilter, public QGstreamerSyncMessageFilter @@ -131,7 +131,6 @@ public: CameraBinImageProcessing *imageProcessingControl() const { return m_imageProcessingControl; } CameraBinCaptureDestination *captureDestinationControl() const { return m_captureDestinationControl; } CameraBinCaptureBufferFormat *captureBufferFormatControl() const { return m_captureBufferFormatControl; } - CameraBinViewfinderSettings *viewfinderSettingsControl() const { return m_viewfinderSettingsControl; } CameraBinRecorder *recorderControl() const { return m_recorderControl; } CameraBinContainer *mediaContainerControl() const { return m_mediaContainerControl; } @@ -146,6 +145,10 @@ public: QObject *viewfinder() const { return m_viewfinder; } void setViewfinder(QObject *viewfinder); + QList supportedViewfinderSettings() const; + QCameraViewfinderSettings viewfinderSettings() const; + void setViewfinderSettings(const QCameraViewfinderSettings &settings) { m_viewfinderSettings = settings; } + void captureImage(int requestId, const QString &fileName); QCamera::Status status() const; @@ -197,6 +200,7 @@ private: bool setupCameraBin(); void setupCaptureResolution(); void setAudioCaptureCaps(); + void updateSupportedViewfinderSettings(); static void updateBusyStatus(GObject *o, GParamSpec *p, gpointer d); static void elementAdded(GstBin *bin, GstElement *element, CameraBinSession *session); @@ -219,6 +223,9 @@ private: QGstreamerElementFactory *m_videoInputFactory; QObject *m_viewfinder; QGstreamerVideoRendererInterface *m_viewfinderInterface; + QList m_supportedViewfinderSettings; + QCameraViewfinderSettings m_viewfinderSettings; + QCameraViewfinderSettings m_actualViewfinderSettings; CameraBinControl *m_cameraControl; CameraBinAudioEncoder *m_audioEncodeControl; @@ -237,16 +244,30 @@ private: CameraBinImageProcessing *m_imageProcessingControl; CameraBinCaptureDestination *m_captureDestinationControl; CameraBinCaptureBufferFormat *m_captureBufferFormatControl; - CameraBinViewfinderSettings *m_viewfinderSettingsControl; QGstreamerBusHelper *m_busHelper; GstBus* m_bus; GstElement *m_camerabin; + GstElement *m_cameraSrc; GstElement *m_videoSrc; GstElement *m_viewfinderElement; GstElementFactory *m_sourceFactory; bool m_viewfinderHasChanged; - bool m_videoInputHasChanged; + bool m_inputDeviceHasChanged; + bool m_usingWrapperCameraBinSrc; + + class ViewfinderProbe : public QGstreamerBufferProbe { + public: + ViewfinderProbe(CameraBinSession *s) + : QGstreamerBufferProbe(QGstreamerBufferProbe::ProbeCaps) + , session(s) + {} + + void probeCaps(GstCaps *caps); + + private: + CameraBinSession * const session; + } m_viewfinderProbe; GstElement *m_audioSrc; GstElement *m_audioConvert; diff --git a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp index 6b2236c..8155c18 100644 --- a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Jolla Ltd. +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Toolkit. @@ -33,14 +34,14 @@ #include "camerabinviewfindersettings.h" - +#include "camerabinsession.h" QT_BEGIN_NAMESPACE -CameraBinViewfinderSettings::CameraBinViewfinderSettings(QObject *parent) - : QCameraViewfinderSettingsControl(parent), - m_minimumFrameRate(0), - m_maximumFrameRate(0) + +CameraBinViewfinderSettings::CameraBinViewfinderSettings(CameraBinSession *session) + : QCameraViewfinderSettingsControl(session) + , m_session(session) { } @@ -52,11 +53,11 @@ bool CameraBinViewfinderSettings::isViewfinderParameterSupported(ViewfinderParam { switch (parameter) { case Resolution: + case PixelAspectRatio: case MinimumFrameRate: case MaximumFrameRate: - return true; - case PixelAspectRatio: case PixelFormat: + return true; case UserParameter: return false; } @@ -67,13 +68,15 @@ QVariant CameraBinViewfinderSettings::viewfinderParameter(ViewfinderParameter pa { switch (parameter) { case Resolution: - return m_resolution; + return m_session->viewfinderSettings().resolution(); + case PixelAspectRatio: + return m_session->viewfinderSettings().pixelAspectRatio(); case MinimumFrameRate: - return m_minimumFrameRate; + return m_session->viewfinderSettings().minimumFrameRate(); case MaximumFrameRate: - return m_maximumFrameRate; - case PixelAspectRatio: + return m_session->viewfinderSettings().maximumFrameRate(); case PixelFormat: + return m_session->viewfinderSettings().pixelFormat(); case UserParameter: return QVariant(); } @@ -82,36 +85,28 @@ QVariant CameraBinViewfinderSettings::viewfinderParameter(ViewfinderParameter pa void CameraBinViewfinderSettings::setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value) { + QCameraViewfinderSettings settings = m_session->viewfinderSettings(); + switch (parameter) { case Resolution: - m_resolution = value.toSize(); + settings.setResolution(value.toSize()); + break; + case PixelAspectRatio: + settings.setPixelAspectRatio(value.toSize()); break; case MinimumFrameRate: - m_minimumFrameRate = value.toFloat(); + settings.setMinimumFrameRate(value.toReal()); break; case MaximumFrameRate: - m_maximumFrameRate = value.toFloat(); + settings.setMaximumFrameRate(value.toReal()); break; - case PixelAspectRatio: case PixelFormat: + settings.setPixelFormat(qvariant_cast(value)); case UserParameter: break; } -} - -QSize CameraBinViewfinderSettings::resolution() const -{ - return m_resolution; -} -qreal CameraBinViewfinderSettings::minimumFrameRate() const -{ - return m_minimumFrameRate; -} - -qreal CameraBinViewfinderSettings::maximumFrameRate() const -{ - return m_maximumFrameRate; + m_session->setViewfinderSettings(settings); } QT_END_NAMESPACE diff --git a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h index eea1df2..0180e6f 100644 --- a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h +++ b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Jolla Ltd. +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Toolkit. @@ -36,29 +37,23 @@ #include -#include - QT_BEGIN_NAMESPACE +class CameraBinSession; + class CameraBinViewfinderSettings : public QCameraViewfinderSettingsControl { Q_OBJECT public: - CameraBinViewfinderSettings(QObject *parent); + CameraBinViewfinderSettings(CameraBinSession *session); ~CameraBinViewfinderSettings(); bool isViewfinderParameterSupported(ViewfinderParameter parameter) const; QVariant viewfinderParameter(ViewfinderParameter parameter) const; void setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value); - QSize resolution() const; - qreal minimumFrameRate() const; - qreal maximumFrameRate() const; - private: - QSize m_resolution; - qreal m_minimumFrameRate; - qreal m_maximumFrameRate; + CameraBinSession *m_session; }; QT_END_NAMESPACE diff --git a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.cpp b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.cpp new file mode 100644 index 0000000..9e3c43f --- /dev/null +++ b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "camerabinviewfindersettings2.h" +#include "camerabinsession.h" + +QT_BEGIN_NAMESPACE + +CameraBinViewfinderSettings2::CameraBinViewfinderSettings2(CameraBinSession *session) + : QCameraViewfinderSettingsControl2(session) + , m_session(session) +{ + +} + +CameraBinViewfinderSettings2::~CameraBinViewfinderSettings2() +{ + +} + +QList CameraBinViewfinderSettings2::supportedViewfinderSettings() const +{ + return m_session->supportedViewfinderSettings(); +} + +QCameraViewfinderSettings CameraBinViewfinderSettings2::viewfinderSettings() const +{ + return m_session->viewfinderSettings(); +} + +void CameraBinViewfinderSettings2::setViewfinderSettings(const QCameraViewfinderSettings &settings) +{ + m_session->setViewfinderSettings(settings); +} + +QT_END_NAMESPACE + diff --git a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h new file mode 100644 index 0000000..9a0efd0 --- /dev/null +++ b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CAMERABINVIEWFINDERSETTINGS2_H +#define CAMERABINVIEWFINDERSETTINGS2_H + +#include + +QT_BEGIN_NAMESPACE + +class CameraBinSession; + +class CameraBinViewfinderSettings2 : public QCameraViewfinderSettingsControl2 +{ + Q_OBJECT +public: + CameraBinViewfinderSettings2(CameraBinSession *session); + ~CameraBinViewfinderSettings2(); + + QList supportedViewfinderSettings() const; + + QCameraViewfinderSettings viewfinderSettings() const; + void setViewfinderSettings(const QCameraViewfinderSettings &settings); + +private: + CameraBinSession *m_session; +}; + +QT_END_NAMESPACE + +#endif // CAMERABINVIEWFINDERSETTINGS2_H -- 2.7.4