blob: ed0f2de9d1fed6f06e9d1fec1ff55ca53c8b9e36 (
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
38
39
40
41
42
43
44
45
46
|
// 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)
{
connect(this, &QPlatformImageCapture::imageSaved, this, &QAndroidImageCapture::updateExif);
}
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();
}
void QAndroidImageCapture::updateExif(int id, const QString &filename)
{
Q_UNUSED(id);
auto androidCamera = qobject_cast<QAndroidCamera *>(videoSource());
if (androidCamera)
androidCamera->updateExif(filename);
}
|