Documentation
¶
Overview ¶
Package camera provides a high-level API for capturing frames from an Android camera via binder.
Index ¶
- func CreateDefaultRequest(ctx context.Context, deviceUser fwkDevice.ICameraDeviceUser, ...) ([]byte, error)
- func CreateStreamWithSurface(ctx context.Context, deviceUser fwkDevice.ICameraDeviceUser, ...) (int32, error)
- func SubmitRequest(ctx context.Context, deviceUser fwkDevice.ICameraDeviceUser, ...) (fwkDevice.SubmitInfo, error)
- type Device
- type Format
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDefaultRequest ¶
func CreateDefaultRequest( ctx context.Context, deviceUser fwkDevice.ICameraDeviceUser, templateId fwkDevice.TemplateId, ) ([]byte, error)
CreateDefaultRequest calls CreateDefaultRequest using raw parcel I/O.
func CreateStreamWithSurface ¶
func CreateStreamWithSurface( ctx context.Context, deviceUser fwkDevice.ICameraDeviceUser, transport binder.Transport, igbpStub *binder.StubBinder, width int32, height int32, ) (int32, error)
CreateStreamWithSurface creates a camera stream with the given IGBP stub as the surface. Uses raw parcel I/O because the generated proxy does not handle the native Surface/IGBP binder embedding.
func SubmitRequest ¶
func SubmitRequest( ctx context.Context, deviceUser fwkDevice.ICameraDeviceUser, captureReq fwkDevice.CaptureRequest, isRepeating bool, ) (fwkDevice.SubmitInfo, error)
SubmitRequest sends a SubmitRequestList using raw parcel I/O.
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device represents a connected camera device with a configured capture stream. Use Connect to create, ConfigureStream to set up the stream, CaptureFrame to read frames, and Close to disconnect.
func Connect ¶
func Connect( ctx context.Context, sm *servicemanager.ServiceManager, transport binder.Transport, cameraID string, ) (_ *Device, _err error)
Connect opens a connection to the camera device identified by cameraID (typically "0" for the back camera).
func (*Device) CaptureFrame ¶
CaptureFrame captures a single frame and returns the raw pixel data. The caller should have called ConfigureStream first. This method submits a repeating capture request on the first call, then reads from the IGBP queue channel on subsequent calls.
func (*Device) ConfigureStream ¶
func (d *Device) ConfigureStream( ctx context.Context, width int32, height int32, format Format, ) error
ConfigureStream sets up a capture stream with the given dimensions and pixel format. It allocates gralloc buffers, creates an IGBP surface stub, and configures the camera for streaming.
type Format ¶
type Format = gfxCommon.PixelFormat
Format identifies a pixel format for camera capture.
const (
FormatYCbCr420 Format = gfxCommon.PixelFormatYcbcr420888
)
Supported pixel formats for camera capture.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package gralloc provides gralloc buffer allocation via the Android IAllocator HAL service.
|
Package gralloc provides gralloc buffer allocation via the Android IAllocator HAL service. |
|
Package igbp provides a minimal IGraphicBufferProducer stub backed by gralloc-allocated buffers, suitable for receiving camera frames.
|
Package igbp provides a minimal IGraphicBufferProducer stub backed by gralloc-allocated buffers, suitable for receiving camera frames. |