summaryrefslogtreecommitdiffstats
path: root/src/plugins
Commit message (Collapse)AuthorAgeFilesLines
...
* GStreamer: metadata - support for 2-letter language codesTim Blechmann2024-06-071-1/+1
| | | | | | | | | 2-letter language codes seem to appear in video metadata. At least ffmpeg `-metadata:s:a:0 language=eng` results in an `en` language code. Pick-to: 6.5 6.7 6.8 Change-Id: I27e62dec0b1324a41f924da748afa112b87368e0 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Fix wrong frame rate and frame count when encoding custom video framesJøger Hansegård2024-06-062-0/+29
| | | | | | | | | | | | | | | | | | This patch sets duration of AVPackets before they are sent from video encoding to muxer. This fixes issues where single-frame videos could not be played in ffplay and QMediaPlayer. It also fixes issues with lost frames and incorrect media duration. It is not clear why FFmpeg muxer is unable to produce valid video files without duration estimates, but internal muxer function guess_pkt_duration appears to be assuming that either duration is already set, or avg_frame_rate is set on the stream before avformat_write_header is called. Fixes: QTBUG-125957 Pick-to: 6.8 Change-Id: Ibb6853a356242271be404f26715095be835a1924 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Avfcamera: Fix comparison error when adding camera formatsLars Sutterud2024-06-061-2/+3
| | | | | | | | | | | | A comparison between float and double prevented Qt from adding camera formats for certain cameras, due to small differences between the values. This change fixes that by adding/subtracting 0.001 to hide the fuzziness. Pick-to: 6.8 6.7 6.5 Task-number: QTBUG-124725 Change-Id: I87d05b57e60667fef1569a5087d3d88897798de8 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Fix emitting 'reday to send' signals if mediaRecorder.autoStop enabledArtem Dyomin2024-06-069-26/+69
| | | | | | | | | Media frame inputs shouldn't emit 'ready to send signals' after sending the last frame if mediaRecorder.autoStop is enabled. Pick-to: 6.8 Change-Id: Ib99f579b4b75ba7d6c8a08c11ae17eb2c1db2533 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* QAVFCamera - skip any resolution adjustments on macOSTimur Pocheptsov2024-06-051-0/+4
| | | | | | | | | | | | Apparently videoOrientation can be reported as portrait, even though the resolution we want to use is landscape, transposing we end up with errors coming from hwaccell (where the resolution is not transposed). Pick-to: 6.8 6.7 6.7.2 6.5 Fixes: QTBUG-119102 Change-Id: I8aa367ccc5e45902244e0393aa0fc0da0b19d920 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: improve duration/position queriesTim Blechmann2024-06-057-27/+81
| | | | | | | | | | * move position/duration queries to QGstElement * reuse GstQuery element for querying position * report errors when queries fail Pick-to: 6.5 6.7 6.8 Change-Id: Ie4116bf4307a36ff07ed603f928435ffe2d07a5e Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Remove useless code: format.setMirroredArtem Dyomin2024-06-041-5/+1
| | | | | | | | | | | The code sets 'mirrored' to a copy of QVideoFrameFormat, it doesn't make any sense as the 'detach' is called on in the setter, and the original format will not be changed. Pick-to: 6.7 6.5 Change-Id: Ie54f9d4dca3096da347d49988b21bec54df2ae0b Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: QGstreamerVideoSink - prefix members with m_Tim Blechmann2024-06-042-46/+48
| | | | | | | | No functional change Pick-to: 6.5 6.7 6.8 Change-Id: I7862b1bcd18a8915436ce41d06e3efeccb4d5ea8 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* GStreamer: video output - simplify implementationTim Blechmann2024-06-042-34/+32
| | | | | | | | | | Instead of creating convert/scale elements explicitly, we create a bin containing both elements. This simplifies both detection and pipeline management logic. Pick-to: 6.5 6.7 6.8 Change-Id: I902f1993e1a059b168118e7252c42a745c608601 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* PlatformMediaPlayer - silence clang-tidy warningsTim Blechmann2024-06-031-3/+3
| | | | | | Pick-to: 6.5 6.7 6.8 Change-Id: Id25ea00d1eab5e557cf4d170464ec791b0c4280e Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* GStreamer: QGstreamerVideoOutput - prefix members with m_Tim Blechmann2024-06-032-82/+82
| | | | | | | | No functional change. Pick-to: 6.5 6.7 6.8 Change-Id: Ib481de320d327941d9d25bb7ead77fe7239705d6 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Backends: fix `emit` keywordsTim Blechmann2024-05-313-14/+14
| | | | | | | | thanks to clazy Pick-to: 6.5 6.7 Change-Id: I994f3ba61f5b0e806839da6c63b35023120bd1e2 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* GStreamer: Audio Decoder - fix durationsTim Blechmann2024-05-311-2/+2
| | | | | | | | invalid duration/position is -1 according to the unit tests. Pick-to: 6.5 6.7 Change-Id: I5f65f2086f0dd8a5ccf4fe6a482bce18a8b55c1a Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* wasm: fix video play on FirefoxLorn Potter2024-05-312-2/+2
| | | | | | | | | | | For whatever reason, the Qt global static was failing to return true or false and returned the pointer instead. Pick-to: 6.7 Fixes: QTBUG-125632 Change-Id: If07fc1c19ca34870f1529ab352d47a9939d93b65 Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* GStreamer: Media player - improve duration handlingTim Blechmann2024-05-312-18/+18
| | | | | | | | | * introduce `updateDurationFromPipeline` * use cached duration during EOS Pick-to: 6.5 6.7 Change-Id: Idfb1e38e07964e9fb5a592603c6d21eb0b4eb394 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Fix startTime of created audio buffers upon playbackArtem Dyomin2024-05-304-30/+31
| | | | | | | | | | | The resampler should consider a time point upon the initialization in order to get proper startTime to users. Change-Id: Ia7e58794dd540c1cc1b7a3d2b8631ef4571a287b Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io> Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io> Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Harden the logic of emitting frames by QAudioBufferOutputArtem Dyomin2024-05-302-17/+41
| | | | | | | | | | | | | We need to define explicitly that only the first (not repeated) frame should be pushed to QAudioBufferOutput to get round potential duplications. Task-number: QTBUG-111094 Change-Id: I0f50e59154decc83905ef12af40a7975bba43eb5 Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io> Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Implement QAudioBufferOutput, as a custom output for QMediaPlayerArtem Dyomin2024-05-306-33/+99
| | | | | | | | | | | | | | | | | | | | | | Users want to be able to visualize output audio data from QMediaPlayer. The current patch implements a mechnism allowing getting decoded audio data, so that users could visualize what they want. The class is a part of programmatic IO that we add in 6.8. The functionality will allow us to harden QtMM integration tests. [ChangeLog] Added QAudioBufferOutput allowing to get the decoded audio data from QMediaPlayer Task-number: QTBUG-111094 Change-Id: I5f83e7835965f1e7e47b138da0ce82f650abaa4b Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io> Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io> Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Add the property QMediaRecorder::autoStopArtem Dyomin2024-05-309-4/+67
| | | | | | | | | | | | | | | | | The property is supposed to help users to write a well-structured code. It means that users could just take care of pushing media frames to inputs and handling the end of the source streams. Thus, the user code that controls media inputs will only send frames there, and don't call QMediaRecorder::stop after all streams has been finished. The same qml property will allow users to follow a good declarative style instead of calling calling MediaRecorder::stop. [ChangeLog] Added the property QMediaRecorder::autoStop making the media recorder to stop at the and of input streams. Change-Id: Ifa136f6e125f039bf8b0667bf205f8686a201a89 Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Implement support of different input audio buffer size in the recorderArtem Dyomin2024-05-302-43/+142
| | | | | | | | | | | | Many of FFmpeg codecs support only fixed buffer size, that is defined in the codec variables. The patch applies writing of AVFrames of fixed sizes if FFmpeg requires it. The fix is need for correct working of QAudioBufferInput Change-Id: I40681e7c4b8781577f98fbc49f8ee609307d7f16 Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Expose QAbstractVideoBuffer in public APIArtem Dyomin2024-05-309-11/+8
| | | | | | | | | | | | | | | | | | QAbstractVideoBuffer is needed for users to be able to provide custom data to QVideoFrame. We already have QAbstractVideoBuffer as a private implementation, and QAbstractVideoBuffer was public in Qt5. Currently, the video buffer doesn't provide any functionality to work with hw textures directly. If a user works with GPU textures, they will need to map/unmap it by overriding matching methods. [ChangeLog] Added QAbstractVideoBuffer that allows to provide custom data to QVideoFrame. Added a QVideoFrame's constructor taking QAbstractVideoBuffer. Change-Id: Iba5658f228a2373124c571ff8cf71595ef970b43 Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
* FFmpeg: Skip changing state/status if playbackengine was recreatedLars Sutterud2024-05-301-3/+8
| | | | | | | | | | | | | Temporary fix in to make sure we don't change the PlaybackState or MediaStatus if new media has already been loaded, e.g. as a response to positionChanged signal emitted from endOfStream(). The fix prevents a bug where this assert in setMediaAsync() failed: Q_ASSERT(mediaStatus() == QMediaPlayer::LoadingMedia); Task-number: QTBUG-124586 Change-Id: I7bdfdc40a2a71ee53b9beaf0d8bd1d989a256906 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: player - improve metadata handlingTim Blechmann2024-05-301-9/+10
| | | | | | | | | * don't handle `GST_MESSAGE_DURATION_CHANGED` during preroll * move Duration/Url retrieval out of `parseStreamsAndMetadata` Pick-to: 6.5 6.7 Change-Id: I5e9b3d985ca7761cd5cc7f67ce85d19ba163eda1 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: custom camera - add factory to create camera from elementTim Blechmann2024-05-304-5/+54
| | | | | | | | | | | Adding a new factory that allows application code to fully manage the `GstElement*` used in the QCaptureSession. Task-number: QTBUG-123495 Task-number: QTBUG-112999 Pick-to: 6.5 6.7 Change-Id: Ia37227e31102f62cf78562dca283b0bce7823720 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Rename MapData::nPlane => planeCount, size => dataSizeArtem Dyomin2024-05-2911-45/+45
| | | | | | | | | | Preparation for exposing QAbstractVideoBuffer to the public API. New naming seems to be more consistent with the purpose of the variables. Change-Id: Iab1b45e52abf57508327034e2fef2134a30ef372 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Tim Blechmann <tim@klingt.org>
* GStreamer: QGstreamerVideoSink - improve conversion element overrideTim Blechmann2024-05-291-14/+28
| | | | | | | | | | | | | By using `gst_parse_launch` one can inject more than one element and set element properties via a gst-launch string. this is closer to `QT_GSTREAMER_PLAYBIN_CONVERT` from the qt-5 days. [ChangeLog] QVideoSink: GStreamer - allow override of conversion element via environment variable Pick-to: 6.5 6.7 Change-Id: I086bddb4962c216823d7b6a19523f0af74c767e9 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: clean up metadata handlingTim Blechmann2024-05-284-77/+140
| | | | | | | | | | | * simplify qgstreamerformatinfo.cpp using string_views * move caps->metadata parsing out of qgstreamermediaplayer.cpp * add methods to extend QMediaMetaData rather than creating/merging them * unit test Pick-to: 6.5 6.7 Change-Id: I011629ef149f4a0b4deaef8ee07283b847b93099 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: more qDebug support for gstreamer typesTim Blechmann2024-05-282-8/+67
| | | | | | Pick-to: 6.5 6.7 Change-Id: I73d0e579beb97c3b1352dee23087d5247b332490 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: silence deprecation warningTim Blechmann2024-05-281-6/+6
| | | | | Change-Id: Ib7932e907477b67561ad2e846f824f4df0639e27 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Deprecate internal methods of QVideoFrameArtem Dyomin2024-05-2726-64/+116
| | | | | | | | | | | | | | | | | | We're going to expose QAbstractVideoBuffer, and the internal methods of QVideoFrame doesn't work well with it. - QVideoFrame::videoBuffer() is not needed as we don't want to get users access to it. - The constructor (QAbstractVideoBuffer*, QVideoFrameFormat) is not needed as we'll add a new one with unique_ptr instead. Let's use private API instead of the internal methods. The private construction also allows to avoid dynamic cast upon the construction. After adding public API, some of changes, especially in tests, might be reverted to use the new QVideoFrame's constructor. Change-Id: Id25d9e7faf9e88ce7f57492ba173dd168d6cf1de Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Move QHwVideoBuffer to a separate fileArtem Dyomin2024-05-278-12/+8
| | | | | | | Preparation for exposing QAbstractVideoBuffer Change-Id: I46e8bc095f39a2166baa9d34a6eb27cac6496377 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Add method format to QAbstractVideoBufferArtem Dyomin2024-05-275-0/+10
| | | | | | | | QAbstractVideoBuffer will hold the format instead of passing it to QVideoFrame's constructor. Change-Id: Ib75be337832f979aa2a4fac0193ab1c0918a3148 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Add QtVideo::MapMode, deprecate QVideoFrame::MapModeArtem Dyomin2024-05-2720-70/+71
| | | | | | | | | | | | | | | QAbstractVideoBuffer is going to be exposed in the public API, and it will use MapMode, so the enum should be in a common namespace. The only drawback of the deprecation is that QVideoFrame::mapMode() still returns QVideoFrame::MapMode. However, calling the method will not cause deprecation warnings, because enum values are deprecated, not the enum as is. [ChangeLog] Added the namespace QtVideo::MapMode, deprecated QVideoFrame::MapMode. Change-Id: I5248c76c01f07a33f0f5a67e7db2d5072af5383d Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Decouple QAbstractVideoBuffer from hw related interfaceArtem Dyomin2024-05-2717-55/+42
| | | | | | | It's a preparation to expose QAbstractVideoBuffer in the public API. Change-Id: I5c445b16120b45a3667b1359a1a171d1a227dd01 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* GStreamer: improve buffer progress handlingTim Blechmann2024-05-272-11/+15
| | | | | | | | | | | * avoid duplicate `bufferProgressChanged` messages for the same value * stopOrEOS should change the buffer progress to zero (according to the processEOS untit tests) Pick-to: 6.5 6.7 Change-Id: I64c6308cab7135f65d3f4aadb1c789b2b2cc9350 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io>
* Improve logging of loaded stubsArtem Dyomin2024-05-241-1/+7
| | | | | | | | | | | | VAAPI symbols can be loaded by plugin and by shared stub; Let's distinguish between logs in these cases. Amends 1f2171249486fdf6cb1f136e125aa54693e5f846 Pick-to: 6.7 6.5 Change-Id: Iac462dd7908210ee0f8896c13ab1858e5f932367 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io>
* Plugins: avoid allocationsTim Blechmann2024-05-242-5/+7
| | | | | | | | | | `QPlatformNativeInterface` uses `QByteArray` in the interface. The plugins use string literals, which result in memory allocations. We can avoid them by use bytearray literals. Pick-to: 6.5 6.7 Change-Id: I6160231fc651b8eb524e6026b04584df219b083f Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* GStreamer: improve element availability checksTim Blechmann2024-05-2419-152/+153
| | | | | | | | | | | | We move the element availability checks out to a separate function. This allows us to * test for element availability of elements that are dynamically created * use the ctor to construct all necessary objects instead of going through a separate `create` step. This improves code consistency Pick-to: 6.5 6.7 Change-Id: I5b58decef1a865eaa7edad62ed9f4c6ff02f56a9 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: introduce `QGstElement::findFactory`Tim Blechmann2024-05-246-22/+24
| | | | | | | | Small convenience function to find element factory. Pick-to: 6.5 6.7 Change-Id: I054092bc8b81e543c4d46e72015531dd413819c9 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: move more functionality into helper objectsTim Blechmann2024-05-2413-92/+118
| | | | | | | | | | | * rename `QGstStructure` to `QGstStructureView` and remove all memory management functionality * implement `caps` and `tags` for `QGstStructureView` to move it out of application code. * implement `tags` for `QGstPad` to simplify application code. Change-Id: I8621aff9d06217c15fc2db736876f1f7d384a2e5 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: QMediaPlayer - improve `position` handlingTim Blechmann2024-05-242-10/+20
| | | | | | | | | | | | Do not override `QPlatformMediaPlayer::position`, so that we won't always query the pipeline, but instead return the last value from a timer-based position update. While this gives us more granular position updates, it will ensure that we obtain the correct positions for begin/end. Pick-to: 6.5 6.7 Change-Id: Ie637df2c63b2ae2fe9d0e0bc6823d907a10bad7f Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* GStreamer: introduce custom cameraTim Blechmann2024-05-244-1/+69
| | | | | | | | | | Adding support for custom cameras to QCaptureSession via `makeCustomGStreamerCamera`. Task-number: QTBUG-123495 Pick-to: 6.5 6.7 Change-Id: I2c9bfad1b1279de15e3b7a67cf41323ecf8c4983 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Unify handling of codec hw/sw formats for old and new FFmpeg versionsArtem Dyomin2024-05-234-15/+50
| | | | | | | | | | | | Old FFmpeg versions expose supported hw formats in codec->pix_fmts, whereas FFmpeg 7.0, and partially FFmpeg 6.1, expose the formats in hw_config. The patch uses both of them to support the best compatibility. Pick-to: 6.7 6.5 Change-Id: Ic3809ac58dd77a6a27454b39c5a784f8efdfd365 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Remove QAbstractVideoBuffer::mapModeArtem Dyomin2024-05-2316-53/+4
| | | | | | | | | | | | | We assume that QAbstractVideoBuffer::map returns non-empty value if the mapping was successful, so we may store mapMode in QVideoFramePrivate. Removing the method from QAbstractVideoBuffer makes the logic more straight, and helps to expose QAbstractVideoBuffer in the public API. Pick-to: 6.7 6.5 Change-Id: I91f81bcd12eb7f3c7e3495a4aa90a40615801641 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Fix regression after refactorings: stop muxer in the media encoderArtem Dyomin2024-05-231-0/+1
| | | | | | | | Muxer must be stopped and deleted after encoders. Change-Id: Ia1bb65ee836573ea73d4b648ffabc3f042db3c70 Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: debug output - add message parsing for stream messagesTim Blechmann2024-05-233-0/+61
| | | | | | Pick-to: 6.5 6.7 Change-Id: I657e6a5eae0fcdac992b98faa462f1bf474a60ab Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: remove unused codeTim Blechmann2024-05-235-988/+0
| | | | | | | | | | `QGStreamerAudioSink` / `QGStreamerAudioSource` are apparently unused, since `QPlatformAudioSink` / `QPlatformAudioSource` are provided by pulseaudio/alsa. Pick-to: 6.5 6.7 Change-Id: I6a65d8459ffbfc1de1de2bf1c830bea52c3cc37c Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* GStreamer: avoid duplicate `playbackRateChanged` signalsTim Blechmann2024-05-232-0/+6
| | | | | | Pick-to: 6.5 6.7 Change-Id: I4acc45278e9859e4a461834fd732576f34f0fd1f Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Add calcualting the initial source frame rate from time stampsArtem Dyomin2024-05-233-1/+11
| | | | | | | | | If the stream frame rate is not set, we should try to get it from timestamps of the first frame. Change-Id: Ibf74a7cc9b5f3eff18accb002907e1d1804ce29a Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Fix requesting of the first frame by the media recorderArtem Dyomin2024-05-2310-93/+187
| | | | | | | | | | | As encoders are not ready yet before initialization of the recording engine, the initializer has to report canPushFrame = true to pending sources. ammends d98b79fdb2a633551804cdc4e5580ea1b8e046ed Change-Id: Ifcaa529c023a8473f858aa81ab48de5bcf3191ad Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>