hw

package module
v1.0.30 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

README

gopi-hw

This repository contains hardware implementations and hardware components for gopi and some example programs in the cmd folder. The repository depends on golang version 1.11 and above (in order to support modules). For Linux support, Raspbian GNU/Linux v9 has been tested and for Mac support.

Components

The gopi components provided by this repository are:

Component Path Plaform/Tag Description Conforms to
sys/filepoll linux Watch for read & write changes to files
sys/fsnotify darwin Watch for changes to files and folders hw.FSNotify
sys/gpio linux,rpi General Purpose Hardware Input/Output gopi.GPIO
sys/hw linux,rpi,darwin Hardware information, capabilities gopi.Hardware
sys/i2c linux I2C interface gopi.I2C
sys/lirc linux Linux IR control (LIRC) interface gopi.LIRC
sys/mmal rpi Multimedia Abstraction Layer hw.MMAL
sys/pwm rpi Pulse Wide Modulation (PWM) interface gopi.PWM
sys/spi linux SPI interface gopi.SPI

Bindings

In addition to these general interfaces, the repository contains golang bindings for underlying libraries:

Package Description
rpi Raspberry Pi bindings for DispmanX, MMAL, Videocore
egl Bindings for Khronos Group OpenEGL
freetype Bindings for Freetype2

Building and installing examples

In order to build, pkg-config is required. For the Raspberry Pi, the configuration files are located under /opt/vc/lib/pkg-config so set the environment variable as follows:

bash% PKG_CONFIG_PATH="/opt/vc/lib/pkgconfig"
bash% go install -tags rpi ./cmd/...

There is a makefile which can be used for testing and installing bindings and examples, on a per-platform basis:

bash% make linux   # makes for generic linux
bash% make darwin  # makes for MacOS
bash% make rpi     # makes for Raspberry Pi

The resulting binaries are as follows. Use the -help flag to see the different options for each:

  • hw_list Provide information on hardware capabilities
  • gpio_ctrl Control the GPIO interface
  • i2c_detect Detect I2C devices
  • lirc_receive Display IR pulses from an IR device
  • pwm_ctrl Control PWM signals on the GPIO interface
  • spi_ctrl Control SPI communication
  • mmal_camera_preview Preview the camera output on the screen
  • mmal_encode_image Demonstrates image decoding and encoding using the GPU
  • mmal_video_preview Demonstrates playback of a H264 video on the screen using the GPU
  • fsnotify List file & folder changes under one or more folders

Construction Ahead

