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
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)
list(APPEND QT_PACKAGES DBus)
endif()

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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