Add another missing part of gstreamer patch

This commit is contained in:
Jan Grulich 2015-06-03 17:17:00 +02:00
parent 26040f2507
commit 0d7b6d3d66

View File

@ -1404,10 +1404,28 @@ index a373dcc..8011349 100644
GstElement *QGstreamerVideoWindow::videoSink() GstElement *QGstreamerVideoWindow::videoSink()
diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp
index 465f439..b1161f7 100644 index 465f439..3b1de44 100644
--- a/src/gsttools/qgstutils.cpp --- a/src/gsttools/qgstutils.cpp
+++ b/src/gsttools/qgstutils.cpp +++ b/src/gsttools/qgstutils.cpp
@@ -83,15 +83,24 @@ static void addTagToMap(const GstTagList *list, @@ -40,9 +40,17 @@
#include <QtCore/qsize.h>
#include <QtCore/qset.h>
#include <QtCore/qstringlist.h>
+#include <QtGui/qimage.h>
#include <qaudioformat.h>
#include <QtCore/qelapsedtimer.h>
+#include <QtMultimedia/qvideosurfaceformat.h>
+
+#include <gst/audio/audio.h>
+#include <gst/video/video.h>
+
+template<typename T, int N> static int lengthOf(const T (&)[N]) { return N; }
+
#ifdef USE_V4L
# include <private/qcore_unix_p.h>
# include <linux/videodev2.h>
@@ -83,15 +91,24 @@ static void addTagToMap(const GstTagList *list,
map->insert(QByteArray(tag), g_value_get_boolean(&val)); map->insert(QByteArray(tag), g_value_get_boolean(&val));
break; break;
case G_TYPE_CHAR: case G_TYPE_CHAR:
@ -1432,7 +1450,7 @@ index 465f439..b1161f7 100644
if (g_date_valid(date)) { if (g_date_valid(date)) {
int year = g_date_get_year(date); int year = g_date_get_year(date);
int month = g_date_get_month(date); int month = g_date_get_month(date);
@@ -170,6 +179,42 @@ QSize QGstUtils::capsCorrectedResolution(const GstCaps *caps) @@ -170,6 +187,42 @@ QSize QGstUtils::capsCorrectedResolution(const GstCaps *caps)
return size; return size;
} }
@ -1475,7 +1493,7 @@ index 465f439..b1161f7 100644
/*! /*!
Returns audio format for caps. Returns audio format for caps.
If caps doesn't have a valid audio format, an empty QAudioFormat is returned. If caps doesn't have a valid audio format, an empty QAudioFormat is returned.
@@ -177,9 +222,26 @@ QSize QGstUtils::capsCorrectedResolution(const GstCaps *caps) @@ -177,9 +230,26 @@ QSize QGstUtils::capsCorrectedResolution(const GstCaps *caps)
QAudioFormat QGstUtils::audioFormatForCaps(const GstCaps *caps) QAudioFormat QGstUtils::audioFormatForCaps(const GstCaps *caps)
{ {
@ -1504,7 +1522,7 @@ index 465f439..b1161f7 100644
if (qstrcmp(gst_structure_get_name(structure), "audio/x-raw-int") == 0) { if (qstrcmp(gst_structure_get_name(structure), "audio/x-raw-int") == 0) {
@@ -250,16 +312,28 @@ QAudioFormat QGstUtils::audioFormatForCaps(const GstCaps *caps) @@ -250,16 +320,28 @@ QAudioFormat QGstUtils::audioFormatForCaps(const GstCaps *caps)
} else { } else {
return QAudioFormat(); return QAudioFormat();
} }
@ -1535,7 +1553,7 @@ index 465f439..b1161f7 100644
QAudioFormat QGstUtils::audioFormatForBuffer(GstBuffer *buffer) QAudioFormat QGstUtils::audioFormatForBuffer(GstBuffer *buffer)
{ {
GstCaps* caps = gst_buffer_get_caps(buffer); GstCaps* caps = gst_buffer_get_caps(buffer);
@@ -270,7 +344,7 @@ QAudioFormat QGstUtils::audioFormatForBuffer(GstBuffer *buffer) @@ -270,7 +352,7 @@ QAudioFormat QGstUtils::audioFormatForBuffer(GstBuffer *buffer)
gst_caps_unref(caps); gst_caps_unref(caps);
return format; return format;
} }
@ -1544,7 +1562,7 @@ index 465f439..b1161f7 100644
/*! /*!
Builds GstCaps for an audio format. Builds GstCaps for an audio format.
@@ -278,8 +352,32 @@ QAudioFormat QGstUtils::audioFormatForBuffer(GstBuffer *buffer) @@ -278,8 +360,32 @@ QAudioFormat QGstUtils::audioFormatForBuffer(GstBuffer *buffer)
Caller must unref GstCaps. Caller must unref GstCaps.
*/ */
@ -1578,7 +1596,7 @@ index 465f439..b1161f7 100644
GstStructure *structure = 0; GstStructure *structure = 0;
if (format.isValid()) { if (format.isValid()) {
@@ -314,6 +412,7 @@ GstCaps *QGstUtils::capsForAudioFormat(QAudioFormat format) @@ -314,6 +420,7 @@ GstCaps *QGstUtils::capsForAudioFormat(QAudioFormat format)
} }
return caps; return caps;
@ -1586,7 +1604,7 @@ index 465f439..b1161f7 100644
} }
void QGstUtils::initializeGst() void QGstUtils::initializeGst()
@@ -585,10 +684,629 @@ QByteArray QGstUtils::cameraDriver(const QString &device, GstElementFactory *fac @@ -585,10 +692,629 @@ QByteArray QGstUtils::cameraDriver(const QString &device, GstElementFactory *fac
return QByteArray(); return QByteArray();
} }
@ -2217,7 +2235,7 @@ index 465f439..b1161f7 100644
gst_object_ref_sink(object); gst_object_ref_sink(object);
#else #else
g_return_if_fail (GST_IS_OBJECT(object)); g_return_if_fail (GST_IS_OBJECT(object));
@@ -604,4 +1322,50 @@ void qt_gst_object_ref_sink(gpointer object) @@ -604,4 +1330,50 @@ void qt_gst_object_ref_sink(gpointer object)
#endif #endif
} }