More information about the individual components implemented in this repository will be forthcoming later!

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MMAL_ENCODING_H264   = MMAL_FOURCC('H', '2', '6', '4')
	MMAL_ENCODING_MVC    = MMAL_FOURCC('M', 'V', 'C', ' ')
	MMAL_ENCODING_H263   = MMAL_FOURCC('H', '2', '6', '3')
	MMAL_ENCODING_MP4V   = MMAL_FOURCC('M', 'P', '4', 'V')
	MMAL_ENCODING_MP2V   = MMAL_FOURCC('M', 'P', '2', 'V')
	MMAL_ENCODING_MP1V   = MMAL_FOURCC('M', 'P', '1', 'V')
	MMAL_ENCODING_WMV3   = MMAL_FOURCC('W', 'M', 'V', '3')
	MMAL_ENCODING_WMV2   = MMAL_FOURCC('W', 'M', 'V', '2')
	MMAL_ENCODING_WMV1   = MMAL_FOURCC('W', 'M', 'V', '1')
	MMAL_ENCODING_WVC1   = MMAL_FOURCC('W', 'V', 'C', '1')
	MMAL_ENCODING_VP8    = MMAL_FOURCC('V', 'P', '8', ' ')
	MMAL_ENCODING_VP7    = MMAL_FOURCC('V', 'P', '7', ' ')
	MMAL_ENCODING_VP6    = MMAL_FOURCC('V', 'P', '6', ' ')
	MMAL_ENCODING_THEORA = MMAL_FOURCC('T', 'H', 'E', 'O')
	MMAL_ENCODING_SPARK  = MMAL_FOURCC('S', 'P', 'R', 'K')
	MMAL_ENCODING_MJPEG  = MMAL_FOURCC('M', 'J', 'P', 'G')
)
View Source
var (
	MMAL_ENCODING_JPEG = MMAL_FOURCC('J', 'P', 'E', 'G')
	MMAL_ENCODING_GIF  = MMAL_FOURCC('G', 'I', 'F', ' ')
	MMAL_ENCODING_PNG  = MMAL_FOURCC('P', 'N', 'G', ' ')
	MMAL_ENCODING_PPM  = MMAL_FOURCC('P', 'P', 'M', ' ')
	MMAL_ENCODING_TGA  = MMAL_FOURCC('T', 'G', 'A', ' ')
	MMAL_ENCODING_BMP  = MMAL_FOURCC('B', 'M', 'P', ' ')
)
View Source
var (
	MMAL_ENCODING_I420        = MMAL_FOURCC('I', '4', '2', '0')
	MMAL_ENCODING_I420_SLICE  = MMAL_FOURCC('S', '4', '2', '0')
	MMAL_ENCODING_YV12        = MMAL_FOURCC('Y', 'V', '1', '2')
	MMAL_ENCODING_I422        = MMAL_FOURCC('I', '4', '2', '2')
	MMAL_ENCODING_I422_SLICE  = MMAL_FOURCC('S', '4', '2', '2')
	MMAL_ENCODING_YUYV        = MMAL_FOURCC('Y', 'U', 'Y', 'V')
	MMAL_ENCODING_YVYU        = MMAL_FOURCC('Y', 'V', 'Y', 'U')
	MMAL_ENCODING_UYVY        = MMAL_FOURCC('U', 'Y', 'V', 'Y')
	MMAL_ENCODING_VYUY        = MMAL_FOURCC('V', 'Y', 'U', 'Y')
	MMAL_ENCODING_NV12        = MMAL_FOURCC('N', 'V', '1', '2')
	MMAL_ENCODING_NV21        = MMAL_FOURCC('N', 'V', '2', '1')
	MMAL_ENCODING_ARGB        = MMAL_FOURCC('A', 'R', 'G', 'B')
	MMAL_ENCODING_ARGB_SLICE  = MMAL_FOURCC('a', 'r', 'g', 'b')
	MMAL_ENCODING_RGBA        = MMAL_FOURCC('R', 'G', 'B', 'A')
	MMAL_ENCODING_RGBA_SLICE  = MMAL_FOURCC('r', 'g', 'b', 'a')
	MMAL_ENCODING_ABGR        = MMAL_FOURCC('A', 'B', 'G', 'R')
	MMAL_ENCODING_ABGR_SLICE  = MMAL_FOURCC('a', 'b', 'g', 'r')
	MMAL_ENCODING_BGRA        = MMAL_FOURCC('B', 'G', 'R', 'A')
	MMAL_ENCODING_BGRA_SLICE  = MMAL_FOURCC('b', 'g', 'r', 'a')
	MMAL_ENCODING_RGB16       = MMAL_FOURCC('R', 'G', 'B', '2')
	MMAL_ENCODING_RGB16_SLICE = MMAL_FOURCC('r', 'g', 'b', '2')
	MMAL_ENCODING_RGB24       = MMAL_FOURCC('R', 'G', 'B', '3')
	MMAL_ENCODING_RGB24_SLICE = MMAL_FOURCC('r', 'g', 'b', '3')
	MMAL_ENCODING_RGB32       = MMAL_FOURCC('R', 'G', 'B', '4')
	MMAL_ENCODING_RGB32_SLICE = MMAL_FOURCC('r', 'g', 'b', '4')
	MMAL_ENCODING_BGR16       = MMAL_FOURCC('B', 'G', 'R', '2')
	MMAL_ENCODING_BGR16_SLICE = MMAL_FOURCC('b', 'g', 'r', '2')
	MMAL_ENCODING_BGR24       = MMAL_FOURCC('B', 'G', 'R', '3')
	MMAL_ENCODING_BGR24_SLICE = MMAL_FOURCC('b', 'g', 'r', '3')
	MMAL_ENCODING_BGR32       = MMAL_FOURCC('B', 'G', 'R', '4')
	MMAL_ENCODING_BGR32_SLICE = MMAL_FOURCC('b', 'g', 'r', '4')
)
View Source
var (
	MMAL_EVENT_ERROR             = MMAL_FOURCC('E', 'R', 'R', 'O')
	MMAL_EVENT_EOS               = MMAL_FOURCC('E', 'E', 'O', 'S') // End-of-stream event. Data contains a MMAL_EVENT_END_OF_STREAM_T
	MMAL_EVENT_FORMAT_CHANGED    = MMAL_FOURCC('E', 'F', 'C', 'H') // Format changed event. Data contains a MMAL_EVENT_FORMAT_CHANGED_T
	MMAL_EVENT_PARAMETER_CHANGED = MMAL_FOURCC('E', 'P', 'C', 'H') // Parameter changed event. Data contains a MMAL_EVENT_PARAMETER_CHANGED_T
)

Functions

This section is empty.

Types

type FSEvent added in v1.0.30

type FSEvent interface {
	gopi.Event

	Root() string
	Path() string
	RelPath() string
	Flags() FSFlag
	Timestamp() time.Time
}

type FSFlag added in v1.0.30

type FSFlag uint64
const (
	FS_FLAG_RENAMED FSFlag = (1 << iota)
	FS_FLAG_CREATED
	FS_FLAG_DELETED
	FS_FLAG_MODIFIED
	FS_FLAG_CHMOD
	FS_FLAG_ISFILE
	FS_FLAG_ISFOLDER
	FS_FLAG_ISSYMLINK
	FS_FLAG_NONE FSFlag = 0
	FS_FLAG_MIN         = FS_FLAG_RENAMED
	FS_FLAG_MAX         = FS_FLAG_ISSYMLINK
)

func (FSFlag) String added in v1.0.30

func (f FSFlag) String() string

type FSNotify added in v1.0.30

type FSNotify interface {
	gopi.Driver
	gopi.Publisher

	Watch(string) error
	Unwatch(string) error
}

type MMAL

