summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVal Doroshchuk <valentyn.doroshchuk@qt.io>2017-10-18 16:17:44 +0200
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2017-12-14 10:51:17 +0000
commit5629823b05ca7d24924ac879b5a0469a3cb03e78 (patch)
tree4972da3c8663983b3f5c98a869299f922e70aee3 /src
parentb69259b65707acc9fc3c0818f6affe53938cebc3 (diff)
downloadqtmultimedia-5629823b05ca7d24924ac879b5a0469a3cb03e78.tar.gz
DirectShow: Add initialization of com library to service plugin
In case when QCoreApplication is used the COM library was not initialized on the calling thread before the COM library calls were made. QApplication initializes it by calling OleInitialize(). Task-number: QTBUG-59320 Change-Id: I50a71b1bcc8a63f5a8ffd22c5d044f9c56de15f9 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/directshow/dsserviceplugin.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/directshow/dsserviceplugin.cpp b/src/plugins/directshow/dsserviceplugin.cpp
index 51be7e500..cb4f0cdf9 100644
--- a/src/plugins/directshow/dsserviceplugin.cpp
+++ b/src/plugins/directshow/dsserviceplugin.cpp
@@ -123,7 +123,9 @@ QMediaServiceProviderHint::Features DSServicePlugin::supportedFeatures(
QByteArray DSServicePlugin::defaultDevice(const QByteArray &service) const
{
if (service == Q_MEDIASERVICE_CAMERA) {
+ addRefCount();
const QList<DSVideoDeviceInfo> &devs = DSVideoDeviceControl::availableDevices();
+ releaseRefCount();
if (!devs.isEmpty())
return devs.first().first;
}
@@ -135,7 +137,9 @@ QList<QByteArray> DSServicePlugin::devices(const QByteArray &service) const
QList<QByteArray> result;
if (service == Q_MEDIASERVICE_CAMERA) {
+ addRefCount();
const QList<DSVideoDeviceInfo> &devs = DSVideoDeviceControl::availableDevices();
+ releaseRefCount();
for (const DSVideoDeviceInfo &info : devs)
result.append(info.first);
}
@@ -146,7 +150,9 @@ QList<QByteArray> DSServicePlugin::devices(const QByteArray &service) const
QString DSServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
{
if (service == Q_MEDIASERVICE_CAMERA) {
+ addRefCount();
const QList<DSVideoDeviceInfo> &devs = DSVideoDeviceControl::availableDevices();
+ releaseRefCount();
for (const DSVideoDeviceInfo &info : devs) {
if (info.first == device)
return info.second;