aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-10-17 14:17:47 +0200
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-10-25 07:05:40 +0000
commit28fa0a6baba7a79ce85f8d62c2c296aa9f98de4c (patch)
tree21710a832be622ab1c2c7ed3aceebac9b1bac1ec
parente52ebf296e8fcd84fa4055c80a3c489ae1431c9e (diff)
Add inject-code for QVideoFrame::bits()
Since QVideoFrame::bits() returns uchar* which is not covered by conversion functions, added the same replacement as was done for QImage::bits(). It should return a buffer object to satisfy Shiboken::Buffer::checkType(). Fixes: PYSIDE-849 Change-Id: I33bdb13f3b892f325ccf3b1ef4bef59744b60f2d Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r--sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml3
-rw-r--r--sources/pyside2/PySide2/glue/qtmultimedia.cpp7
2 files changed, 10 insertions, 0 deletions
diff --git a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
index 95a29cbb8..3667b2c55 100644
--- a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
+++ b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
@@ -92,6 +92,9 @@
<value-type name="QVideoFrame">
<enum-type name="FieldType"/>
<enum-type name="PixelFormat"/>
+ <modify-function signature="bits()">
+ <inject-code file="../glue/qtmultimedia.cpp" snippet="qvideoframe-bits"/>
+ </modify-function>
<modify-function signature="bits(int)" remove="all"/>
<modify-function signature="bits(int)const" remove="all"/>
</value-type>
diff --git a/sources/pyside2/PySide2/glue/qtmultimedia.cpp b/sources/pyside2/PySide2/glue/qtmultimedia.cpp
index 5a3f3a5e7..cbe1367cb 100644
--- a/sources/pyside2/PySide2/glue/qtmultimedia.cpp
+++ b/sources/pyside2/PySide2/glue/qtmultimedia.cpp
@@ -44,3 +44,10 @@ QObject * upcastedArg = %CONVERTTOCPP[QObject *](%PYARG_1);
%CPPSELF.%FUNCTION_NAME(reinterpret_cast< %ARG1_TYPE >(upcastedArg));
%END_ALLOW_THREADS
// @snippet upcast
+
+// @snippet qvideoframe-bits
+%BEGIN_ALLOW_THREADS
+%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME();
+%END_ALLOW_THREADS
+%PYARG_0 = Shiboken::Buffer::newObject(%0, %CPPSELF.bytesPerLine() * %CPPSELF.height(), Shiboken::Buffer::ReadWrite);
+// @snippet qvideoframe-bits