summaryrefslogtreecommitdiffstats
path: root/src/multimedia/platform/gstreamer/common
Commit message (Collapse)AuthorAgeFilesLines
* Fix a deadlock when changing the video outputLars Knoll2021-05-261-0/+5
| | | | | | | | | | | | | | | | | Changing the videooutput and deleting the mediaplayer directly afterwards could lead to a deadlock, as the videosink was blocking on a pad and then calling a slot on the main thread using a blocking queued connection. If the main thread was changing the state of the gst pipeline at the same time, this could lead to a deadlock. Avoid it by pausing the pipeline before changing the video output. Change-Id: I0d0cbad0ab97a4eb83dd3c66c664c01de3b0ea90 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Reduce the timeout for sync state changes in gstreamer to 1 secLars Knoll2021-05-211-2/+2
| | | | | | | | | | Waiting for 10 secs was ok for development, but we should really never have to wait that long. Change-Id: Ie10b22984948df6ccd7a1004ba10e50f415fe69e Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fixes for qaudiooutput on gstreamerLars Knoll2021-05-202-2/+11
| | | | | | | | | | | | Add a queue element into the pipeline to decouple things between input and output. Add ability to suspend/resume the QGstAppSrc. This finally makes the autotest pass consistently. Change-Id: Ib20d1f9e6932aa9459085ad46fe78fdd03749723 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Cleanup the QMediaEncoder backend architectureLars Knoll2021-05-191-0/+2
| | | | | | | | | | | QPlatformMediaEncoder should not be a QObject, as with the other backend classes. Instead, the class now tracks some state to simplify the implementation of the platform dependent code and emits the signals for the frontend. Change-Id: Iec45638de4333cb9e88f89c448194b49a5de0e1e Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix a memory leak in gstreamerLars Knoll2021-05-181-1/+7
| | | | | | Change-Id: I663c1f1de4fe6ca25f4f6aa353084701d2c9751d Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix a crash in QGstAppSrc when using pull modeLars Knoll2021-05-181-6/+6
| | | | | | | | | In this case m_stream is a nullptr, make sure we never access it. Change-Id: I095d18fc99a60bc9b5cd9fe1bc33b7879f109c8a Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Fix a crash in the gstreamer audio outputLars Knoll2021-05-181-4/+13
| | | | | | | | | | | Closing the audio output would delete the pipeline, and would lead to deleting the GstAppSrc from within QGstAppSrc::pushData(). Speed up the qsoundeffect autotest (this uncovered the issue). Change-Id: I3c5843854f5a74d563eb271df553c8a1a5854f63 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* gstreamer: fix compilation without gstreamer_glSamuli Piippo2021-05-171-1/+4
| | | | | | | Add ifdef guards to compile correctly when gstreamer_gl is not available. Change-Id: I483081db018e45068b720f41c3a418d943891873 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix a number of compiler warnings/errors when using gccLars Knoll2021-05-142-1/+3
| | | | | | Change-Id: Ifa7bcd4507948cd61909a11af203852ee1586787 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make sure Qt Multimedia compiles against 6.1Lars Knoll2021-05-141-0/+2
| | | | | | | | | | | | | | To keep Qt Multimedia compiling against 6.1 will help people that want to test the module using a released version of Qt. This disables usage of the P010 and P016 video formats on gstreamer, as RHI doesn't yet support the texture types we need to render them correctly. Change-Id: I009f0b37951072b1d6e671dbdd4bb7b33767226a Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add support for selecting the camera formatLars Knoll2021-05-103-0/+52
| | | | | | | | | Only implemented on gstreamer right now. Make it possible to define a specific format that the camera shouls be using. Change-Id: I588e75600f8915d8693c111381dae8dcd8973cbc Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix most qcamerabackend autotests on gstreamerLars Knoll2021-05-102-6/+4
| | | | | | | | | | | * Properly emit all image capturing signals * Create meta data and write it to the image * Skip tests if there's no camera available * Skip tests if a required feature is not supported Change-Id: I621a8413848d7017aa131ee6dd31071000ef46b1 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix compilation on LinuxLars Knoll2021-05-071-0/+3
| | | | | Change-Id: Id058ad0ba34bf3810a09591dd51cddedbda7c2e2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix a bug that would lead to interruped audio playbackLars Knoll2021-05-071-2/+3
| | | | | | | | | The time calculation to tag GstBuffer objects in the QGstAppSrc was wrong. Change-Id: I86eaa14a0b52985fa25310df5e32224812b5b369 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Pass the remaining mediaplayerbackend autotestsLars Knoll2021-05-076-22/+93
| | | | | | | | | | | | | | | * Add a notification mechanism to the pipeline so the video output knows when QMediaPlayer is in a stopped state (using QProperty), as we want the pipeline to be in a paused state internally, but not get preroll frames if we're in paused externally. * Properly emit metadataChanged() signals, and ensure we're in GST_STATE_PAUSED before trying a seek. Change-Id: I1cad557e648f82909a63cba8d6144df8476524f5 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up the GstPipeline wrapper classLars Knoll2021-05-0710-291/+272
| | | | | | | | | | | | | Merge it with the old bus helper class and put it into a file of it's own. This will allow us to add additional properties to the pipeline that can be seen by all places using it. Change-Id: I79ef1d10c30dd7b109b89e180009306f672aacdc Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Pass more media player autotests on gstreamerLars Knoll2021-05-032-69/+93
| | | | | | | | | | | | Fix a couple of more autotests and do better state and status handling. Move keeping track of state changes into the platform independent code. Change-Id: If401af6cfa2707ce7c7184cf9baff76a60dd41ff Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Initialize variableLars Knoll2021-05-031-1/+1
| | | | | | | | This caused a crash in the mediaplayerbackend autotest. Change-Id: I4b610cba310872d22531287eaf58c7934feb486a Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Fix reference counting of the negotiated capsLars Knoll2021-05-031-1/+1
| | | | | | | | | This avoids some critical gstreamer errors, where refcounting was off. Change-Id: I1e5495d92d47f2f49c92fa3f2d9e059010a59fe9 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Smaller code cleanup in the gstreamer media playerLars Knoll2021-05-032-4/+12
| | | | | | Change-Id: Id51e1f5d00afdc71e4629e528eb086b724ab4598 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Get rid of some bogus warnings and debug messagesLars Knoll2021-05-031-2/+0
| | | | | | Change-Id: Ie6230c79fa6517575ae2f1baca94319882abdb3b Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Cleanup status handling in QMediaPlayerLars Knoll2021-05-032-86/+18
| | | | | | | | | | | | | Remove the UnknownMediaStatus enum (it's really not helpful) and avoid storing a copy of the status in the frontend class. Store the status in the platform media player instance. This requires some further cleanups to avoid that the reimplementations store their own copy. Change-Id: I939e78808f0eaa6a398560661df66c9d986fdd91 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix the remaining tst_qaudiooutput failures on gstreamerLars Knoll2021-05-032-15/+14
| | | | | | | | | | Some streamlinking of the test code and a couple of fixes in the gstreamer backend so it behaves in all corner cases. Change-Id: Id9f00449dc1dfd9973d68a72d5b276692666713b Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Cleanup and refactor QGstAppSrcLars Knoll2021-05-036-194/+155
| | | | | | | | | | | | | Clean up the code in QGstAppSrc. Use the new QGst* classes, and move creation of the GstAppSrc into the class by default. We still need a way to use an externally defined app src for playbin support in the audio decoder, so still allow that. Adjust usages of the API in all places. Change-Id: Ibcad7e4c836ca9572dfc3d8ed17b7f1980913619 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix part of the QAudioOutput test failures on gstreamerLars Knoll2021-05-032-15/+52
| | | | | | Change-Id: I016a84cdfcc93cee4c8c7b1b3c50588644a94566 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* GStreamer: Correctly handle cameras that only provide JPEGLars Knoll2021-04-281-0/+2
| | | | | | | | | | | Some cameras only provide JPEG encoded images to gstreamer and no raw video data. Detect that case by checking the GstCaps of the camera element we load and put a jpeg decoder into the pipeline if required. Change-Id: Ib1e2b3525f05bbb9acbdb6dccd38fc877f31acb9 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Remove qmake files from the repositoryLars Knoll2021-04-231-32/+0
| | | | | | Change-Id: I1131b555014a57e3224a8871de4cb1d01c406fd1 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Fix issues with incorrect video sizes for windowed renderingLars Knoll2021-04-192-8/+17
| | | | | | | | | | Only set the render rectangle that gstreamer should use once we have set up the window id. Otherwise, this will lead to weird sizes being used by gstreamer. Change-Id: Id643761cb8eda574831c816d49e9b17ffe80d33e Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix gstreamer camera after the latest changesLars Knoll2021-04-191-3/+3
| | | | | | | | | There are still some smaller issues left, but this seems to get at least something working again. Change-Id: Id1b3a153ec7ed20ea724ee80f8eb7e7651215ac4 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Various reliability bugfixesLars Knoll2021-04-197-103/+9
| | | | | | | | | Fix crashes due to dangling pointers. On gstreamer avoid using message filters when we do not need them. Change-Id: I1bce271dda4b5efb3913954deb719542288b9b12 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix brightness and friends with xvimagesinkLars Knoll2021-04-191-4/+4
| | | | | | | | The properties are int based, not double based. Change-Id: Ie81cc6ed7fccb0edc07ef811b694012d9b6cc1c0 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* API cleanups in QMediaPlayerLars Knoll2021-04-162-11/+11
| | | | | | | | | Rename some methods with better names and adjust the API so that it also can be used for QML. Change-Id: Ica19675966680416fbe870808336d8fc82065bc1 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Better error handling for gstreamerLars Knoll2021-04-163-2/+9
| | | | | | | | Handle a couple of error cases without crashing. Change-Id: Id4e2e1197bc7daa0351130117ed07e7a9c6fb9fa Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Remove the graphicsType enum from QVideoSinkLars Knoll2021-04-162-24/+2
| | | | | | | | | This is redundant, as we can determine the type from whether we have a native window id or an RHI handle set on the sink. Change-Id: I7795e2f1d504fb7df107d1a402ae55adff33d05b Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up QVideoSink and it's platform implementationLars Knoll2021-04-164-213/+40
| | | | | | | | | | | | * Normalize ranges of brightness and friends to [-1, 1] and use floating point numbers. * Remove getters for values from the platform API, rather store them in the frontend. This simplifies the work that needs to be done on the backend side. Change-Id: I8d63dacaa6b2873b33e17fcd7831e41173109a7e Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Remove unused methodLars Knoll2021-04-164-18/+0
| | | | | | | QPlatformVideoSink: :repaint() was unused, remove it. Change-Id: I75fb43a3c6e9f8166ae22dbd8705d78da1e502c8 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Rename QVideoSurfaceFormat to QVideoFrameFormatLars Knoll2021-04-145-73/+73
| | | | | | | | | The class is used exclusively together with video frames to describe their format, so the name should reflect that. Change-Id: I10bec7a0556b22c69ac790a99282e1376ce4af97 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove the notifyInterval() functionalityLars Knoll2021-04-081-1/+1
| | | | | | | | | This was nothing else than a timer, something you can just as well implement on top of Qt Multimedia if required. Change-Id: I1ef362f1f4ad5a5f85e92bfbb1d73b7710271e5c Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix audio device switching on Linux in the audiooutput exampleLars Knoll2021-04-081-1/+1
| | | | | | Change-Id: I5a6f8392352b212fb4741d4253c16874f7db6581 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove 16bit RGB pixel formatsLars Knoll2021-04-082-8/+0
| | | | | | | | | | We can't handle them efficiently on old OpenGL 2 based hardware. As YUV formats are usually preferred, we should not have problems simply removing those. Change-Id: Ibee483302cdada9d4d46c18196c6cee5d9945ae2 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Various fixes to the shader codeLars Knoll2021-04-081-8/+6
| | | | | | | | | | | | | | | Tested all formats that could be tested through gstreamer and ensured our shaders to the right thing. Required adding a width uniform, so we can pick the correct Y value for YUYV non planar formats. The IMC formats should work, but are untested as gstreamer does not support them. Change-Id: Ib0fe0a7c7d97eb81a75f636c752a85f51a327183 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove endian specific surface formatsLars Knoll2021-04-082-6/+4
| | | | | | | | | For 16bit data, we only support the platforms native endianness. Change-Id: Ic04097125622715e6847d568551d572cd317b674 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove packed pixel formats that can't be HW acceleratedLars Knoll2021-04-082-9/+0
| | | | | | | | | | | Remove 24bit packed pixel formats, as those would require unpacking on the CPU to be able to be processed efficiently on the GPU side. As such, they are not really formats that should be used for uncompressed video. Change-Id: I29c8b87aeaf97aee13ea2b93afd5115741198eee 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-0713-103/+158
| | | | | | | | | | | | | | | | | 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>
* Start adding infrastructure to retrieve video frames as textureLars Knoll2021-04-061-3/+3
| | | | | | | | | | | | | | | We're using RHI here, as that's what we need for Qt Quick anyway. You can now set a QRhi object on QVideoSink. This can then be used internally to create textures of the required format instead of memory buffers. QVideoSurfaceFormat will now tell you how many planes are required for the format, and you can retrieve the textures for each plane from QVideoFrame. Change-Id: I86430db60a8f1aba07ec3b38e22b977cdaefaa0a 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-064-87/+87
| | | | | | Change-Id: Ifa888c74c397c640b19387a9ce624dfcf8269c2c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* QVideoFrame should be constructed with a QSurfaceFormatLars Knoll2021-04-061-4/+1
| | | | | | | | | | | | | This was inconsistent so far. QVideoFrame had half the properties of QVideoSurfaceFormat, but was missing some parts that are required to render the frame properly. Giving it a QVideoSurfaceFormat means that the QVideoFrame is self describing and can be rendered without additional information. Change-Id: Idb2757ee6a29020bd72c9c50891309ee8d8a8bfc Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove the handle type from QVideoSurfaceFormatLars Knoll2021-04-063-8/+6
| | | | | | | | | 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>
* Remove all uses of QAbstractVideoSurface from the gstreamer backendLars Knoll2021-04-066-152/+47
| | | | | | Change-Id: I3c8a9b6354edd8d9a593ee51aed71912efcf66ba Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Clean up QAbstractVideoSurface usages in the gstreamer backendLars Knoll2021-04-065-50/+76
| | | | | | Change-Id: I352c03233f6c1c34747709ebf154564a626594e5 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>