diff options
Diffstat (limited to 'src/multimedia/gsttools_headers/qgstutils_p.h')
-rw-r--r-- | src/multimedia/gsttools_headers/qgstutils_p.h | 76 |
1 files changed, 68 insertions, 8 deletions
diff --git a/src/multimedia/gsttools_headers/qgstutils_p.h b/src/multimedia/gsttools_headers/qgstutils_p.h index 65ff759aa..d7e26ad82 100644 --- a/src/multimedia/gsttools_headers/qgstutils_p.h +++ b/src/multimedia/gsttools_headers/qgstutils_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** 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$ @@ -49,14 +49,32 @@ #include <QtCore/qset.h> #include <QtCore/qvector.h> #include <gst/gst.h> +#include <gst/video/video.h> #include <qaudioformat.h> #include <qcamera.h> +#include <qabstractvideobuffer.h> +#include <qvideoframe.h> +#include <QDebug> + +#if GST_CHECK_VERSION(1,0,0) +# define QT_GSTREAMER_PLAYBIN_ELEMENT_NAME "playbin" +# define QT_GSTREAMER_CAMERABIN_ELEMENT_NAME "camerabin" +# define QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME "videoconvert" +# define QT_GSTREAMER_RAW_AUDIO_MIME "audio/x-raw" +#else +# define QT_GSTREAMER_PLAYBIN_ELEMENT_NAME "playbin2" +# define QT_GSTREAMER_CAMERABIN_ELEMENT_NAME "camerabin2" +# define QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME "ffmpegcolorspace" +# define QT_GSTREAMER_RAW_AUDIO_MIME "audio/x-raw-int" +#endif QT_BEGIN_NAMESPACE class QSize; class QVariant; class QByteArray; +class QImage; +class QVideoSurfaceFormat; namespace QGstUtils { struct CameraInfo @@ -73,8 +91,12 @@ namespace QGstUtils { QSize capsResolution(const GstCaps *caps); QSize capsCorrectedResolution(const GstCaps *caps); QAudioFormat audioFormatForCaps(const GstCaps *caps); +#if GST_CHECK_VERSION(1,0,0) + QAudioFormat audioFormatForSample(GstSample *sample); +#else QAudioFormat audioFormatForBuffer(GstBuffer *buffer); - GstCaps *capsForAudioFormat(QAudioFormat format); +#endif + GstCaps *capsForAudioFormat(const QAudioFormat &format); void initializeGst(); QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList &codecs, @@ -86,9 +108,47 @@ namespace QGstUtils { QCamera::Position cameraPosition(const QString &device, GstElementFactory * factory = 0); int cameraOrientation(const QString &device, GstElementFactory * factory = 0); QByteArray cameraDriver(const QString &device, GstElementFactory * factory = 0); + + QSet<QString> supportedMimeTypes(bool (*isValidFactory)(GstElementFactory *factory)); + +#if GST_CHECK_VERSION(1,0,0) + QImage bufferToImage(GstBuffer *buffer, const GstVideoInfo &info); + QVideoSurfaceFormat formatForCaps( + GstCaps *caps, + GstVideoInfo *info = 0, + QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle); +#else + QImage bufferToImage(GstBuffer *buffer); + QVideoSurfaceFormat formatForCaps( + GstCaps *caps, + int *bytesPerLine = 0, + QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle); +#endif + + GstCaps *capsForFormats(const QList<QVideoFrame::PixelFormat> &formats); + void setFrameTimeStamps(QVideoFrame *frame, GstBuffer *buffer); + + void setMetaData(GstElement *element, const QMap<QByteArray, QVariant> &data); + void setMetaData(GstBin *bin, const QMap<QByteArray, QVariant> &data); + + GstCaps *videoFilterCaps(); + + QSize structureResolution(const GstStructure *s); + QVideoFrame::PixelFormat structurePixelFormat(const GstStructure *s, int *bpp = 0); + QSize structurePixelAspectRatio(const GstStructure *s); + QPair<qreal, qreal> 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); QT_END_NAMESPACE |