User:Jhlin/Camera2: Difference between revisions

Line 2: Line 2:


== Background ==
== Background ==
In Android 5 Lollipop (API version 21), Google introduced a new camera Java API ([http://developer.android.com/reference/android/hardware/camera2/package-summary.html android.hardware.camera2]) and deprecated the one it had been provided since the beginning of Android history ([http://developer.android.com/reference/android/hardware/Camera.html Camera]). Along with this API, new Android camera HAL interface ([http://source.android.com/devices/camera/camera3.html HAL v3]) were created and the camera service built on top of that extended. Some [https://android.googlesource.com/platform/frameworks/av/+/master/camera/camera2/ (internal/WIP) native API (camera2)] is also found in current Android code base already.
In Android 5 Lollipop (API version 21), Google introduced a new camera Java API ([http://developer.android.com/reference/android/hardware/camera2/package-summary.html android.hardware.camera2]) and deprecated the one it had been provided since the beginning of Android history ([http://developer.android.com/reference/android/hardware/Camera.html Camera]). Along with this API, new Android camera HAL interface ([http://source.android.com/devices/camera/camera3.html HAL v3]) were created and the camera service built on top of that extended. Some (internal/WIP) native API ([https://android.googlesource.com/platform/frameworks/av/+/master/camera/camera2/ camera2]) is also found in current Android code base already.


The old HAL was designed as a black box with high-level controls targeting conventional camera apps (preview, video recording, and still capture) and makes it difficult, if not impossible, to implement new type of features such as burst mode[http://en.wikipedia.org/wiki/Burst_mode_%28photography%29] without extending HAL by vendors.
The old HAL was designed as a black box with high-level controls targeting conventional camera apps (preview, video recording, and still capture) and makes it difficult, if not impossible, to implement new type of features such as [http://en.wikipedia.org/wiki/Burst_mode_%28photography%29 burst mode] without extending HAL by vendors.


HAL v3, on the other hand, remodels a camera device as a pipeline that receive capturing requests and produce one result per request[http://source.android.com/devices/camera/camera3.html]. One advantage, among many others, of this design is each request carries its own capture parameters. This way multiple series of requests can be served concurrently (from users' point of view) and each will have its own output (image + metadata) stream.
HAL v3, on the other hand, remodels a camera device as a pipeline that receive capturing requests and produce one result per request[http://source.android.com/devices/camera/camera3.html]. One advantage, among many others, of this design is each request carries its own capture parameters. This way multiple series of requests can be served concurrently (from users' point of view) and each will have its own output (image + metadata) stream.


Since Gonk also uses the camera HAL & service, in theory it's possible to implement mozCamera[https://developer.mozilla.org/en-US/docs/Web/API/Navigator/mozCameras] and <code>getUserMedia()</code>(gUM)[http://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-getusermedia] with HAL v3 on supporting devices.
Since Gonk also uses the camera HAL & service, in theory it's possible to implement [https://developer.mozilla.org/en-US/docs/Web/API/Navigator/mozCameras mozCamera] and [http://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-getusermedia <code>getUserMedia()</code>](gUM) with HAL v3 on supporting devices.


[http://source.android.com/devices/camera/index.html#architecture] describes the architecture of Android camera subsystem.
[http://source.android.com/devices/camera/index.html#architecture] describes the architecture of Android camera subsystem.
Confirmed users
198

edits