type MMAL interface {
	gopi.Driver

	// Return components
	ComponentWithName(name string) (MMALComponent, error)

	// Return specific components
	CameraComponent() (MMALCameraComponent, error)
	CameraInfoComponent() (MMALComponent, error)
	VideoDecoderComponent() (MMALComponent, error)
	VideoEncoderComponent() (MMALComponent, error)
	VideoRendererComponent() (MMALComponent, error)
	ImageEncoderComponent() (MMALComponent, error)
	ImageDecoderComponent() (MMALComponent, error)
	ReaderComponent() (MMALComponent, error)
	WriterComponent() (MMALComponent, error)

	// Connect and disconnect component ports
	Connect(input, output MMALPort, flags MMALPortConnectionFlags) (MMALPortConnection, error)
	Disconnect(MMALPortConnection) error
}

type MMALAudioFormat added in v1.0.10

type MMALAudioFormat interface {
	MMALFormat
}

type MMALBuffer added in v1.0.10

type MMALBuffer interface {
	// Fill buffer
	Fill(io.Reader) (uint32, error)

	// Return buffer data
	Data() []byte

	// Buffer flags
	Flags() MMALBufferFlag
}

type MMALBufferFlag added in v1.0.10

type MMALBufferFlag uint
const (
	MMAL_BUFFER_FLAG_EOS                 MMALBufferFlag = (1 << iota)
	MMAL_BUFFER_FLAG_FRAME_START         MMALBufferFlag = (1 << iota)                                                 // Signals that the start of the current payload starts a frame
	MMAL_BUFFER_FLAG_FRAME_END           MMALBufferFlag = (1 << iota)                                                 // Signals that the end of the current payload ends a frame
	MMAL_BUFFER_FLAG_KEYFRAME            MMALBufferFlag = (1 << iota)                                                 // Signals that the current payload is a keyframe (i.e. self decodable)
	MMAL_BUFFER_FLAG_DISCONTINUITY       MMALBufferFlag = (1 << iota)                                                 // Signals a discontinuity in the stream of data (e.g. after a seek). Can be used for instance by a decoder to reset its state
	MMAL_BUFFER_FLAG_CONFIG              MMALBufferFlag = (1 << iota)                                                 // Signals a buffer containing some kind of config data for the component (e.g. codec config data)
	MMAL_BUFFER_FLAG_ENCRYPTED           MMALBufferFlag = (1 << iota)                                                 // Signals an encrypted payload
	MMAL_BUFFER_FLAG_CODECSIDEINFO       MMALBufferFlag = (1 << iota)                                                 // Signals a buffer containing side information
	MMAL_BUFFER_FLAGS_SNAPSHOT           MMALBufferFlag = (1 << iota)                                                 // Signals a buffer which is the snapshot/postview image from a stills capture
	MMAL_BUFFER_FLAG_CORRUPTED           MMALBufferFlag = (1 << iota)                                                 // Signals a buffer which contains data known to be corrupted
	MMAL_BUFFER_FLAG_TRANSMISSION_FAILED MMALBufferFlag = (1 << iota)                                                 // Signals that a buffer failed to be transmitted
	MMAL_BUFFER_FLAG_DECODEONLY          MMALBufferFlag = (1 << iota)                                                 // Signals the output buffer won't be used, just update reference frames
	MMAL_BUFFER_FLAG_NAL_END             MMALBufferFlag = (1 << iota)                                                 // Signals that the end of the current payload ends a NAL
	MMAL_BUFFER_FLAG_FRAME               MMALBufferFlag = (MMAL_BUFFER_FLAG_FRAME_START | MMAL_BUFFER_FLAG_FRAME_END) // Signals that the current payload contains only complete frames (1 or more)
	MMAL_BUFFER_FLAG_MIN                                = MMAL_BUFFER_FLAG_EOS
	MMAL_BUFFER_FLAG_MAX                                = MMAL_BUFFER_FLAG_NAL_END
)

func (MMALBufferFlag) String added in v1.0.10

func (f MMALBufferFlag) String() string

type MMALCamera added in v1.0.10

type MMALCamera interface {
	Id() uint32
	Name() string
	Size() (uint32, uint32)
	LensPresent() bool
}

type MMALCameraAnnotation added in v1.0.10

type MMALCameraAnnotation interface {
	// Get parameters
	ShowShutter() bool
	ShowAnalogGain() bool
	ShowLens() bool
	ShowCAF() bool
	ShowMotion() bool
	ShowFrameNum() bool
	BackgroundColor() (uint8, uint8, uint8)
	TextColor() (uint8, uint8, uint8)
	TextSize() uint8
	Text() string
	TextJustify() MMALTextJustify
	TextOffset() (uint32, uint32)

	// Set parameters
	SetShowShutter(bool)
	SetShowAnalogGain(bool)
	SetShowLens(bool)
	SetShowCAF(bool)
	SetShowMotion(bool)
	SetShowFrameNum(bool)
	SetBackgroundColor(y, u, v uint8)
	SetTextColor(y, u, v uint8)
	SetText(string)
	SetTextSize(uint8)
	SetTextJustify(MMALTextJustify)
	SetTextOffset(x, y uint32)
}

type MMALCameraComponent added in v1.0.10

type MMALCameraComponent interface {
	MMALComponent
}

type MMALCameraExposureMode added in v1.0.10

