Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
QtExifDataHandler.java
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
package
org.qtproject.qt.android.multimedia.qffmpeg;
4
5
import
android.hardware.camera2.CaptureResult;
6
import
android.media.ExifInterface;
7
import
android.os.Build;
8
import
android.util.Log;
9
10
import
java.io.IOException;
11
12
class
QtExifDataHandler {
13
14
private
int
mFlashFired = 0;
15
private
long
mExposureTime = 0L;
16
private
float
mFocalLength = 0;
17
private
static
String
mModel = Build.MANUFACTURER +
" "
+ Build.MODEL;
18
19
QtExifDataHandler(CaptureResult
r
)
20
{
21
Integer
flash =
r
.get(CaptureResult.FLASH_STATE);
22
if
(flash !=
null
&& flash == CaptureResult.FLASH_STATE_FIRED)
23
mFlashFired = 1;
24
25
Long
exposureTime =
r
.get(CaptureResult.SENSOR_EXPOSURE_TIME);
26
if
(exposureTime !=
null
)
27
mExposureTime = exposureTime/1000000000;
28
mFocalLength =
r
.get(CaptureResult.LENS_FOCAL_LENGTH);
29
}
30
31
void
save(String
path
)
32
{
33
ExifInterface exif;
34
try
{
35
exif =
new
ExifInterface(
path
);
36
}
catch
( IOException e ) {
37
Log
.e(
"QtExifDataHandler"
,
"Cannot open file: "
+
path
+
"\n"
+ e);
38
return
;
39
}
40
exif.setAttribute(ExifInterface.TAG_FLASH,
String
.valueOf(mFlashFired));
41
exif.setAttribute(ExifInterface.TAG_EXPOSURE_TIME,
String
.valueOf(mExposureTime));
42
exif.setAttribute(ExifInterface.TAG_FOCAL_LENGTH,
String
.valueOf(mFocalLength));
43
exif.setAttribute(ExifInterface.TAG_MODEL, mModel);
44
45
try
{
46
exif.saveAttributes();
47
}
catch
( IOException e ) {
48
Log
.e(
"QtExifDataHandler"
,
"Cannot save file: "
+
path
+
"\n"
+ e);
49
}
50
}
51
}
QNapi::String
Napi::String String
Definition
qnapi_p.h:70
QSSGRenderShaderValue::Integer
@ Integer
Definition
qssgrenderbasetypes_p.h:292
r
GLboolean r
Definition
qopengles2ext.h:337
path
GLsizei const GLchar *const * path
Definition
qopenglext.h:4283
Log
@ Log
Definition
qqmlbuiltinfunctions.cpp:2039
MimerColumnTypes::Long
@ Long
Definition
qsql_mimer.cpp:45
qtmultimedia
src
android
jar
src
org
qtproject
qt
android
multimedia
qffmpeg
QtExifDataHandler.java
Generated on
for Qt by
1.18.0