Remove QtMultimedia dependency

This commit is contained in:
Gaelle Braud 2026-01-06 11:30:37 +01:00
parent 35895ed42d
commit e21005045a
8 changed files with 76 additions and 77 deletions

View file

@ -22,7 +22,7 @@ set(APP_TARGETS ${LinphoneCxx_TARGET}
${LibLinphone_TARGET})#Liblinphone ${LibLinphone_TARGET})#Liblinphone
set(QT_DEFAULT_MAJOR_VERSION 6) set(QT_DEFAULT_MAJOR_VERSION 6)
set(QT_PACKAGES Quick Qml Widgets Svg Multimedia Test NetworkAuth Concurrent)# Search Core at first for initialize Qt scripts for next find_packages. set(QT_PACKAGES Quick Qml Widgets Svg Test NetworkAuth Concurrent)# Search Core at first for initialize Qt scripts for next find_packages.
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
list(APPEND QT_PACKAGES DBus) list(APPEND QT_PACKAGES DBus)
endif() endif()

View file

@ -15,7 +15,7 @@ list(APPEND _LINPHONEAPP_SOURCES
tool/providers/ImageProvider.cpp tool/providers/ImageProvider.cpp
tool/providers/ScreenProvider.cpp tool/providers/ScreenProvider.cpp
tool/providers/ThumbnailProvider.cpp tool/providers/ThumbnailProvider.cpp
tool/providers/VideoFrameGrabber.cpp # tool/providers/VideoFrameGrabber.cpp
tool/native/DesktopTools.hpp tool/native/DesktopTools.hpp

View file

@ -36,7 +36,7 @@ const QString ThumbnailProvider::ProviderId = "thumbnail";
ThumbnailAsyncImageResponse::ThumbnailAsyncImageResponse(const QString &id, const QSize &requestedSize) { ThumbnailAsyncImageResponse::ThumbnailAsyncImageResponse(const QString &id, const QSize &requestedSize) {
mPath = id; mPath = id;
connect(&mListener, &VideoFrameGrabberListener::imageGrabbed, this, &ThumbnailAsyncImageResponse::imageGrabbed); // connect(&mListener, &VideoFrameGrabberListener::imageGrabbed, this, &ThumbnailAsyncImageResponse::imageGrabbed);
if (QFileInfo(mPath).isFile()) { if (QFileInfo(mPath).isFile()) {
bool removeExportedFile = SettingsModel::getInstance()->getVfsEncrypted(); bool removeExportedFile = SettingsModel::getInstance()->getVfsEncrypted();
@ -53,11 +53,12 @@ ThumbnailAsyncImageResponse::ThumbnailAsyncImageResponse(const QString &id, cons
if (!format.isEmpty()) { if (!format.isEmpty()) {
originalImage = QImage(mPath, format); originalImage = QImage(mPath, format);
} else if (Utils::isVideo(mPath)) { } else if (Utils::isVideo(mPath)) {
VideoFrameGrabber *grabber = new VideoFrameGrabber(removeExportedFile); originalImage = QImage(mPath);
removeExportedFile = false; // VideoFrameGrabber *grabber = new VideoFrameGrabber(removeExportedFile);
connect(grabber, &VideoFrameGrabber::grabFinished, &mListener, // removeExportedFile = false;
&VideoFrameGrabberListener::imageGrabbed); // connect(grabber, &VideoFrameGrabber::grabFinished, &mListener,
grabber->requestFrame(mPath); // &VideoFrameGrabberListener::imageGrabbed);
// grabber->requestFrame(mPath);
} }
} }
if (removeExportedFile) QFile(mPath).remove(); if (removeExportedFile) QFile(mPath).remove();

View file

@ -23,7 +23,7 @@
#include <QQuickAsyncImageProvider> #include <QQuickAsyncImageProvider>
#include "VideoFrameGrabber.hpp" // #include "VideoFrameGrabber.hpp"
#include "tool/AbstractObject.hpp" #include "tool/AbstractObject.hpp"
// Thumbnails are created asynchronously with QQuickAsyncImageProvider and not QQuickImageProvider. // Thumbnails are created asynchronously with QQuickAsyncImageProvider and not QQuickImageProvider.
@ -43,7 +43,7 @@ public:
QImage mImage; QImage mImage;
QString mPath; QString mPath;
VideoFrameGrabberListener mListener; // VideoFrameGrabberListener mListener;
private: private:
DECLARE_ABSTRACT_OBJECT DECLARE_ABSTRACT_OBJECT

View file

@ -109,10 +109,10 @@ ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
width: Math.min(Utils.getSizeWithScreenRatio(285), mainItem.maxWidth) width: Math.min(Utils.getSizeWithScreenRatio(285), mainItem.maxWidth)
height: Math.min(Utils.getSizeWithScreenRatio(285), mainItem.maxWidth) height: Math.min(Utils.getSizeWithScreenRatio(285), mainItem.maxWidth)
Layout.preferredWidth: videoOutput.contentRect.width Layout.preferredWidth: width
Layout.preferredHeight: videoOutput.contentRect.height Layout.preferredHeight: height
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
fillMode: VideoOutput.PreserveAspectFit // fillMode: VideoOutput.PreserveAspectFit
} }
// FILES // FILES

View file

@ -1,7 +1,6 @@
import QtQuick import QtQuick
import QtQuick.Controls as Control import QtQuick.Controls as Control
import QtQuick.Layouts import QtQuick.Layouts
import QtMultimedia
import Linphone import Linphone
import UtilsCpp import UtilsCpp
@ -107,35 +106,35 @@ Item {
visible: mainItem.isVideo visible: mainItem.isVideo
color: DefaultStyle.grey_1000 color: DefaultStyle.grey_1000
anchors.fill: parent anchors.fill: parent
Video { // Video {
id: videoThumbnail // id: videoThumbnail
anchors.fill: parent // anchors.fill: parent
position: 100 // position: 100
source: mainItem.isVideo ? "file:///" + mainItem.filePath : "" // source: mainItem.isVideo ? "file:///" + mainItem.filePath : ""
fillMode: playbackState === MediaPlayer.PlayingState ? VideoOutput.PreserveAspectFit : VideoOutput.PreserveAspectCrop // fillMode: playbackState === MediaPlayer.PlayingState ? VideoOutput.PreserveAspectFit : VideoOutput.PreserveAspectCrop
EffectImage { EffectImage {
anchors.centerIn: parent anchors.centerIn: parent
visible: videoThumbnail.playbackState !== MediaPlayer.PlayingState // visible: videoThumbnail.playbackState !== MediaPlayer.PlayingState
width: Utils.getSizeWithScreenRatio(24) width: Utils.getSizeWithScreenRatio(24)
height: Utils.getSizeWithScreenRatio(24) height: Utils.getSizeWithScreenRatio(24)
imageSource: AppIcons.playFill imageSource: AppIcons.playFill
colorizationColor: DefaultStyle.main2_0 colorizationColor: DefaultStyle.main2_0
} }
Text { // Text {
z: parent.z + 1 // z: parent.z + 1
property int timeDisplayed: videoThumbnail.playbackState === MediaPlayer.PlayingState ? videoThumbnail.position : videoThumbnail.duration // property int timeDisplayed: videoThumbnail.playbackState === MediaPlayer.PlayingState ? videoThumbnail.position : videoThumbnail.duration
anchors.bottom: parent.bottom // anchors.bottom: parent.bottom
anchors.left: parent.left // anchors.left: parent.left
anchors.bottomMargin: Utils.getSizeWithScreenRatio(6) // anchors.bottomMargin: Utils.getSizeWithScreenRatio(6)
anchors.leftMargin: Utils.getSizeWithScreenRatio(6) // anchors.leftMargin: Utils.getSizeWithScreenRatio(6)
text: UtilsCpp.formatDuration(timeDisplayed) // text: UtilsCpp.formatDuration(timeDisplayed)
color: DefaultStyle.grey_0 // color: DefaultStyle.grey_0
font { // font {
pixelSize: Typography.d1.pixelSize // pixelSize: Typography.d1.pixelSize
weight: Typography.d1.weight // weight: Typography.d1.weight
} // }
} // }
} // }
} }
} }
} }

