diff options
author | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2014-11-20 17:54:18 +0100 |
---|---|---|
committer | Andrew den Exter <andrew.den.exter@qinetic.com.au> | 2014-11-27 23:30:05 +0100 |
commit | 108dda7a90bd0f0337358b0db47ae55acd16dea6 (patch) | |
tree | e74c44c004b257fb99fdc96063641c76ac0426cf /src/multimedia/gsttools_headers/qgstutils_p.h | |
parent | 7e3d69668e3f04110a651dee1850a1d0c885947b (diff) |
GStreamer: port to 1.0.
0.10 is still used by default.
To enable GStreamer 1.0, pass GST_VERSION=1.0 to qmake
for qtmultimedia.pro.
Contributions from:
Andrew den Exter <andrew.den.exter@qinetic.com.au>
Ilya Smelykh <ilya@videoexpertsgroup.com>
Jim Hodapp <jim.hodapp@canonical.com>
Sergio Schvezov <sergio.schvezov@canonical.com>
Change-Id: I72a46d1170a8794a149bdb5e20767afcc5b7587c
Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
Diffstat (limited to 'src/multimedia/gsttools_headers/qgstutils_p.h')
-rw-r--r-- | src/multimedia/gsttools_headers/qgstutils_p.h | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/src/multimedia/gsttools_headers/qgstutils_p.h b/src/multimedia/gsttools_headers/qgstutils_p.h index 65ff759aa..71a0a57f4 100644 --- a/src/multimedia/gsttools_headers/qgstutils_p.h +++ b/src/multimedia/gsttools_headers/qgstutils_p.h @@ -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,40 @@ 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, + 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(); + } void qt_gst_object_ref_sink(gpointer object); +GstCaps *qt_gst_pad_get_current_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); + +QDebug operator <<(QDebug debug, GstCaps *caps); QT_END_NAMESPACE |