type MMALCameraExposureMode uint
const (
	MMAL_CAMERA_EXPOSUREMODE_OFF MMALCameraExposureMode = iota
	MMAL_CAMERA_EXPOSUREMODE_AUTO
	MMAL_CAMERA_EXPOSUREMODE_NIGHT
	MMAL_CAMERA_EXPOSUREMODE_NIGHTPREVIEW
	MMAL_CAMERA_EXPOSUREMODE_BACKLIGHT
	MMAL_CAMERA_EXPOSUREMODE_SPOTLIGHT
	MMAL_CAMERA_EXPOSUREMODE_SPORTS
	MMAL_CAMERA_EXPOSUREMODE_SNOW
	MMAL_CAMERA_EXPOSUREMODE_BEACH
	MMAL_CAMERA_EXPOSUREMODE_VERYLONG
	MMAL_CAMERA_EXPOSUREMODE_FIXEDFPS
	MMAL_CAMERA_EXPOSUREMODE_ANTISHAKE
	MMAL_CAMERA_EXPOSUREMODE_FIREWORKS
	MMAL_CAMERA_EXPOSUREMODE_MAX = MMAL_CAMERA_EXPOSUREMODE_FIREWORKS
)

func (MMALCameraExposureMode) String added in v1.0.10

func (m MMALCameraExposureMode) String() string

type MMALCameraFlashType added in v1.0.10

type MMALCameraFlashType uint
const (
	MMAL_CAMERA_FLASH_TYPE_XENON MMALCameraFlashType = iota
	MMAL_CAMERA_FLASH_TYPE_LED
	MMAL_CAMERA_FLASH_TYPE_OTHER
)

func (MMALCameraFlashType) String added in v1.0.10

func (f MMALCameraFlashType) String() string

type MMALCameraInfo added in v1.0.10

type MMALCameraInfo interface {
	Cameras() []MMALCamera
	Flashes() []MMALCameraFlashType
}

type MMALCameraMeteringMode added in v1.0.10

type MMALCameraMeteringMode uint
const (
	MMAL_CAMERA_METERINGMODE_AVERAGE MMALCameraMeteringMode = iota
	MMAL_CAMERA_METERINGMODE_SPOT
	MMAL_CAMERA_METERINGMODE_BACKLIT
	MMAL_CAMERA_METERINGMODE_MATRIX
	MMAL_CAMERA_METERINGMODE_MAX = MMAL_CAMERA_METERINGMODE_MATRIX
)

func (MMALCameraMeteringMode) String added in v1.0.10

func (m MMALCameraMeteringMode) String() string

type MMALCameraParameters added in v1.0.10

type MMALCameraParameters interface {
	// Get Parameters
	CameraInfo() (MMALCameraInfo, error)
	CaptureExposureComp() (int32, error)
	OutputShift() (int32, error)
	CCMShift() (int32, error)
	Rotation() (int32, error)
	CameraNum() (uint32, error)
	JPEGQFactor() (uint32, error)
	ISO() (uint32, error)
	MinISO() (uint32, error)
	CustomSensorConfig() (uint32, error)
	ShutterSpeed() (uint32, error)
	DPFConfig() (uint32, error)
	JPEGRestartInterval() (uint32, error)
	CameraISPBlockOverride() (uint32, error)
	BlackLevel() (uint32, error)
	EXIFDisable() (bool, error)
	Capture() (bool, error)
	DrawBoxFacesAndFocus() (bool, error)
	VideoStabilisation() (bool, error)
	EnableRAWCapture() (bool, error)
	EnableDPFFile() (bool, error)
	DPFFailIsFatal() (bool, error)
	HighDynamicRange() (bool, error)
	Antishake() (bool, error)
	BurstCapture() (bool, error)
	CaptureStatsPass() (bool, error)
	EnableRegisterFile() (bool, error)
	RegisterFailIsFatal() (bool, error)
	JPEGAttachLog() (bool, error)
	SWSharpenDisable() (bool, error)
	FlashRequired() (bool, error)
	SWSaturationDisable() (bool, error)
	VideoDenoise() (bool, error)
	StillsDenoise() (bool, error)
	ExposureComp() (MMALRationalNum, error)
	Sharpness() (MMALRationalNum, error)
	Contrast() (MMALRationalNum, error)
	Brightness() (MMALRationalNum, error)
	Saturation() (MMALRationalNum, error)
	AnalogGain() (MMALRationalNum, error)
	DigitalGain() (MMALRationalNum, error)
	MeteringMode() (MMALCameraMeteringMode, error)
	ExposureMode() (MMALCameraExposureMode, error)
	Annotation() (MMALCameraAnnotation, error)

	// Set Parameters
	SetCaptureExposureComp(value int32) error
	SetOutputShift(value int32) error
	SetCCMShift(value int32) error
	SetRotation(value int32) error
	SetCameraNum(value uint32) error
	SetJPEGQFactor(value uint32) error
	SetISO(value uint32) error
	SetMinISO(value uint32) error
	SetCustomSensorConfig(value uint32) error
	SetShutterSpeed(value uint32) error
	SetDPFConfig(value uint32) error
	SetJPEGRestartInterval(value uint32) error
	SetCameraISPBlockOverride(value uint32) error
	SetBlackLevel(value uint32) error
	SetEXIFDisable(value bool) error
	SetCapture(value bool) error
	SetDrawBoxFacesAndFocus(value bool) error
	SetVideoStabilisation(value bool) error
	SetEnableRAWCapture(value bool) error
	SetEnableDPFFile(value bool) error
	SetDPFFailIsFatal(value bool) error
	SetHighDynamicRange(value bool) error
	SetAntishake(value bool) error
	SetBurstCapture(value bool) error
	SetCaptureStatsPass(value bool) error
	SetEnableRegisterFile(value bool) error
	SetRegisterFailIsFatal(value bool) error
	SetJPEGAttachLog(value bool) error
	SetSWSharpenDisable(value bool) error
	SetFlashRequired(value bool) error
	SetSWSaturationDisable(value bool) error
	SetVideoDenoise(value bool) error
	SetStillsDenoise(value bool) error
	SetExposureComp(value MMALRationalNum) error
	SetSharpness(value MMALRationalNum) error
	SetContrast(value MMALRationalNum) error
	SetBrightness(value MMALRationalNum) error
	SetSaturation(value MMALRationalNum) error
	SetAnalogGain(value MMALRationalNum) error
	SetDigitalGain(value MMALRationalNum) error
	SetMeteringMode(MMALCameraMeteringMode) error
	SetExposureMode(MMALCameraExposureMode) error
	SetAnnotation(MMALCameraAnnotation) error
}

