You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CameraView/docs/_docs/previews.md

67 lines
2.8 KiB

---
layout: page
Feature/overlays (#502) * Overlays (#421) * get overlay working * fix overlay drawing * allow disabling overlay in pictures or videos * Fix picture snapshot colors when there is an overlay * Bug fixes * Update example with watermark * Fix bug * Fix overlay orientation in pictures * Fix overlay orientation in videos * Fix overlay when changing preview size * Fix bug * Experiment * Refactor EglViewport * Refactor SnapshotPictureRecorder * Use single EglViewport * Refactor SnapshotVideoRecorder * Bug fix * fix some of the requested changes * clean adding View to OverlayLayout * Specify where to draw the overlay * Refactor * Remove unnecessary variable from CameraPreview * Use mWithOverlay in SnapshotVideoRecorder * Use multiple OverlayLayout * Add explanation for OverlayLayoutManager * override removeView * Remove DisableOverlayFor * Reorder to overlay package * Address issues * Draw selectively on preview, picture or video * Use single Overlay with three targets * Fix picture snapshots * Add demo app control * Fix video snapshot rotation for Camera2 * Fix video snapshot overlay rotation for Camera2 only * Fix tests, improve performance * Add animating watermark * Add tests in CameraViewTest * Add integration tests * Fix race condition * Improve README * Remove isOverlay * Remove isOverlay from docs * Add documentation empty page * Add documentation links * Add real documentation * Remove isOverlay from attrs * Add doc links to main README * Fix tests and logs * Small changes in AudioMediaEncoder * Add changelog line
5 years ago
title: "Engine and Previews"
5 years ago
description: "Camera engine and preview implementations"
Metering APIs (#580) * Add cameraPictureMetering and cameraPictureSnapshotMetering * Adapt Meter and metering package to picture use * Simplify Full2PictureRecorder, we'll use metering package instead * Add doMetering parameter * Implement cameraPictureMetering and cameraPictureSnapshotMetering in engine * Add options in demo app * Add better logs * Add Snapshot2PictureRecorder * Capture the correct frame based on timestamp * Lock AE and AWB. Account for captureBuilder changes * Fix runtime flash changes bug * Small changes * Flash support for metered snapshots * Remove AE and AWB locks * Lock AE/AWB/AF inside the snapshot recorder * Small changes * Fix AutoExposure metering * Create Locker and locking.* parameters * Implement Locker in Camera2Engine * Implement reset delay in Camera2Engine instead of Meter * Simplify Snapshot2PictureRecorder * Fix success value * Unlock inside Camera2Engine * Do not lock for normal gestures * Simplify logic * Improve locking/AutoFocus * Fix TORCH bug * Small changes to locking and metering * Remove AF and AWB for testing * Create action package * Create OneShotAction * Create LogAction * Revisit Full2VideoRecorder using actions * Revisit Full2PictureRecorder using actions * Enable missing functionality in Snapshot2PictureRecorder * Move Snapshot2PictureRecorder using actions, rewrite lock package * Add TimeoutAction * Add comments to the action package * Add meter package * Remove old metering package * Fix various bugs * Add action.abort() * Abort old MeterAction when running new ones * Fix various bugs * Add doc empty page * Add documentation * Fix tests
5 years ago
order: 7
6 years ago
disqus: 1
---
5 years ago
### Engine
CameraView can interact with the camera sensor through the old Android interface typically referred
as `CAMERA1`, and more recently, also through the more modern interface called `CAMERA2`, for API level 21 (Lollipop).
Being more recent, the latter received less testing and feedback. As such, to enable it, you
are required to also set the experimental flag on: `app:cameraExperimental="true"`. On devices older
than Lollipop, the engine will always be `Engine.CAMERA1`.
|Engine|API Level|Info|
|------|---------|----|
|`Engine.CAMERA1`|All|Highly tested and reliable. Currently supports the full set of features.|
|`Engine.CAMERA2`|API 21+|Experimental, but will be the key focus for the future. New controls might be available only for this engine.|
### Previews
CameraView supports different types of previews, configurable either through the `cameraPreview`
XML attribute or programmatically with the `Preview` control class.
5 years ago
All previews are supported in all conditions, regardless, for example, of the `Engine` that you
choose.
5 years ago
This parameter defaults to the OpenGL `GL_SURFACE` and it is highly recommended that you do not change this
to use all the features available. However, experienced user might prefer a different solution.
|Preview|Backed by|Info|
|-------|---------|----|
5 years ago
|`Preview.SURFACE`|A `SurfaceView`|Can be good for battery, but will not work well with dynamic layout changes and similar things. No support for video snapshots.|
|`Preview.TEXTURE`|A `TextureView`|Better. Requires hardware acceleration. No support for video snapshots.|
|`Preview.GL_SURFACE`|A `GLSurfaceView`|Recommended. Supports video snapshots. Supports [overlays](watermarks-and-overlays). Supports [real-time filters](filters).|
The GL surface, as an extra benefit, has a much more efficient way of capturing picture snapshots,
that avoids OOM errors, rotating the image on the fly, reading EXIF, and other horrible things belonging to v1.
These picture snapshots will also work while taking videos.
### XML Attributes
```xml
<com.otaliastudios.cameraview.CameraView
5 years ago
app:cameraEngine="camera1|camera2"
app:cameraPreview="surface|texture|glSurface"/>
```
### Related APIs
The preview method should only be called once and if the `CameraView` was never added to a window,
for example if you just created it programmatically. Otherwise, it has no effect.
5 years ago
The engine method should only be called when the `CameraView` is closed. Otherwise, it has no effect.
|Method|Description|
|------|-----------|
|`setPreview(Preview)`|Sets the preview implementation.|
|`getPreview()`|Gets the current preview implementation.|
5 years ago
|`setEngine(Engine)`|Sets the engine implementation.|
|`getEngine()`|Gets the current engine implementation.|