summaryrefslogtreecommitdiffstats
path: root/src/qtmultimediaquicktools/qsgvideonode_texture.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move the texture uploading code into Qt MultimediaLars Knoll2021-04-071-212/+0
| | | | | | | | | | Qt Multimedia has now some generic helper functions to upload the video data into textures. This way, we can greatly simplify the rendering code in qtmultimediaquicktools. Change-Id: I5b0e3eb96cbcf79fe5e9757697f11b0183132b17 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move the shaders from the quick tools into QtMultimediaLars Knoll2021-04-071-3/+3
| | | | | | | | | | | | | The shader layout is pretty generic, and QVideoSurfaceFormat can give us both the shaders and uniform data that we need to render the video. All the user needs to do then is to provide geometry with a 2D texture coordinate to render the video onto any surface. Change-Id: I95006eaf4a6f039006b8a5da0f53143da03e1ecb Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* More work to enable HW decoding for Qt QuickLars Knoll2021-04-071-1/+1
| | | | | | | | | | | | | | | | | Request GL textures from the pipeline for now. Some initial code to also use the texture upload meta functionality in gstreamer, but that will require some more work so we don't make the GL context current in the wrong thread. The gstreamer VAAPI elements on AMD hardware (or in general...) seem to have some bugs. Converting a VASurface to a GL texture using the texture upload meta doesn't create an ARGB texture as promised, but does write some YUV data into the texture. And trying to map a SW buffer received from the VAAPI decoders fails. Change-Id: I9b629eb84f3f32adc23ae2e2fd1cd3e42e6afbc0 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move the PixelFormat enum from QVideoFrame to QVideoSurfaceFormatLars Knoll2021-04-061-10/+10
| | | | | | Change-Id: Ifa888c74c397c640b19387a9ce624dfcf8269c2c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Remove the handle type from QVideoSurfaceFormatLars Knoll2021-04-061-21/+8
| | | | | | | | | This is a property of the individual QVideoFrame, and doesn't belong here. Change-Id: I85f180ff46023f6a48ef856a356d9c45c3f6be1b Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Move HandleType and MapMode from QAbstractVideoBuffer to QVideoFrameLars Knoll2021-03-161-4/+4
| | | | | | | | | | QAbstractVideoBuffer is a class that is only required inside our implementation, so we can make it private. This change prepares for it. Change-Id: I4ba4542c1eab742f2fc93231e2e5063dbc5d5e94 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Modernize code baseLars Knoll2021-03-021-6/+2
| | | | | | | | | | | Use clang-modernize to modernize the code base * Use = default where applicable * Use nullptr Change-Id: I88b307e76b7f7dde090354ff4b292cea76f5c60c Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Coding style cleanupsLars Knoll2021-01-211-1/+1
| | | | | | | | Do some coding style fixes proposed by clang-tidy. Change-Id: I62584767fd7af2f98ac02653c1105d64188f5554 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Modernize code baseLars Knoll2021-01-211-5/+5
| | | | | | | | | Run clang-tidy over the code base with some code modernization options. Change-Id: I9e74d1225bce333e74224e3b92c02c7e9884d8f5 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Quick: Always create sg textures in ctor()VaL Doroshchuk2020-08-301-2/+1
| | | | | | | Since compare() can be called before updateUniformData() Change-Id: I7a1e0a08926cbf6d5629468b8bf64dcd7602b399 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Update dependencies on 'dev' in qt/qtmultimediaVaL Doroshchuk2020-06-301-1/+1
| | | | | Change-Id: I463d3a1541cee1fcf4a6b6d1e2e1eac85fbfc682 Reviewed-by: Val Doroshchuk <valentyn.doroshchuk@qt.io>
* Quick: Allow to build with -no-openglVaL Doroshchuk2020-06-101-2/+12
| | | | | Change-Id: I927998b9ffa80a324636855c5dcc92cb57e9d520 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Introduce QAbstractVideoBuffer::MTLTextureHandleVal Doroshchuk2020-06-101-2/+4
| | | | | | | | | | | | | | | | Added MTLTextureHandle to render metal textures. Is used by default if rhi is enabled for metal backend. Also fixed the frame renderer to create new opengl context and use provided one from the video surface as a share context. To remember, when the quick item is created and updatePaintNode is called, current gl context is set to the video surface as a property. When the frame renderer is ready, it extracts the gl context and uses it as a share one. Task-number: QTBUG-78678 Change-Id: I51ce666ca7c2adc10dd2c1d1dfed99cc9f596e2b Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* RHI: Remove gl code from video nodesVaL Doroshchuk2020-06-041-125/+14
| | | | | | | | Now QSGMaterialShader handles rhi textures too. Task-number: QTBUG-78678 Change-Id: I410185c80bd104741fd5b52deeb87eb97531410a Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Quick: Add support of RHI for video framesVaL Doroshchuk2020-05-291-1/+77
| | | | | | | | Added RHI shaders for RGB*, YUV* and opengl texture video frames. Task-number: QTBUG-78678 Change-Id: I045d6a806fea059a80b8e5d9817b6997af8d0f41 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Remove ANGLEVaL Doroshchuk2020-05-281-4/+2
| | | | | | | Since it is already removed from qtbase Change-Id: If3a8169705b57d2e39167e2f718524cf3fe8bb1e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Update qtbase dependencyFriedemann Kleint2020-03-251-1/+1
| | | | | | | | | - Adapt to QOpenGLWidgets split - Use new Q_MOC_INCLUDE directive where required - Fix QtConcurrent usage Change-Id: I9de650ae4fbbd397ef4fd4650c8aa5a0443d566f Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
* Remove Format_ABGR32 from supported formats for sq texture video nodeVaL Doroshchuk2019-10-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Format_ABGR32 was introduced together with gst opengl support. And is supposed to be used with QT_GSTREAMER_USE_OPENGL_PLUGIN=1, Which should be fine for Raspberry Pi, but suddenly does not work for iMX boards. RPI's omxh264dec provides buffers in RGBA format, and corresponding textures will be created using GL_RGBA. Since we return Format_ABGR32 as supported format, which is RGBA, no conversion is needed and everything was ok. But for iMX, imxvpudec provides buffers in I420 format. And textures will be created using GL_RED with only 1 plane. Following patch https://bugzilla.gnome.org/show_bug.cgi?id=779067 requests RGBA too. Since incaps contains I420 and RGBA, and we say that we support RGBA, this leads to use buffers in I420 but *passthrough* in gst_gl_color_convert_element_prepare_output_buffer(). Since incaps and outcaps contain the same video format. No conversion will be done there and textures will be rendered incorrectly. Removing support of Format_ABGR32 from texture video node will cause to ignore requested RGBA from DIRECTVIV and perform converting, I420->BGRx on iMX and RGBA->BGRA on RPI. QT_GSTREAMER_USE_OPENGL_PLUGIN should be used together with decoders that use gpu memory. Otherwise some converting/uploading operations will be done which will also introduce some performance issues, so not recommended to be used for iMX. Change-Id: I8f037316c40587c81b2116c43a7262c6a70a5b44 Fixes: QTBUG-78855 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Gstreamer: Introduce support of OpenGL pluginVaL Doroshchuk2019-05-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since uploading to gl texture is quite performance-wise operation introduced integration of opengl plugin which can provide a way to avoid uploading to texture on each draw on qt's side. Which potentially fixes some performance issues especially on embedded devices. Added glupload and glcolorconvert gst elements to pipeline. For qml apps current opengl context is provided to the gst plugin to share opengl data with. It allows at the end to just use gl textures that created and filled inside the gst. For overlay apps, glimagesink element is added. Requires gstreamer-gl-1.0 to be installed. Since this plugin is almost always available, so enabling it by default will break behavior of current pipeline and might introduce some side effects. Thus also provided QT_GSTREAMER_USE_OPENGL_PLUGIN env var to explicitly enable OpenGL features from gst. After this change video frames will be texture based. But it is still possible to map frames to download their data. In case if the video surface does not support gl textures, glmemory will be anyway requested, which will lead to uploading data, downloading and uploading it again to textures in scene graph video node. Task-number: QTBUG-66162 Change-Id: I32044ba0bf0c0cf90434d72f8991ad00927e1380 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* QML: Use alpha channel for ARGB32 video framesVaL Doroshchuk2017-12-221-3/+12
| | | | | | | | | | | | Added a fix to use alpha channel for ARGB32 video frames. Previously alpha component was always ignored and used 1.0 instead. To see transparent videos it is still needed to enable blending by adjusting an opacity property of qml element. Task-number: QTBUG-43098 Change-Id: If3aaf8ab695021b3a49a1790d900366e9c336b33 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Add missing override and remove redundant virtualAlexander Volkov2016-12-121-6/+6
| | | | | Change-Id: Ifd439abf21877adff57080489324bea729ee5279 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
* Implement YUV 4:2:2 8bit support for QtQuickSamuel Gaist2016-04-291-1/+1
| | | | | | | | | | | This patch implements support for rendering of UYVY and YUYV sources when using QtQuick for preview. [ChangeLog][QtQuick][Rendering] Support for YUV 4:2:2 8bit has been implemented for the QtQuick viewfinder. Change-Id: I4d98f3c44240ee53f7708bc6bd84e7fb83aac069 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
* Updated license headersAntti Kokko2016-01-191-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I324f65c61171f36641472964d095d72e452afb3a Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix some private headers.Yoann Lopes2015-11-241-1/+1
| | | | | | | | | - Add missing "We mean it" comment - Add missing '_p' suffix for QtMultimediaQuick_p headers Task-number: QTBUG-49480 Change-Id: I1fd4f8b2fdffecebaebaedaf1b78e1da62c08156 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Fix video nodes material comparison.Yoann Lopes2015-07-201-0/+4
| | | | | | | | | Don't consider a material equal to another when their texture IDs are not available yet. Change-Id: Id4127d71abb2db33950a206dc722b24ab626e960 Task-number: QTBUG-47205 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Minor refactor of built-in QSGVideoNodes.v5.5.0-beta1Yoann Lopes2015-04-301-57/+25
| | | | | | | | | | | - Load shader source from resource files. - Correctly report material types: each material can use different shaders depending on the video pixel format but it was reporting a unique material type. This was causing the node to keep using the same shader even if its pixel format changed. Change-Id: Ib903ecd6e7dd1dd56d7cefe255ab7049933df17d Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Update copyright headersAntti Kokko2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I1c6faa4f59f8eca54f01ef20941fa60161dd7872 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
* Add video filtering support to VideoOutputLaszlo Agocs2015-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Add the QAbstractVideoFilter base class and integrate it with VideoOutput. This can be used to perform arbitrary filtering or image processing on the frames of a video stream of a VideoOutput element right before the OpenGL texture is provided to the scenegraph by the video node. This opens up the possibility to integrate computer vision frameworks or accelerated image processing with Qt Quick applications that display video streams using Qt Multimedia. Conceptually it is somewhat similar to QVideoProbe, this approach however allows modifying the frame, in real time with tight integration to the scenegraph node, and targets Qt Quick meaning setting up the filter and processing the results of the computations happen completely in QML. [ChangeLog] Added QAbstractVideoFilter that serves as a base class for QML video filtering elements that integrate compute, vision, and image processing frameworks with VideoOutput. Change-Id: Ice1483f8c2daec5a43536978627a7bbb64549480 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
* Update license headers and add new license filesAntti Kokko2014-08-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: Ied06887225df341064c12bcc14c259ae74116f2e Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Support dynamic opengl32 - ANGLE switching on WindowsLaszlo Agocs2014-07-291-11/+12
| | | | | | Change-Id: I38532db3ab0ad4fcb8dbabd0cbb528f7d8e4ba06 Reviewed-by: Andrew Knight <andrew.knight@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Allow plugins to override the QML VideoOutput type.Andrew den Exter2014-01-201-0/+271
Move QDeclarativeVideoOutput to the private QtMultimediaQuickTools library to make the QDeclarativeVideoOutputBackend interface implementable by a plugin. Change-Id: I763c483a1fc9ec56dc7b8be0bc71523f029a36ee Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>