Example usage for android.hardware.camera2 DngCreator setLocation

List of usage examples for android.hardware.camera2 DngCreator setLocation

Introduction

In this page you can find the example usage for android.hardware.camera2 DngCreator setLocation.

Prototype

@NonNull
public DngCreator setLocation(@NonNull Location location) 

Source Link

Document

Set image location metadata.

Usage

From source file:freed.cam.apis.camera2.modules.PictureModuleApi2.java

@NonNull
private void process_rawSensor(ImageHolder image, File file) {
    Log.d(TAG, "Create DNG");

    DngCreator dngCreator = new DngCreator(cameraHolder.characteristics, image.getCaptureResult());
    //Orientation 90 is not a valid EXIF orientation value, fuck off that is valid!
    try {//from ww w.j ava  2s  .  c  o  m
        dngCreator.setOrientation(image.captureResult.get(CaptureResult.JPEG_ORIENTATION));
    } catch (IllegalArgumentException ex) {
        ex.printStackTrace();
    }

    if (appSettingsManager.getApiString(AppSettingsManager.SETTING_LOCATION).equals(KEYS.ON))
        dngCreator
                .setLocation(cameraUiWrapper.getActivityInterface().getLocationHandler().getCurrentLocation());
    try {
        if (!appSettingsManager.GetWriteExternal())
            dngCreator.writeImage(new FileOutputStream(file), image.getImage());
        else {
            DocumentFile df = cameraUiWrapper.getActivityInterface().getFreeDcamDocumentFolder();
            DocumentFile wr = df.createFile("image/*", file.getName());
            dngCreator.writeImage(
                    cameraUiWrapper.getContext().getContentResolver().openOutputStream(wr.getUri()),
                    image.getImage());
        }
        cameraUiWrapper.getActivityInterface().ScanFile(file);
    } catch (IOException ex) {
        ex.printStackTrace();
    }
    image.getImage().close();
    image = null;
}