Help us shape the future of Go! Take the 2026 Go Developer Survey

igbp

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2026 License: CC0-1.0 Imports: 7 Imported by: 0

Documentation

Overview

Package igbp defines shared constants for IGraphicBufferProducer interactions used by multiple camera-related commands.

Package igbp provides a minimal IGraphicBufferProducer stub backed by gralloc-allocated buffers, suitable for receiving camera frames.

Index

Constants

View Source
const BufferNeedsRealloc = 0x1

BufferNeedsRealloc is BUFFER_NEEDS_REALLOCATION = 0x1.

View Source
const Descriptor = "android.gui.IGraphicBufferProducer"

Descriptor is the interface descriptor for IGraphicBufferProducer.

View Source
const GraphicBufferMagicGB01 = int32(0x47423031)

GraphicBufferMagicGB01 is the 'GB01' magic: 'G'<<24 | 'B'<<16 | '0'<<8 | '1'.

View Source
const MaxBufferSlots = 64

MaxBufferSlots matches BufferQueueDefs::NUM_BUFFER_SLOTS.

Variables

This section is empty.

Functions

func WriteEmptyFrameEventHistoryDelta added in v0.0.8

func WriteEmptyFrameEventHistoryDelta(reply *parcel.Parcel)

WriteEmptyFrameEventHistoryDelta writes an empty FrameEventHistoryDelta as a Flattenable: compositorTiming (3 * int64) + int32(0 deltas) = 28 bytes.

func WriteGrallocGraphicBuffer added in v0.0.8

func WriteGrallocGraphicBuffer(
	p *parcel.Parcel,
	buf *gralloc.Buffer,
	bufID uint64,
)

WriteGrallocGraphicBuffer writes a flattened GraphicBuffer backed by a gralloc NativeHandle. The wire format follows GraphicBuffer::flatten():

int32(flattenedSize) + int32(fdCount) + raw[flattenedSize] + fd objects

func WriteQueueBufferOutput added in v0.0.8

func WriteQueueBufferOutput(reply *parcel.Parcel)

WriteQueueBufferOutput writes a minimal QueueBufferOutput Flattenable.

Types

type AndroidStatus

type AndroidStatus int32

AndroidStatus represents an Android status/error code.

const (
	StatusOK     AndroidStatus = 0
	StatusNoInit AndroidStatus = -19
)

Android status codes.

type IGBPTransaction

type IGBPTransaction = binder.TransactionCode

IGBPTransaction identifies an IGraphicBufferProducer transaction code.

const (
	RequestBuffer          IGBPTransaction = 1
	DequeueBuffer          IGBPTransaction = 2
	DetachBuffer           IGBPTransaction = 3
	DetachNextBuffer       IGBPTransaction = 4
	AttachBuffer           IGBPTransaction = 5
	QueueBuffer            IGBPTransaction = 6
	CancelBuffer           IGBPTransaction = 7
	Query                  IGBPTransaction = 8
	Connect                IGBPTransaction = 9
	Disconnect             IGBPTransaction = 10
	SetSidebandStream      IGBPTransaction = 11
	AllocateBuffers        IGBPTransaction = 12
	AllowAllocation        IGBPTransaction = 13
	SetGenerationNumber    IGBPTransaction = 14
	GetConsumerName        IGBPTransaction = 15
	SetMaxDequeuedBufCount IGBPTransaction = 16
	SetAsyncMode           IGBPTransaction = 17
	SetSharedBufferMode    IGBPTransaction = 18
	SetAutoRefresh         IGBPTransaction = 19
	SetDequeueTimeout      IGBPTransaction = 20
	GetLastQueuedBuffer    IGBPTransaction = 21
	GetFrameTimestamps     IGBPTransaction = 22
	GetUniqueId            IGBPTransaction = 23
	GetConsumerUsage       IGBPTransaction = 24
	SetLegacyBufferDrop    IGBPTransaction = 25
	SetAutoPrerotation     IGBPTransaction = 26
)

Transaction codes from IGraphicBufferProducer.cpp. IBinder::FIRST_CALL_TRANSACTION == 1.

type NativeWindowQuery

type NativeWindowQuery int32

NativeWindowQuery identifies a NATIVE_WINDOW query constant from <system/window.h>.

const (
	NativeWindowWidth             NativeWindowQuery = 0
	NativeWindowHeight            NativeWindowQuery = 1
	NativeWindowFormat            NativeWindowQuery = 2
	NativeWindowMinUndequeued     NativeWindowQuery = 3
	NativeWindowQueuesToComposer  NativeWindowQuery = 4
	NativeWindowConcreteType      NativeWindowQuery = 5
	NativeWindowDefaultWidth      NativeWindowQuery = 6
	NativeWindowDefaultHeight     NativeWindowQuery = 7
	NativeWindowTransformHint     NativeWindowQuery = 8
	NativeWindowConsumerRunning   NativeWindowQuery = 9
	NativeWindowConsumerUsageBits NativeWindowQuery = 10
	NativeWindowStickyTransform   NativeWindowQuery = 11
	NativeWindowDefaultDataspace  NativeWindowQuery = 12
	NativeWindowBufferAge         NativeWindowQuery = 13
	NativeWindowMaxBufferCount    NativeWindowQuery = 21

	NativeWindowSurface NativeWindowQuery = 1 // NATIVE_WINDOW_SURFACE for CONCRETE_TYPE
)

NATIVE_WINDOW query constants from <system/window.h>.

type PixelFormat

type PixelFormat int32

PixelFormat identifies an Android HAL pixel format.

const (
	PixelFormatImplementationDefined PixelFormat = 0x22 // HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED
	PixelFormatYCbCr420_888          PixelFormat = 0x23 // HAL_PIXEL_FORMAT_YCbCr_420_888
)

Pixel formats.

type ProducerStub added in v0.0.8

type ProducerStub struct {
	// ConsumerName is returned by the GetConsumerName transaction.
	ConsumerName string
	// contains filtered or unexported fields
}

ProducerStub implements a minimal IGraphicBufferProducer that provides gralloc-allocated buffers to the camera HAL. Queued frames are delivered via QueuedFrames().

func NewProducerStub added in v0.0.8

func NewProducerStub(
	width uint32,
	height uint32,
	grallocBufs [4]*gralloc.Buffer,
) *ProducerStub

NewProducerStub creates a new IGraphicBufferProducer stub backed by the given pre-allocated gralloc buffers.

func (*ProducerStub) Descriptor added in v0.0.8

func (g *ProducerStub) Descriptor() string

Descriptor implements binder.NativeTransactionHandler.

func (*ProducerStub) OnTransaction added in v0.0.8

func (g *ProducerStub) OnTransaction(
	_ context.Context,
	code binder.TransactionCode,
	data *parcel.Parcel,
) (*parcel.Parcel, error)

OnTransaction implements binder.NativeTransactionHandler.

func (*ProducerStub) QueuedFrames added in v0.0.8

func (g *ProducerStub) QueuedFrames() <-chan int

QueuedFrames returns a channel that receives the slot index each time the camera queues a buffer back.

func (*ProducerStub) SlotBuffer added in v0.0.8

func (g *ProducerStub) SlotBuffer(slot int) *gralloc.Buffer

SlotBuffer returns the gralloc buffer for the given slot, or nil if the slot has not been assigned yet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL