   // MARK: - AVCapturePhotoCaptureDelegate
 
   func photoOutput(_ output: AVCapturePhotoOutput,
-                   didFinishProcessingPhoto photoSampleBuffer: CMSampleBuffer?,
-                   previewPhoto previewPhotoSampleBuffer: CMSampleBuffer?,
-                   resolvedSettings: AVCaptureResolvedPhotoSettings,
-                   bracketSettings: AVCaptureBracketedStillImageSettings?,
+                   didFinishProcessingPhoto photo: AVCapturePhoto,
                    error: Error?) {
     if let error = error {
       sjlog_error("Error capturing photo: \(error.localizedDescription)", category: .general)

      renderedImage = cgImage.cropping(to: cropRect.applying(cropRectTransform))

      // Modify the metadata to change the dimensions now that they're different.
      exifData?.setValue(NSNumber(value: Float(cropRect.size.width)),
                         forKey: kCGImagePropertyExifPixelXDimension as String)
      exifData?.setValue(NSNumber(value: Float(cropRect.size.height)),
                         forKey: kCGImagePropertyExifPixelYDimension as String)
      mutableMetadata.setValue(exifData, forKey: kCGImagePropertyExifDictionary as String)
    } else {
      // Update dimensions based on image rotation.
      exifData?.setValue(NSNumber(value: Float(finalMetadataSize.width)),
                         forKey: kCGImagePropertyExifPixelXDimension as String)
      exifData?.setValue(NSNumber(value: Float(finalMetadataSize.height)),
                         forKey: kCGImagePropertyExifPixelYDimension as String)
    }
    // Set the final orientation into metadata.
    mutableMetadata.setValue(metadataOrientation, forKey: kCGImagePropertyOrientation as String)
    // Update the EXIF data.
    mutableMetadata.setValue(exifData, forKey: kCGImagePropertyExifDictionary as String)

    // Attempt to generate an orientation-correct image that is cropped if necessary, at the
    // correct scale.

    }

    // Done!
    delegate?.photoCapturerDidCapturePhotoData(finalImageData,
                                               metadata: mutableMetadata as NSDictionary)
  }

}