type MMALCommonParameters

type MMALCommonParameters interface {
	// Get Parameters
	SupportedEncodings() ([]MMALEncodingType, error)
	ZeroCopy() (bool, error)
	NoImagePadding() (bool, error)
	LockstepEnable() (bool, error)
	PowermonEnable() (bool, error)
	BufferFlagFilter() (uint32, error)
	SystemTime() (uint64, error)

	// Set Parameters
	SetUri(value string) error
	SetZeroCopy(value bool) error
	SetNoImagePadding(value bool) error
	SetLockstepEnable(value bool) error
	SetPowermonEnable(value bool) error
	SetBufferFlagFilter(value uint32) error
}

type MMALComponent

type MMALComponent interface {
	Name() string
	Id() uint32

	// Enable and disable
	Enabled() bool
	SetEnabled(value bool) error

	// Return ports
	Control() MMALPort
	Clocks() []MMALPort
	Inputs() []MMALPort
	Outputs() []MMALPort

	// Get buffer from port/connection and optionally block
	GetEmptyBufferOnPort(MMALPort, bool) (MMALBuffer, error)
	GetFullBufferOnPort(MMALPort, bool) (MMALBuffer, error)
}

type MMALDisplayMode

type MMALDisplayMode uint
const (
	MMAL_DISPLAY_MODE_FILL MMALDisplayMode = iota
	MMAL_DISPLAY_MODE_LETTERBOX
	MMAL_DISPLAY_MODE_STEREO_LEFT_TO_LEFT
	MMAL_DISPLAY_MODE_STEREO_TOP_TO_TOP
	MMAL_DISPLAY_MODE_STEREO_LEFT_TO_TOP
	MMAL_DISPLAY_MODE_STEREO_TOP_TO_LEFT
	MMAL_DISPLAY_MODE_MAX = MMAL_DISPLAY_MODE_STEREO_TOP_TO_LEFT
)

func (MMALDisplayMode) String

func (m MMALDisplayMode) String() string

type MMALDisplayRegion

type MMALDisplayRegion interface {
	// Get properties
	Display() uint16
	FullScreen() bool
	Layer() int16
	Alpha() uint8
	Transform() MMALDisplayTransform
	NoAspect() bool
	Mode() MMALDisplayMode
	CopyProtect() bool
	DestRect() MMALRect
	SrcRect() MMALRect

	// Set properties
	SetFullScreen(bool)
	SetLayer(int16)
	SetAlpha(uint8)
	SetTransform(MMALDisplayTransform)
	SetNoAspect(bool)
	SetMode(MMALDisplayMode)
	SetCopyProtect(bool)
	SetDestRect(MMALRect)
	SetSrcRect(MMALRect)
}

type MMALDisplayTransform

type MMALDisplayTransform uint
const (
	MMAL_DISPLAY_TRANSFORM_NONE MMALDisplayTransform = iota
	MMAL_DISPLAY_TRANSFORM_MIRROR
	MMAL_DISPLAY_TRANSFORM_ROT180_MIRROR
	MMAL_DISPLAY_TRANSFORM_ROT180
	MMAL_DISPLAY_TRANSFORM_ROT90_MIRROR
	MMAL_DISPLAY_TRANSFORM_ROT270
	MMAL_DISPLAY_TRANSFORM_ROT90
	MMAL_DISPLAY_TRANSFORM_ROT270_MIRROR
	MMAL_DISPLAY_TRANSFORM_MAX = MMAL_DISPLAY_TRANSFORM_ROT270_MIRROR
)

func (MMALDisplayTransform) String

func (t MMALDisplayTransform) String() string

type MMALEncodingType

type MMALEncodingType uint32

func MMAL_FOURCC added in v1.0.10

func MMAL_FOURCC(a, b, c, d uint8) MMALEncodingType

func (MMALEncodingType) String

func (e MMALEncodingType) String() string

type MMALFormat

type MMALFormat interface {
	Type() MMALFormatType
	Bitrate() uint32
	SetBitrate(uint32)
	Encoding() (MMALEncodingType, MMALEncodingType)
	SetEncoding(MMALEncodingType)
	SetEncodingVariant(MMALEncodingType, MMALEncodingType)
}

type MMALFormatType

