3package org.qtproject.qt.android.multimedia;
5import android.hardware.camera2.CaptureResult;
6import android.media.ExifInterface;
7import android.os.Build;
8import android.util.Log;
10import java.io.IOException;
12class QtExifDataHandler {
14 private int mFlashFired = 0;
15 private long mExposureTime = 0L;
16 private float mFocalLength = 0;
17 private static String mModel = Build.MANUFACTURER +
" " + Build.MODEL;
19 QtExifDataHandler(CaptureResult
r)
21 Integer flash =
r.get(CaptureResult.FLASH_STATE);
22 if (flash !=
null && flash == CaptureResult.FLASH_STATE_FIRED)
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);
35 exif =
new ExifInterface(
path);
36 }
catch ( IOException e ) {
37 Log.e(
"QtExifDataHandler",
"Cannot open file: " +
path +
"\n" + e);
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);
46 exif.saveAttributes();
47 }
catch ( IOException e ) {
48 Log.e(
"QtExifDataHandler",
"Cannot save file: " +
path +
"\n" + e);
GLsizei const GLchar *const * path