summaryrefslogtreecommitdiffstats
path: root/src/plugins/multimedia/ffmpeg/qandroidimagecapture.cpp
blob: 44931fed99c3a5a70ae77ed479ede2df668c6508 (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
36
37
// Copyright (C) 2023 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 "qandroidimagecapture_p.h"
#include <qandroidcamera_p.h>

QT_BEGIN_NAMESPACE

QAndroidImageCapture::QAndroidImageCapture(QImageCapture *parent)
    : QFFmpegImageCapture(parent)
{
}

QAndroidImageCapture::~QAndroidImageCapture()
{
}

int QAndroidImageCapture::doCapture(const QString &fileName)
{
    auto ret = QFFmpegImageCapture::doCapture(fileName);
    if (ret >= 0) {
        auto androidCamera = static_cast<QAndroidCamera *>(m_camera);
        if (androidCamera)
            androidCamera->capture();
    }

    return ret;
}


void QAndroidImageCapture::setupCameraConnections()
{
    connect(m_camera, &QPlatformCamera::activeChanged, this, &QFFmpegImageCapture::cameraActiveChanged);
    auto androidCamera = static_cast<QAndroidCamera *>(m_camera);
    if (androidCamera)
        connect(androidCamera, &QAndroidCamera::onCaptured, this, &QAndroidImageCapture::newVideoFrame);
}