Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qandroidimagecapture.cpp
Go to the documentation of this file.
1
// Copyright (C) 2023 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
include
<
QtFFmpegMediaPluginImpl
/
private
/
qandroidimagecapture_p
.
h
>
5
6
#
include
<
QtFFmpegMediaPluginImpl
/
private
/
qandroidcamera_p
.
h
>
7
#
include
<
QtFFmpegMediaPluginImpl
/
private
/
qffmpegmediacapturesession_p
.
h
>
8
9
QT_BEGIN_NAMESPACE
10
11
namespace
QFFmpeg
{
12
13
QAndroidImageCapture
::
QAndroidImageCapture
(
QImageCapture
*
parent
)
14
:
QFFmpegImageCapture
(
parent
)
15
{
16
connect
(
this
, &
QPlatformImageCapture
::
imageSaved
,
this
, &
QAndroidImageCapture
::
updateExif
);
17
}
18
19
QAndroidImageCapture
::~
QAndroidImageCapture
()
20
{
21
}
22
23
int
QAndroidImageCapture
::
doCapture
(
const
QString
&
fileName
)
24
{
25
auto
ret
=
QFFmpegImageCapture
::
doCapture
(
fileName
);
26
if
(
ret
>= 0) {
27
auto
androidCamera
=
qobject_cast
<
QAndroidCamera
*>(
videoSource
());
28
if
(
androidCamera
)
29
androidCamera
->
capture
();
30
}
31
32
return
ret
;
33
}
34
35
void
QAndroidImageCapture
::
applySettingsToVideoSource
()
36
{
37
// Apply to the session's camera even if inactive, the still reader is created when it opens
38
auto
*
androidCamera
=
qobject_cast
<
QAndroidCamera
*>(
39
captureSession
() ?
captureSession
()->
camera
() :
nullptr
);
40
if
(!
androidCamera
)
41
return
;
42
43
androidCamera
->
setStillCaptureResolution
(
imageSettings
().
resolution
());
44
}
45
46
void
QAndroidImageCapture
::
setupVideoSourceConnections
()
47
{
48
auto
androidCamera
=
qobject_cast
<
QAndroidCamera
*>(
videoSource
());
49
if
(
androidCamera
) {
50
connect
(
51
androidCamera
,
52
&
QAndroidCamera
::
onStillPhotoCaptured
,
53
this
,
54
&
QAndroidImageCapture
::
newVideoFrame
);
55
56
// The backend might call onImageCaptureFailed before the call to
57
// QAndroidImageCapture::doCapture() is finished and returns the request id to the user.
58
// Therefore we want to use queued connection for this to make sure any errors are raised
59
// after that function ends.
60
connect
(
61
androidCamera
,
62
&
QAndroidCamera
::
onImageCaptureFailed
,
63
this
,
64
&
QFFmpegImageCapture
::
cancelPendingImage
,
65
Qt
::
QueuedConnection
);
66
}
67
else
68
QFFmpegImageCapture
::
setupVideoSourceConnections
();
69
}
70
71
void
QAndroidImageCapture
::
updateExif
(
int
id
,
const
QString
&
filename
)
72
{
73
Q_UNUSED
(
id
);
74
auto
androidCamera
=
qobject_cast
<
QAndroidCamera
*>(
videoSource
());
75
if
(
androidCamera
)
76
androidCamera
->
updateExif
(
filename
);
77
}
78
79
}
// namespace QFFmpeg
80
81
QT_END_NAMESPACE
QFFmpeg
Definition
qandroidcacertificates.cpp:26
qtmultimedia
src
plugins
multimedia
ffmpeg
android
qandroidimagecapture.cpp
Generated on
for Qt by
1.16.1