summaryrefslogtreecommitdiffstats
path: root/src/plugins/multimedia/ffmpeg/qandroidimagecapture.cpp
blob: 9265b088d446df3f0992498712ea748d79315fba (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 = qobject_cast<QAndroidCamera *>(videoSource());
        if (androidCamera)
            androidCamera->capture();
    }

    return ret;
}

void QAndroidImageCapture::setupVideoSourceConnections()
{
    auto androidCamera = qobject_cast<QAndroidCamera *>(videoSource());
    if (androidCamera)
        connect(androidCamera, &QAndroidCamera::onCaptured, this, &QAndroidImageCapture::newVideoFrame);
    else
        QFFmpegImageCapture::setupVideoSourceConnections();
}