DirectShow: Invoke IGraphBuilder::AddSourceFilter() with local file name.

When possible, convert the URL to a local file name with native separators.
The method seems to accept URLs with file scheme, but fails when passing
UNC paths.

Task-number: QTBUG-53114
Change-Id: Ib7418090080be8c1b8472e77541e686adaa3a18a
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
This commit is contained in:
Friedemann Kleint
2016-05-03 10:34:42 +02:00
parent 6dc5ff99ac
commit 1afe2ed975

View File

@@ -63,6 +63,7 @@
#include <QtCore/qcoreapplication.h> #include <QtCore/qcoreapplication.h>
#include <QtCore/qdatetime.h> #include <QtCore/qdatetime.h>
#include <QtCore/qdir.h>
#include <QtCore/qthread.h> #include <QtCore/qthread.h>
#include <QtCore/qvarlengtharray.h> #include <QtCore/qvarlengtharray.h>
@@ -333,8 +334,10 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
if (!SUCCEEDED(hr)) { if (!SUCCEEDED(hr)) {
locker->unlock(); locker->unlock();
const QString urlString = m_url.isLocalFile()
? QDir::toNativeSeparators(m_url.toLocalFile()) : m_url.toString();
hr = m_graph->AddSourceFilter( hr = m_graph->AddSourceFilter(
reinterpret_cast<const OLECHAR *>(m_url.toString().utf16()), L"Source", &source); reinterpret_cast<const OLECHAR *>(urlString.utf16()), L"Source", &source);
locker->relock(); locker->relock();
} }