type MMALFormatType uint
const (
	MMAL_FORMAT_UNKNOWN MMALFormatType = iota
	MMAL_FORMAT_CONTROL
	MMAL_FORMAT_AUDIO
	MMAL_FORMAT_VIDEO
	MMAL_FORMAT_SUBPICTURE
	MMAL_FORMAT_MAX = MMAL_FORMAT_SUBPICTURE
)

func (MMALFormatType) String

func (t MMALFormatType) String() string

type MMALPort

type MMALPort interface {
	Name() string
	CapabilityPassthrough() bool
	CapabilityAllocation() bool
	CapabilitySupportsEventFormatChange() bool

	// Enable and disable
	Enabled() bool
	SetEnabled(value bool) error

	// Connect, disconnect, flush and return any errors
	Connect(other MMALPort) error
	Disconnect() error
	Flush() error
	Error() error

	// Format
	Format() MMALFormat
	CopyFormat(MMALFormat) error
	VideoFormat() MMALVideoFormat
	AudioFormat() MMALAudioFormat
	SubpictureFormat() MMALSubpictureFormat
	CommitFormatChange() error

	// Send buffer to port, release buffer
	Send(MMALBuffer) error
	Release(MMALBuffer) error

	// Port Parameters
	MMALCommonParameters
	MMALVideoParameters
	MMALCameraParameters
}

type MMALPortConnection

type MMALPortConnection interface {
	// Input and Output ports
	Input() MMALPort
	Output() MMALPort

	// Enable and disable
	Enabled() bool
	SetEnabled(value bool) error

	// Acquire and release
	Acquire() error
	Release() error
}

type MMALPortConnectionFlags

type MMALPortConnectionFlags uint
const (
	// MMALPortConnectionFlags
	MMAL_CONNECTION_FLAG_TUNNELLING               MMALPortConnectionFlags = 0x0001 // The connection is tunnelled. Buffer headers do not transit via the client but directly from the output port to the input port.
	MMAL_CONNECTION_FLAG_ALLOCATION_ON_INPUT      MMALPortConnectionFlags = 0x0002 // Force the pool of buffer headers used by the connection to be allocated on the input port.
	MMAL_CONNECTION_FLAG_ALLOCATION_ON_OUTPUT     MMALPortConnectionFlags = 0x0004 // Force the pool of buffer headers used by the connection to be allocated on the output port.
	MMAL_CONNECTION_FLAG_KEEP_BUFFER_REQUIREMENTS MMALPortConnectionFlags = 0x0008 // Specify that the connection should not modify the buffer requirements.
	MMAL_CONNECTION_FLAG_DIRECT                   MMALPortConnectionFlags = 0x0010 // The connection is flagged as direct. This doesn't change the behaviour of the connection itself but is used by the the graph utility to specify that the buffer should be sent to the input port from with the port callback.
	MMAL_CONNECTION_FLAG_KEEP_PORT_FORMATS        MMALPortConnectionFlags = 0x0020 // Specify that the connection should not modify the port formats.
	MMAL_CONNECTION_FLAG_MIN                                              = MMAL_CONNECTION_FLAG_TUNNELLING
	MMAL_CONNECTION_FLAG_MAX                                              = MMAL_CONNECTION_FLAG_KEEP_PORT_FORMATS
)

func (MMALPortConnectionFlags) String

func (c MMALPortConnectionFlags) String() string

type MMALRationalNum added in v1.0.10

type MMALRationalNum struct {
	Num, Den int32
}

func (MMALRationalNum) String added in v1.0.10

func (n MMALRationalNum) String() string

type MMALRect added in v1.0.10

type MMALRect struct {
	X, Y int32
	W, H uint32
}

type MMALSubpictureFormat added in v1.0.10

type MMALSubpictureFormat interface {
	MMALFormat
}

type MMALTextJustify added in v1.0.10

type MMALTextJustify uint
const (
	MMAL_TEXT_JUSTIFY_CENTER MMALTextJustify = iota
	MMAL_TEXT_JUSTIFY_LEFT
	MMAL_TEXT_JUSTIFY_RIGHT
	MMAL_TEXT_JUSTIFY_CENTRE = MMAL_TEXT_JUSTIFY_CENTER
)

func (MMALTextJustify) String added in v1.0.10

func (j MMALTextJustify) String() string

type MMALVideoEncLevel added in v1.0.10

