summaryrefslogtreecommitdiffstats
path: root/src/multimedia
Commit message (Collapse)AuthorAgeFilesLines
* GStreamer: add private API to access pipeline for capture sessionHEADdevTim Blechmann57 min.6-37/+82
| | | | | | | | | | | | | Allows users to mess with the underlying gstreamer pipeline of the `QMediaCaptureSession` like they can with the `QMediaPlayer` [ChangeLog] QMediaCaptureSession: GStreamer - private interface to access underlying GstPipeline of QMediaCaptureSession Pick-to: 6.5 6.6 6.7 Task-number: QTBUG-123830 Change-Id: I5b17240c9951ee8e05dd6cb4a78b203a56794922 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Manage media backend lifetime using Q_APPLICATION_STATICJøger Hansegård15 hours1-40/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch reworks lifetime management of the Qt media backend to use a plain Q_APPLICATION_STATIC instead of a hybrid between a Q_APPLICATION_STATIC and a Q_GLOBAL_STATIC. This hybrid mechanism tolerated creating the Qt media backend before a QApplication was instantiated. This was considered necessary because Qt example code for enumerating media devices previously demonstrated this without a QApplication. Unfortunately, the hybrid mechanism prevented maintenance of the Q_APPLICATION_STATIC implementation, and was on its own complex to understand and maintain. By switching to lifetime management using Q_APPLICATION_STATIC, we may break debug builds of legacy applications that enumerate media devices without having a QApplication, but we consider this an unlikely scenario. We have updated Qt documentation to state that a Qt application object is required to access any Qt Multimedia APIs (9cf4494d49170eafb9c179d5304c0a70eaf25b96), and error logging is improved to make developers aware of this requirement (c2b1fb925798f5a87b21891dcf18cd967436de3e). We are now making this requirement harder by asserting in debug. With this change, legacy applications that use Qt Multimedia APIs without having a Qt application object will assert in debug builds. Release builds will for now continue to work as before, but with extra error logging. [ChangeLog][Changed lifetime management of the Qt Media backend. The Qt media backend lifetime is now always bound to a Qt application object, and Qt Multimedia APIs require that a Qt application object exists before use. Using Qt multimedia APIs without a Qt application object will assert in debug builds and result in undefined behavior in release builds.] Fixes: QTBUG-124577 Task-number: QTBUG-120198 Task-number: QTBUG-124578 Change-Id: I2b9864d8ee3dc937a80796891ff13854ce8968ee Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Add since 6.8 to a new QVideoFrame constructor documentationArtem Dyomin15 hours1-0/+1
| | | | | | Change-Id: I4f2fd9194a718f061d9c1a43cc69c73c4d5f1805 Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* CMake: fix styleTim Blechmann35 hours1-2/+2
| | | | | | | | | by removing the space after `if` `endif` Pick-to: 6.5 6.7 Change-Id: I5fdec78af7e92d4f5a88ad79feca222cfeb5b7d1 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Ensure that EGL::EGL is promoted to global for the standalone QtMultimedia ↵Alexey Edelev39 hours1-1/+5
| | | | | | | | | builds Pick-to: 6.5 6.6 6.7 Change-Id: If3914fcfc52033bc377d47153bdd1a7f4ac1b401 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Tim Blechmann <tim@klingt.org>
* Update QML Media PlayerEd Cooke3 days1-1/+0
| | | | | | | | | | | | | | | | | Rewrite the QML media player with a new UI. Changes include: * Remove the menu bar and replace it with popups for file importing and track selection. * Replace the playback rate slider with +/- 10 second buttons and a playback rate combo box. * Add a timer to hide the playback controls when the mouse has been idle for 3 seconds. * Add a button to toggle between single play or infinite loop. * Add a layout for mobile using responsive layouts. Fixes: QTBUG-118474 Pick-to: 6.6 6.7 Change-Id: I0496766a79287e9eabd6f7aff8392a8ea0706920 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Add missing 'focusModeChanged' property notificationArtem Dyomin5 days1-1/+1
| | | | | | | | | | | | Notifying is need for the correct update of the property dependencies in qml. Pick-to: 6.7 6.5 6.2 Change-Id: I31426c799c3d996b0b02b0bcfe24446bf4e78c2d Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lars Sutterud <lars.sutterud@qt.io> Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
* Add missing implementation for QWaveDecoder::setIODeviceDoris Verria5 days1-0/+4
| | | | | | | | | | | | QWaveDecoder defines setIODevice but the implementation is missing. This was giving missing symbol errors for Python bindings. Add an empty implementation for now to avoid those. Pick-to: 6.7 6.5 6.2 Change-Id: I8ed41df6ccc3075dd79292a28a18f73dbd4d145e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Document how to configure and build Qt MultimediaJøger Hansegård7 days2-0/+97
| | | | | | | | | | | Building Qt Multimedia with full feature support requires FFmpeg and the build process is currently not well documented. This patch aims at making it easier to build Qt Multimedia. Fixes: QTBUG-118713 Pick-to: 6.7 6.5 Change-Id: I4d4086b4d83445a40a6d9ea6b0bc6eccee05af6f Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Pulseaudio: replace toQString methods with qDebug overloadsTim Blechmann9 days5-70/+82
| | | | | | | | | Reduces visual noise of the tracing code and avoids run-time unicode conversions. Pick-to: 6.5 6.7 Change-Id: I083896fcd37e0fd2ebf91da90eda4ef6729dd49d Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* pulseaudio: separate out error getter functionsTim Blechmann9 days5-17/+37
| | | | | | | | | | | | * returning as `QUtf8StringView` allows us to enforce the character encoding with the type system * replacing .arg with << to reduce noise in tracing code / avoid qstring conversions Fixes: QTBUG-123447 Pick-to: 6.5 6.7 Change-Id: I53fcc289ebbeca1dd7628a1609cae7e9f6154c77 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* QString: replace QString(QLatin1String( with QStringLiteralTim Blechmann9 days3-9/+5
| | | | | | | Pick-to: 6.5 6.7 Change-Id: If303e563967318134ba141d5d9878a3b9b66cca0 Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* pulseaudio: clean up string handlingTim Blechmann9 days1-42/+47
| | | | | | | | | | | | * silence QT_ASCII_CAST_WARN warnings by wrapping c strings in QLatin1StringView / QString::fromUtf8 * use string literals to create strings to avoid utf16 conversions at run-time Pick-to: 6.5 6.7 Change-Id: I38a217dd21bc48108a55b32ae2ac2770f273306f Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Enable HDR based on video frame format for QtWidgetsPavel Dubsky10 days3-2/+48
| | | | | | | | | | | | | Currently swap chain is configured for SDR or HDR only on creation and there is no support for dynamic change when video is played using QVideoWindow. This change adds check that determines whether video frame contains SDR or HDR content and reconfigures swap chain (and subsequently shaders) if needed. Fixes: QTBUG-120963 Pick-to: 6.7 6.6 6.5 Change-Id: I8eef9b46b3999e00427cc50f82486cea7cd80e09 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* QAudioDecoder: fix unit tests for GStreamerTim Blechmann10 days6-48/+116
| | | | | | | | | | | | | | | When setting a QUrl with an empty scheme, we need to set the file:// pattern for uridecodebin. This has been done for QMediaPlayer in the past, but not for QAudioDecoder. Compare: 8a3806f6263f56b5be5b557e321b9b13d1913d5f To keep consistency with QMediaPlayer, we introduce a QAudioDecoderPrivate class. Pick-to: 6.5 6.7 Task-number: QTBUG-96985 Change-Id: If954a04a003aecb0f862a7e5041ead43e4c9d259 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Prevent lost D3D11 device with QVideoFrame::toImage() with Qt QuickJøger Hansegård10 days2-2/+2
| | | | | | | | | | | | | | | | | | This patch ensures that QFFmpeg::TextureConverter is only used to convert frames when the destination QRhi instance is the same as the one it was initialized on. If QVideoFrame::toImage() is called from the main thread while the frame is also being rendered in the Qt Quick render thread, QVideoFrame::toImage() will create its own QRhi instance. In this case we need to disable direct texture transfer of the QFFmpeg textures, and instead fall back to mapping the texture data through CPU memory. Task-number: QTBUG-113627 Pick-to: 6.7 6.5 Change-Id: I3184796d05627fcac1a069400e8a6a5879fcd5bc Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* utils: factor `qMediaFromUserInput` out of QMediaPlayerTim Blechmann2024-04-103-5/+17
| | | | | | | | | | `qMediaFromUserInput` resolves a local file and adds a `file://` prefix if necessary, which is required by gstreamer. Factoring it out so that it can be used from other places. Pick-to: 6.5 6.6 6.7 Change-Id: I6323198913d349269169b6d36712456efbca0253 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Add QVideoFrame constructor that converts from QImageJøger Hansegård2024-04-093-0/+48
| | | | | | | | | | | | | | | This new constructor simplifies creating QVideoFrame instances from a QImage, and is an enabler for capturing custom images to a video or send custom images to video output. This API change is based on draft in ea057257bd68f53aa4b201ddb4ad1986c5cc84e8 [ChangeLog] Added QVideoFrame constructor that converts from QImage Fixes: QTBUG-122099 Change-Id: If023738fd397ae393564b1857d711115909ac418 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Darwin: Replace deprecated kAudioObjectPropertyElementMaster constantTim Blechmann2024-04-092-7/+10
| | | | | | | | `Master` has been renamed to `Main`. Pick-to: 6.5 6.7 Change-Id: I3b114cd241712ab4832c9e4845c3af025ab42c6b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* strings: use QStringLiteral instead of fromUtf8Tim Blechmann2024-04-098-20/+20
| | | | | | | | This avoids run-time unicode conversions. Pick-to: 6.5 6.6 6.7 Change-Id: Ief6aa32288b300ee05232e7372b6f701562194fc Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* CMake: don't disable gstreamer if gstreamer_gl is not availableTim Blechmann2024-04-061-1/+1
| | | | | | | | | | | It was a wrong assumption that `QGstVideoBuffer` requires gl, but it seems that `QGstVideoBuffer::map` is used as fallback in that case. Fixes: QTBUG-124115 Pick-to: 6.5 6.6 6.7 Change-Id: I1c5af8ed9fd0c71cde288e2cc10869767ae895c6 Reviewed-by: Mikko Gronoff <mikko.gronoff@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Fix ABI breakage wrt QAudioSink/Source::stateChanged signalsVolker Hilsheimer2024-04-057-79/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amends edaec2bf714c98d65f12c8ed9a2ffbd1603635a7, which removed the QAudioSink/Source::stateChanged(QAudio::State) symbols from the API, thus breaking binary compatibility to Qt 6.6. Since moc-generated code compares pointer-to-member- functions, we cannot bring that symbol back and still have such connections work. The only reasonable way to fix this is to reverse the namespace aliasing: QAudio is the real namespace, QtAudio becomes an alias. All symbols are then exported with the QAudio type in their signature, even if declared with QtAudio types as parameters, so we don't need any removed_api tricks to bring the old symbols back. We just need to trick qdoc into seeing the namespace as QtAudio, which is trivial and has no ABI implications. The previous caveat that string-based connections need to use QAudio doesn't change with this. [ChangeLog][Binary Compatibility Note] Qt 6.7.0 broke binary compatibility by renaming the QAudio namespace to QtAudio. Qt 6.7.1 restores compatibility with previous Qt 6 versions again by making QtAudio an alias for the QAudio namespace, but breaks BC with 6.7.0. Code previously built against 6.7.0 needs to be recompiled. Pick-to: 6.7 Fixes: QTBUG-123997 Change-Id: I456db61ff0bd1d97af7ce2d2a7968999d891a84d Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* platform integration: add getter for current backendTim Blechmann2024-04-052-3/+11
| | | | | | | | | Allows application code (and unit tests) to resolve the current backend Pick-to: 6.5 6.6 6.7 Change-Id: Ie4b9b9cf47557c66f7929071ac23be19a031aecc Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Clean up qpulseaudiosource.cppMikko Hallamaa2024-04-051-75/+93
| | | | | | | | | | Clean up qpulseaudiosource.cpp code to conform with clang_format, and add intermediate variables to break up long lines. Pick-to: 6.7 6.6 6.5 Change-Id: I948106414c540eb7cf12f0c5dddc068fbcc2b38d Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* PulseAudio: Replace C style casts with static_castMikko Hallamaa2024-04-052-9/+9
| | | | | | | | | This patch replaces C style casts with static_cast in QPulseAudiosource. Pick-to: 6.7 6.6 6.5 Change-Id: I58ad5434a698f21245b253021b2397815ccbf8bc Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Tighten ownership of video buffers in QVideoFrameJøger Hansegård2024-04-042-6/+4
| | | | | | | | | | Switch to std::unique_ptr to prevent future lifetime management bugs Task-number: QTBUG-122099 Pick-to: 6.7 6.6 6.5 Change-Id: I453915a135e07dd175bf3632724a3d7d8200b47d Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Select capture device format with max frame rateTimur Pocheptsov2024-04-041-2/+2
| | | | | | | | | | As documented for QCameraFormat. Pick-to: 6.7 6.6 6.5 6.2 Fixes: QTBUG-123451 Change-Id: I251672b66118dcfa7b3fe6d338299ae3a4f2d2c9 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* PulseAudio: Streamline resetting source on start() callsMikko Hallamaa2024-04-041-16/+2
| | | | | | | | | | This patch replaces the audio source deletion and close() call in start() calls of QPulseAudioSource with a single reset() call. Audio source is deleted in close(). Pick-to: 6.7 6.6 6.5 Change-Id: I6fc48cc347404a33992c89ca9223f0366808e140 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* PulseAudio: Refactor to use categorized loggingMikko Hallamaa2024-04-044-122/+127
| | | | | | | | | | | | | QPulseAudioSink was earlier refactored to use categorized logging, but QPulseAudioSource and QPulseAudioEngine still used the DEBUG_PULSE expression. This patch adds new logging categories for input and engine, and updates these classes to use them. Pick-to: 6.7 6.6 6.5 Change-Id: I8a2486700f20c7575c2d858e405caa4c9a875c55 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* wasm: Update webassembly docsLorn Potter2024-04-021-27/+6
| | | | | | | | | | | Remove example code as QVideoWidget now works and there is no need to point out to use QGraphicsView. Mention QMediaDevices signals are used when devices list is ready. Pick-to: 6.7 Change-Id: Ie9eed969d3712e9db9166b8e4deaa68ba85f3b0e Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Document deployment of dynamically linked FFmpeg on WindowsJøger Hansegård2024-04-011-0/+13
| | | | | | | | | | With latest versions of Qt, FFmpeg is dynamically linked into the FFmpeg multimedia backend. This patch documents how this change impacts deployment of Qt applications that uses this backend. Pick-to: 6.7 6.7.0 6.6 6.5 Change-Id: I3d374bebc1ee069ce6f170e669a230fc1dfaf391 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: remove relic of restarting playback after new source is setTim Blechmann2024-03-291-1/+1
| | | | | | | | | | | | | `QGstreamerMediaPlayer::setMedia` tried to restart the playback state if the playback was running before setting them media. However `QMediaPlayer::setSource` explicitly stops the playback. Removing the code and documenting the setSource behavior in the public documentation Pick-to: 6.5 6.6 6.7 Change-Id: I03722afc2bb6f87f79c005a3b64ca7e036ac27f2 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Tie Qt Multimedia backend lifetime to Qt Application lifetimeJøger Hansegård2024-03-282-11/+59
| | | | | | | | | | | | | | | | | | | | | | | This patch uses a specialized application static variable to tie backend lifetime to the Qt application lifetime if an application is present. This ensures that system resources are released before static destruction, and prevents abrupt termination on Windows during static destruction. This is according to Windows Media Foundation's documentation that states that WMF classes shall not be released during static destruction. If Qt Multimedia features are used without a Qt Application object, the lifetime of the multimedia backend remains as before, and destruction takes place as part of static destruction. As a side effect, this change fixes a crash if Qt Multimedia features are used after recreating the Qt Application. Fixes: QTBUG-120198 Pick-to: 6.7 6.6 6.5 Change-Id: I570743d6462e27630d8f29dc60cfa414c8cbc17d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Document that FFmpeg 6.1.1 is used by the FFmpeg multimedia backendJøger Hansegård2024-03-261-1/+1
| | | | | | Pick-to: 6.7 6.6 6.5 Change-Id: I93a6a4f24fa5901babb8075aaffb640a66f245aa Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Correct license for documentation filesLucie Gérard2024-03-268-8/+8
| | | | | | | | | | | | According to QUIP-18 [1], all documentation files should be LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: Ibce2017c3a42fa806bb1602317e580b29575dc16 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Change license for tool filesLucie Gérard2024-03-261-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all tool files should be LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: Iaf62416538ec630520630d84c588d19cdb4c5ddf Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Correct license for example and snippet filesLucie Gérard2024-03-268-8/+8
| | | | | | | | | | | | According to QUIP-18 [1], all example and snippet files should be LicenseRef-Qt-Commercial OR BSD-3-Clause [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I16a226b797329a9ce962732a97fd1af84ab22cda Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Get SPDX license tag on one line onlyLucie Gérard2024-03-262-4/+2
| | | | | | | | | If spread on two lines, the license test does not read the entire tag Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I2703440020b36ea2838034d50a7e03aa2404fc4a Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* CMake: use gstreamer "feature" only when egl/gstreamer_gl are availableTim Blechmann2024-03-251-6/+7
| | | | | | | | | | | | The GStreamer plugin requires gstreamer_gl/egl for video output. Tying the CMake feature to both gstreamer and gstreamer_gl would allow devs to compile the gstreamer plugin on all platforms where the implementation is reasonably feature-complete. Pick-to: 6.5 6.6 6.7 Change-Id: I51162ade8e167dfc6ea4e2117609d9ef39b8de4d Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io>
* Video - rename ALIGN to QT_MEDIA_ALIGNTim Blechmann2024-03-254-6/+6
| | | | | | | | | | ALIGN clashes with the macos macro of the same name as defined in `usr/include/i386/param.h` Pick-to: 6.5 6.6 6.7 Change-Id: I58ca673f38c75f1976d96dbb72bb494ae7e8036e Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io>
* Use std::addressof to get the address of QMaybe wrapped typeJøger Hansegård2024-03-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | Using QMaybe with types that overloads operator& can have unintended effects because QMaybe::operator-> would call the overload. This could cause problems with types such as WRL::ComPtr which resets its pointer when taking its address. To ensure that we get the address of the instance, we should use std::addressof instead of calling operator& to get the wrapped object's address. This fixes an issue where QMaybe<ComPtr> resets the COM pointer and returns nullptr when attempting to extract the raw interface pointer like this: QMaybe<ComPtr<Interface>, HRESULT> instance = foo(); Interface *rawIf = instance->Get(); // Reset instance and return 0 Pick-to: 6.7 6.6 6.5 Change-Id: I544dec6dc0cf59c2b3a46fe6d9ebbf08aac80737 Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Reset error when calling QPulseAudioSource::reset()Mikko Hallamaa2024-03-211-1/+2
| | | | | | | | | | | | | QPulseAudioSource::reset() called stop() which changes the state to Stopped without resetting any possible error and then calls close(). This patch changes reset() to reset the error to NoError, and then calls close(). This behavior is the same as in QPulseAudioSink::reset(). Pick-to: 6.7 6.6 6.5 Change-Id: If5e1a189812fbbfbd39e43948bb5b07955997224 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* PulseAudio: Clean up readable byte amount logicMikko Hallamaa2024-03-212-30/+16
| | | | | | | | | | | This patch cleans up the logic in QPulseAudioSource by calling pa_stream_readable_size() directly in bytesReady() instead of keeping around a member variable that needs to be kept updated. Pick-to: 6.7 6.6 6.5 Change-Id: Ia8de889ff0805f43b302745cf3b5f1c98b68b71f Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Use QAudioStateMachine for state handling in PulseAudio sourceMikko Hallamaa2024-03-212-80/+34
| | | | | | | | | | | | | | The PulseAudio source used internal variables for state and error updates, which are liable to data races if accessed from different threads without protection. This patch updates this to use QAudioStateMachine that enables atomic state transitions to prevent possible data races. Pick-to: 6.7 6.6 6.5 Change-Id: Ia24399184765a9852e665224ee9678c99f1c92e0 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Use QBasicTimer in QPulseAudioSourceMikko Hallamaa2024-03-202-8/+16
| | | | | | | | | | Replace QTimer with the more light-weight QBasicTimer in QPulseAudioSource. Pick-to: 6.7 6.6 6.5 Change-Id: I47a10c5cbed1a5fcd8c771b190faf3112ca0ad93 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Propagate output QIODevice from QMediaRecorder to the recording engineArtem Dyomin2024-03-202-4/+11
| | | | | | | Task-number: QTBUG-121827 Change-Id: I4b44003aaccc95243ead5fd8cdf1a3250f3d5e3b Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Add outputDevice to the API of QMediaRecorderArtem Dyomin2024-03-202-0/+31
| | | | | | | | | | | | | | Currently, QMediaRecorder writes data to QUrl, it should handle QIODevice as well. The patch adds empty methods and basic documentation. The documentation is to be updated later on, during implementation. Task-number: QTBUG-114675 Task-number: QTBUG-121827 Change-Id: Ie807fc5547459b0e42869ea40c30c2dfa3a097cc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Add a proper guarding of windows related includesAlexey Edelev2024-03-201-2/+2
| | | | | | | | | | | | Guard the QWindowsMediaDevices usage with the 'wmf' feature, since the feature is not necessarly present on all windows platforms. Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-123215 Change-Id: Ib1faa52ad04535726eb65a4bfb4e60b96029de76 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix mapping of QVideoFrame in write modeArtem Dyomin2024-03-192-4/+14
| | | | | | | | | | | | | | | | After mapping of QVideoFrame with a write mode, we get this: - the hw frame in QFFmpegVideoBuffer is not valid anymore - the cached QImage is not valid anymore The implemented approach might be revisited if we decide to implement copy-on-modify idiom for QVideoFrame instead of buffer sharing. Fixes: QTBUG-123131 Pick-to: 6.7 6.6 6.5 Change-Id: I1c1662c5a4ac6f5bffa2cea8e36c4fbf60c20f64 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Move logic of finding actual media location to a separate functionArtem Dyomin2024-03-172-0/+19
| | | | | | | | | | | | | The change is need to ensure better backport compatibility with changes related to 'setOutputDevice'. The function might be reused in other media backends, so it should be in the base class. Task-number: QTBUG-121827 Pick-to: 6.7 6.6 6.5 Change-Id: I8be73598f949f07fc75df0874797cb96967c49fe Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>