summaryrefslogtreecommitdiffstats
path: root/src/multimedia/platform/qplatformvideodevices.cpp
blob: c57632ed539a82d7316c370c205caee5440c66f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include "qplatformvideodevices_p.h"

QT_BEGIN_NAMESPACE

QPlatformVideoDevices::QPlatformVideoDevices(QPlatformMediaIntegration *integration)
    : m_integration(integration)
{
    qRegisterMetaType<PrivateTag>(); // for queued connections
}

QPlatformVideoDevices::~QPlatformVideoDevices() = default;

void QPlatformVideoDevices::onVideoInputsChanged() {
    m_videoInputs.reset();
    emit videoInputsChanged(PrivateTag{});
}

void QPlatformVideoDevices::updateVideoInputsCache()
{
    if (m_videoInputs.update(findVideoInputs()))
        emit videoInputsChanged(PrivateTag{});
}

QList<QCameraDevice> QPlatformVideoDevices::videoInputs() const {
    return m_videoInputs.ensure([this]() {
        return findVideoInputs();
    });
}

QT_END_NAMESPACE

#include "moc_qplatformvideodevices_p.cpp"