type MMALVideoEncLevel uint
const (
	// MMALVideoEncLevel
	MMAL_VIDEO_LEVEL_H263_10 MMALVideoEncLevel = iota
	MMAL_VIDEO_LEVEL_H263_20
	MMAL_VIDEO_LEVEL_H263_30
	MMAL_VIDEO_LEVEL_H263_40
	MMAL_VIDEO_LEVEL_H263_45
	MMAL_VIDEO_LEVEL_H263_50
	MMAL_VIDEO_LEVEL_H263_60
	MMAL_VIDEO_LEVEL_H263_70
	MMAL_VIDEO_LEVEL_MP4V_0
	MMAL_VIDEO_LEVEL_MP4V_0b
	MMAL_VIDEO_LEVEL_MP4V_1
	MMAL_VIDEO_LEVEL_MP4V_2
	MMAL_VIDEO_LEVEL_MP4V_3
	MMAL_VIDEO_LEVEL_MP4V_4
	MMAL_VIDEO_LEVEL_MP4V_4a
	MMAL_VIDEO_LEVEL_MP4V_5
	MMAL_VIDEO_LEVEL_MP4V_6
	MMAL_VIDEO_LEVEL_H264_1
	MMAL_VIDEO_LEVEL_H264_1b
	MMAL_VIDEO_LEVEL_H264_11
	MMAL_VIDEO_LEVEL_H264_12
	MMAL_VIDEO_LEVEL_H264_13
	MMAL_VIDEO_LEVEL_H264_2
	MMAL_VIDEO_LEVEL_H264_21
	MMAL_VIDEO_LEVEL_H264_22
	MMAL_VIDEO_LEVEL_H264_3
	MMAL_VIDEO_LEVEL_H264_31
	MMAL_VIDEO_LEVEL_H264_32
	MMAL_VIDEO_LEVEL_H264_4
	MMAL_VIDEO_LEVEL_H264_41
	MMAL_VIDEO_LEVEL_H264_42
	MMAL_VIDEO_LEVEL_H264_5
	MMAL_VIDEO_LEVEL_H264_51
	MMAL_VIDEO_LEVEL_MIN = MMAL_VIDEO_LEVEL_H263_10
	MMAL_VIDEO_LEVEL_MAX = MMAL_VIDEO_LEVEL_H264_51
)

func (MMALVideoEncLevel) String added in v1.0.10

func (l MMALVideoEncLevel) String() string

type MMALVideoEncProfile added in v1.0.10

type MMALVideoEncProfile uint
const (
	// MMALVideoEncProfile
	MMAL_VIDEO_PROFILE_H263_BASELINE MMALVideoEncProfile = iota
	MMAL_VIDEO_PROFILE_H263_H320CODING
	MMAL_VIDEO_PROFILE_H263_BACKWARDCOMPATIBLE
	MMAL_VIDEO_PROFILE_H263_ISWV2
	MMAL_VIDEO_PROFILE_H263_ISWV3
	MMAL_VIDEO_PROFILE_H263_HIGHCOMPRESSION
	MMAL_VIDEO_PROFILE_H263_INTERNET
	MMAL_VIDEO_PROFILE_H263_INTERLACE
	MMAL_VIDEO_PROFILE_H263_HIGHLATENCY
	MMAL_VIDEO_PROFILE_MP4V_SIMPLE
	MMAL_VIDEO_PROFILE_MP4V_SIMPLESCALABLE
	MMAL_VIDEO_PROFILE_MP4V_CORE
	MMAL_VIDEO_PROFILE_MP4V_MAIN
	MMAL_VIDEO_PROFILE_MP4V_NBIT
	MMAL_VIDEO_PROFILE_MP4V_SCALABLETEXTURE
	MMAL_VIDEO_PROFILE_MP4V_SIMPLEFACE
	MMAL_VIDEO_PROFILE_MP4V_SIMPLEFBA
	MMAL_VIDEO_PROFILE_MP4V_BASICANIMATED
	MMAL_VIDEO_PROFILE_MP4V_HYBRID
	MMAL_VIDEO_PROFILE_MP4V_ADVANCEDREALTIME
	MMAL_VIDEO_PROFILE_MP4V_CORESCALABLE
	MMAL_VIDEO_PROFILE_MP4V_ADVANCEDCODING
	MMAL_VIDEO_PROFILE_MP4V_ADVANCEDCORE
	MMAL_VIDEO_PROFILE_MP4V_ADVANCEDSCALABLE
	MMAL_VIDEO_PROFILE_MP4V_ADVANCEDSIMPLE
	MMAL_VIDEO_PROFILE_H264_BASELINE
	MMAL_VIDEO_PROFILE_H264_MAIN
	MMAL_VIDEO_PROFILE_H264_EXTENDED
	MMAL_VIDEO_PROFILE_H264_HIGH
	MMAL_VIDEO_PROFILE_H264_HIGH10
	MMAL_VIDEO_PROFILE_H264_HIGH422
	MMAL_VIDEO_PROFILE_H264_HIGH444
	MMAL_VIDEO_PROFILE_H264_CONSTRAINED_BASELINE
	MMAL_VIDEO_PROFILE_MIN = MMAL_VIDEO_PROFILE_H263_BASELINE
	MMAL_VIDEO_PROFILE_MAX = MMAL_VIDEO_PROFILE_H264_CONSTRAINED_BASELINE
)

func (MMALVideoEncProfile) String added in v1.0.10

func (p MMALVideoEncProfile) String() string

type MMALVideoFormat added in v1.0.10

type MMALVideoFormat interface {
	MMALFormat

	// Get and set video format parameters
	WidthHeight() (uint32, uint32)
	SetWidthHeight(uint32, uint32)
	Crop() MMALRect
	SetCrop(MMALRect)
	FrameRate() MMALRationalNum
	SetFrameRate(MMALRationalNum)
	PixelAspectRatio() MMALRationalNum
	SetPixelAspectRatio(MMALRationalNum)
	ColorSpace() MMALEncodingType
	SetColorSpace(MMALEncodingType)
}

type MMALVideoParameters