View file

@ -1,56 +1,55 @@
import QtQuick import QtQuick
import QtQuick.Controls as Control import QtQuick.Controls as Control
import QtQuick.Layouts import QtQuick.Layouts
import QtMultimedia // import QtMultimedia
import Linphone import Linphone
import UtilsCpp import UtilsCpp
import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils
// ============================================================================= // =============================================================================
Rectangle { Rectangle {
id: mainItem id: mainItem
color: DefaultStyle.grey_1000 color: DefaultStyle.grey_1000
property ChatMessageContentGui contentGui property ChatMessageContentGui contentGui
property string filePath: contentGui && contentGui.core.filePath property string filePath: contentGui && contentGui.core.filePath
property var fillMode: playbackState === MediaPlayer.PlayingState ? VideoOutput.PreserveAspectFit : VideoOutput.PreserveAspectCrop // property var fillMode: playbackState === MediaPlayer.PlayingState ? VideoOutput.PreserveAspectFit : VideoOutput.PreserveAspectCrop
property alias videoOutput: output // property alias videoOutput: output
property string source: mediaPlayer.source // property string source: mediaPlayer.source
MediaPlayer { // MediaPlayer {
id: mediaPlayer // id: mediaPlayer
source: UtilsCpp.isVideo(mainItem.filePath) ? "file:///" + mainItem.filePath : "" // source: UtilsCpp.isVideo(mainItem.filePath) ? "file:///" + mainItem.filePath : ""
position: 100 // position: 100
videoOutput: output // videoOutput: output
} // }
VideoOutput { // VideoOutput {
id: output // id: output
fillMode: mainItem.fillMode // fillMode: mainItem.fillMode
endOfStreamPolicy: VideoOutput.KeepLastFrame // endOfStreamPolicy: VideoOutput.KeepLastFrame
width: mainItem.width // width: mainItem.width
height: mainItem.height // height: mainItem.height
Component.onCompleted: { // Component.onCompleted: {
// We need to start the video so the content rect of the // // We need to start the video so the content rect of the
// video output is updated // // video output is updated
mediaPlayer.play() // mediaPlayer.play()
mediaPlayer.pause() // mediaPlayer.pause()
} // }
Text { // Text {
z: parent.z + 1 // z: parent.z + 1
property int timeDisplayed: mediaPlayer.playbackState === MediaPlayer.PlayingState ? mediaPlayer.position : mediaPlayer.duration // property int timeDisplayed: mediaPlayer.playbackState === MediaPlayer.PlayingState ? mediaPlayer.position : mediaPlayer.duration
anchors.bottom: parent.bottom // anchors.bottom: parent.bottom
anchors.left: parent.left // anchors.left: parent.left
anchors.bottomMargin: Utils.getSizeWithScreenRatio(6) // anchors.bottomMargin: Utils.getSizeWithScreenRatio(6)
anchors.leftMargin: Utils.getSizeWithScreenRatio(6) // anchors.leftMargin: Utils.getSizeWithScreenRatio(6)
text: UtilsCpp.formatDuration(timeDisplayed) // text: UtilsCpp.formatDuration(timeDisplayed)
color: DefaultStyle.grey_0 // color: DefaultStyle.grey_0
font { // font {
pixelSize: Typography.d1.pixelSize // pixelSize: Typography.d1.pixelSize
weight: Typography.d1.weight // weight: Typography.d1.weight
} // }
} // }
} // }
MouseArea { MouseArea {
propagateComposedEvents: false propagateComposedEvents: false
enabled: mainItem.visible enabled: mainItem.visible
@ -71,7 +70,7 @@ Rectangle {
} }
EffectImage { EffectImage {
anchors.centerIn: parent anchors.centerIn: parent
visible: mediaPlayer.playbackState !== MediaPlayer.PlayingState // visible: mediaPlayer.playbackState !== MediaPlayer.PlayingState
width: Utils.getSizeWithScreenRatio(24) width: Utils.getSizeWithScreenRatio(24)
height: Utils.getSizeWithScreenRatio(24) height: Utils.getSizeWithScreenRatio(24)
imageSource: AppIcons.playFill imageSource: AppIcons.playFill

View file

@ -32,7 +32,7 @@ For Desktop : you will need QT6 (_6.10.0 or newer_). `C++17` support is required
- Using the [official QT installer](https://www.qt.io/download-thank-you) - Using the [official QT installer](https://www.qt.io/download-thank-you)
- Using an alternative installer like [aqtinstall](https://github.com/miurahr/aqtinstall) - Using an alternative installer like [aqtinstall](https://github.com/miurahr/aqtinstall)
The following QT optional modules are required: qtmultimedia qtnetworkauth qtshadertools . The following QT optional modules are required: <!--qtmultimedia--> qtnetworkauth qtshadertools .
If you wan't to build with Crash handler, you need to install the following tools: If you wan't to build with Crash handler, you need to install the following tools:
- clang - clang
@ -266,7 +266,7 @@ For Fedora (42), the required packages are:
- qt6-qtbase-devel - qt6-qtbase-devel
- qt6-qttools-devel - qt6-qttools-devel
- qt6-qtsvg-devel - qt6-qtsvg-devel
- qt6-qtmultimedia-devel <!-- - qt6-qtmultimedia-devel -->
- qt6-qtnetworkauth-devel - qt6-qtnetworkauth-devel
- qt6-qtquick3d-devel - qt6-qtquick3d-devel
- qt6-qtlanguageserver-devel - qt6-qtlanguageserver-devel