Add CameraEngine.getRepeatingRequestDefaultTemplate (#1004)

* Fix Codecov

* Add getRepeatingRequestDefaultTemplate
pull/1020/head
Mattia Iavarone 4 years ago committed by GitHub
parent 0001ab7a54
commit 2429cc114b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/build.yml
  2. 1
      .github/workflows/deploy.yml
  3. 15
      cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java

@ -6,8 +6,6 @@ on:
branches: branches:
- master - master
pull_request: pull_request:
env:
TRAVIS: true
jobs: jobs:
ANDROID_BASE_CHECKS: ANDROID_BASE_CHECKS:
name: Base Checks name: Base Checks

@ -8,7 +8,6 @@ jobs:
name: Bintray Upload name: Bintray Upload
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
TRAVIS: true
BINTRAY_USER: ${{ secrets.BINTRAY_USER }} BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }} BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
BINTRAY_REPO: ${{ secrets.BINTRAY_REPO }} BINTRAY_REPO: ${{ secrets.BINTRAY_REPO }}

@ -228,6 +228,15 @@ public class Camera2Engine extends CameraBaseEngine implements
} }
} }
/**
* Can be changed to select something different than {@link CameraDevice#TEMPLATE_PREVIEW}
* for the default repeating request.
* @return the default template for preview
*/
protected int getRepeatingRequestDefaultTemplate() {
return CameraDevice.TEMPLATE_PREVIEW;
}
/** /**
* Applies the repeating request builder to the preview, assuming we actually have a preview * Applies the repeating request builder to the preview, assuming we actually have a preview
* running. Can be called after changing parameters to the builder. * running. Can be called after changing parameters to the builder.
@ -419,7 +428,7 @@ public class Camera2Engine extends CameraBaseEngine implements
+ mPictureFormat); + mPictureFormat);
} }
mCameraOptions = new Camera2Options(mManager, mCameraId, flip, format); mCameraOptions = new Camera2Options(mManager, mCameraId, flip, format);
createRepeatingRequestBuilder(CameraDevice.TEMPLATE_PREVIEW); createRepeatingRequestBuilder(getRepeatingRequestDefaultTemplate());
} catch (CameraAccessException e) { } catch (CameraAccessException e) {
task.trySetException(createCameraException(e)); task.trySetException(createCameraException(e));
return; return;
@ -977,9 +986,9 @@ public class Camera2Engine extends CameraBaseEngine implements
@EngineThread @EngineThread
private void maybeRestorePreviewTemplateAfterVideo() { private void maybeRestorePreviewTemplateAfterVideo() {
int template = (int) mRepeatingRequestBuilder.build().getTag(); int template = (int) mRepeatingRequestBuilder.build().getTag();
if (template != CameraDevice.TEMPLATE_PREVIEW) { if (template != getRepeatingRequestDefaultTemplate()) {
try { try {
createRepeatingRequestBuilder(CameraDevice.TEMPLATE_PREVIEW); createRepeatingRequestBuilder(getRepeatingRequestDefaultTemplate());
addRepeatingRequestBuilderSurfaces(); addRepeatingRequestBuilderSurfaces();
applyRepeatingRequestBuilder(); applyRepeatingRequestBuilder();
} catch (CameraAccessException e) { } catch (CameraAccessException e) {

Loading…
Cancel
Save