type MMALVideoParameters interface {
	// Get Parameters
	DisplayRegion() (MMALDisplayRegion, error)
	SupportedVideoProfiles() ([]MMALVideoProfile, error)
	VideoProfile() (MMALVideoProfile, error)
	IntraPeriod() (uint32, error)
	MBRowsPerSlice() (uint32, error)
	Bitrate() (uint32, error)
	EncodeMinQuant() (uint32, error)
	EncodeMaxQuant() (uint32, error)
	ExtraBuffers() (uint32, error)
	AlignHoriz() (uint32, error)
	AlignVert() (uint32, error)
	EncodeInitialQuant() (uint32, error)
	EncodeQPP() (uint32, error)
	EncodeRCSliceDQuant() (uint32, error)
	EncodeFrameLimitBits() (uint32, error)
	EncodePeakRate() (uint32, error)
	EncodeH264DeblockIDC() (uint32, error)
	MaxNumCallbacks() (uint32, error)
	DroppablePFrameLength() (uint32, error)
	MinimiseFragmentation() (bool, error)
	RequestIFrame() (bool, error)
	ImmutableInput() (bool, error)
	DroppablePFrames() (bool, error)
	EncodeH264DisableCABAC() (bool, error)
	EncodeH264AUDelimiters() (bool, error)
	EncodeHeaderOnOpen() (bool, error)
	EncodePrecodeForQP() (bool, error)
	TimestampFIFO() (bool, error)
	DecodeErrorConcealment() (bool, error)
	Encode264VCLHRDParameters() (bool, error)
	Encode264LowDelayHRDFlag() (bool, error)
	Encode264EncodeInlineHeader() (bool, error)
	EncodeSEIEnable() (bool, error)
	EncodeInlineVectors() (bool, error)
	InterpolateTimestamps() (bool, error)
	EncodeSPSTiming() (bool, error)
	EncodeSeparateNALBufs() (bool, error)
	EncodeH264LowLatency() (bool, error)

	// Set Parameters
	SetDisplayRegion(MMALDisplayRegion) error
	SetVideoProfile(MMALVideoProfile) error
	SetMBRowsPerSlice(uint32) error
	SetBitrate(uint32) error
	SetEncodeMinQuant(uint32) error
	SetEncodeMaxQuant(uint32) error
	SetExtraBuffers(uint32) error
	SetAlignHoriz(uint32) error
	SetAlignVert(uint32) error
	SetEncodeInitialQuant(uint32) error
	SetEncodeQPP(uint32) error
	SetEncodeRCSliceDQuant(uint32) error
	SetEncodeFrameLimitBits(uint32) error
	SetEncodePeakRate(uint32) error
	SetEncodeH264DeblockIDC(uint32) error
	SetMaxNumCallbacks(uint32) error
	SetDroppablePFrameLength(uint32) error
	SetMinimiseFragmentation(bool) error
	SetRequestIFrame(bool) error
	SetImmutableInput(bool) error
	SetDroppablePFrames(bool) error
	SetEncodeH264DisableCABAC(bool) error
	SetEncodeH264AUDelimiters(bool) error
	SetEncodeHeaderOnOpen(bool) error
	SetEncodePrecodeForQP(bool) error
	SetTimestampFIFO(bool) error
	SetDecodeErrorConcealment(bool) error
	SetEncode264VCLHRDParameters(bool) error
	SetEncode264LowDelayHRDFlag(bool) error
	SetEncode264EncodeInlineHeader(bool) error
	SetEncodeSEIEnable(bool) error
	SetEncodeInlineVectors(bool) error
	SetInterpolateTimestamps(bool) error
	SetEncodeSPSTiming(bool) error
	SetEncodeSeparateNALBufs(bool) error
	SetEncodeH264LowLatency(bool) error
}

type MMALVideoProfile added in v1.0.10

type MMALVideoProfile struct {
	Profile MMALVideoEncProfile
	Level   MMALVideoEncLevel
}

Directories

Path Synopsis
cmd
gpio_ctrl
Outputs GPIO status
Outputs GPIO status
hw_list
Outputs a table of displays - works on RPi at the moment
Outputs a table of displays - works on RPi at the moment
i2c_detect
Detects slaves on the I2C bus
Detects slaves on the I2C bus
lirc_receive
Example command for discovery of RPC microservices using mDNS
Example command for discovery of RPC microservices using mDNS
mmal_camera_preview
MMAL example to connect camera to screen and render the camera image
MMAL example to connect camera to screen and render the camera image
mmal_encode_image
MMAL example to encode an image
MMAL example to encode an image
mmal_video_preview
MMAL example to connect camera to screen and render the camera image
MMAL example to connect camera to screen and render the camera image
pwm_ctrl
Controls PWM on GPIO pins
Controls PWM on GPIO pins
spi_ctrl
Reads bytes from the SPI interface
Reads bytes from the SPI interface
sys
hw
i2c
mmal
This module provides the interface to the Raspberry Pi MMAL (Multimedia Abstraction Layer) library
This module provides the interface to the Raspberry Pi MMAL (Multimedia Abstraction Layer) library
pwm
This module provides the ability to do pulse-width-modulation (PWM) on GPIO pins, affecting both the period of the pulses and the "duty cycle" which determines how long a pulse is "high" for, compared to the "low" state.
This module provides the ability to do pulse-width-modulation (PWM) on GPIO pins, affecting both the period of the pulses and the "duty cycle" which determines how long a pulse is "high" for, compared to the "low" state.
spi

Jump to

Keyboard shortcuts

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