summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Srebrny <piotr.srebrny@qt.io>2021-10-14 14:42:10 +0200
committerPiotr Srebrny <piotr.srebrny@qt.io>2021-10-15 10:40:04 +0200
commit8a3806f6263f56b5be5b557e321b9b13d1913d5f (patch)
tree253bbb65b8d73c2cd7ad5c4719b42e78b336babe
parentb4e22f8d590e4de8a74f2adb8ab95739f6a4c748 (diff)
Resolve a media file path to an absolute path when calling setMedia
A user provided file path was not resolved to an absolute path, which is required by gstreamer uridecodebin. This patch resolves any type of file path to the absolute path. An input URL without schema is treated as a file path. Fixes: QTBUG-96985 Pick-to: 6.2.1 6.2 Change-Id: Ibc0ba8b6673e2cc93d428ab19450a0aa44216a9b Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/multimedia/playback/qmediaplayer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp
index 69adcc485..5c11d8e81 100644
--- a/src/multimedia/playback/qmediaplayer.cpp
+++ b/src/multimedia/playback/qmediaplayer.cpp
@@ -213,7 +213,10 @@ void QMediaPlayerPrivate::setMedia(const QUrl &media, QIODevice *stream)
}
} else {
qrcMedia = QUrl();
- control->setMedia(media, stream);
+ QUrl url = media;
+ if (url.scheme().isEmpty() || url.scheme() == QLatin1String("file"))
+ url = QUrl::fromUserInput(media.path(), QDir::currentPath(), QUrl::AssumeLocalFile);
+ control->setMedia(url, stream);
}
qrcFile.swap(file); // Cleans up any previous file