decode

package
v0.0.0-...-b9a5b96 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

README

go-uvc/pkg/decode

This package provides a simple wrapper around FFmpeg's avcodec to decode video frames.

The goal is for ease of use, not flexibility. If you wish to use your own decoder you don't need to use this package.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEAGAIN = fmt.Errorf("EAGAIN")

Functions

This section is empty.

Types

type BGR

type BGR struct {
	// Pix holds the image's pixels, in R, G, B, A order. The pixel at
	// (x, y) starts at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)*3].
	Pix []uint8
	// Stride is the Pix stride (in bytes) between vertically adjacent pixels.
	Stride int
	// Rect is the image's bounds.
	Rect image.Rectangle
}

BGR is an in-memory image whose At method returns color.BGR values.

func (*BGR) At

func (p *BGR) At(x, y int) color.Color

func (*BGR) BGRAAt

func (p *BGR) BGRAAt(x, y int) color.RGBA

func (*BGR) Bounds

func (p *BGR) Bounds() image.Rectangle

func (*BGR) ColorModel

func (p *BGR) ColorModel() color.Model

func (*BGR) PixOffset

func (p *BGR) PixOffset(x, y int) int

PixOffset returns the index of the first element of Pix that corresponds to the pixel at (x, y).

func (*BGR) SubImage

func (p *BGR) SubImage(r image.Rectangle) image.Image

SubImage returns an image representing the portion of the image p visible through r. The returned value shares pixels with the original image.

type FrameReaderDecoder

type FrameReaderDecoder struct {
	// contains filtered or unexported fields
}

func (*FrameReaderDecoder) ReadFrame

func (d *FrameReaderDecoder) ReadFrame() (image.Image, error)

type LibAVCodecDecoder

type LibAVCodecDecoder struct {
	// contains filtered or unexported fields
}

func NewH264Decoder

func NewH264Decoder() (*LibAVCodecDecoder, error)

func NewVP8Decoder

func NewVP8Decoder() (*LibAVCodecDecoder, error)

func (*LibAVCodecDecoder) Close

func (d *LibAVCodecDecoder) Close() error

func (*LibAVCodecDecoder) ReadFrame

func (d *LibAVCodecDecoder) ReadFrame() (image.Image, error)

func (*LibAVCodecDecoder) Write

func (d *LibAVCodecDecoder) Write(pkt []byte) (int, error)

func (*LibAVCodecDecoder) WriteUSBFrame

func (d *LibAVCodecDecoder) WriteUSBFrame(fr *transfers.Frame) error

type MJPEGDecoder

type MJPEGDecoder struct {
	// contains filtered or unexported fields
}

func NewMJPEGDecoder

func NewMJPEGDecoder() (*MJPEGDecoder, error)

func (*MJPEGDecoder) Close

func (d *MJPEGDecoder) Close() error

func (*MJPEGDecoder) ReadFrame

func (d *MJPEGDecoder) ReadFrame() (image.Image, error)

func (*MJPEGDecoder) Write

func (d *MJPEGDecoder) Write(pkt []byte) (int, error)

func (*MJPEGDecoder) WriteUSBFrame

func (d *MJPEGDecoder) WriteUSBFrame(fr *transfers.Frame) error

type RGB

type RGB struct {
	// Pix holds the image's pixels, in R, G, B, A order. The pixel at
	// (x, y) starts at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)*3].
	Pix []uint8
	// Stride is the Pix stride (in bytes) between vertically adjacent pixels.
	Stride int
	// Rect is the image's bounds.
	Rect image.Rectangle
}

RGB is an in-memory image whose At method returns color.RGB values.

func (*RGB) At

func (p *RGB) At(x, y int) color.Color

func (*RGB) Bounds

func (p *RGB) Bounds() image.Rectangle

func (*RGB) ColorModel

func (p *RGB) ColorModel() color.Model

func (*RGB) PixOffset

func (p *RGB) PixOffset(x, y int) int

PixOffset returns the index of the first element of Pix that corresponds to the pixel at (x, y).

func (*RGB) RGBAAt

func (p *RGB) RGBAAt(x, y int) color.RGBA

func (*RGB) SubImage

func (p *RGB) SubImage(r image.Rectangle) image.Image

SubImage returns an image representing the portion of the image p visible through r. The returned value shares pixels with the original image.

type UncompressedDecoder

type UncompressedDecoder struct {
	// contains filtered or unexported fields
}

func NewUncompressedDecoder

func NewUncompressedDecoder(fourcc [4]byte, width, height int) (*UncompressedDecoder, error)

func (*UncompressedDecoder) Close

func (d *UncompressedDecoder) Close() error

func (*UncompressedDecoder) ReadFrame

func (d *UncompressedDecoder) ReadFrame() (image.Image, error)

func (*UncompressedDecoder) Write

func (d *UncompressedDecoder) Write(pkt []byte) (int, error)

func (*UncompressedDecoder) WriteUSBFrame

func (d *UncompressedDecoder) WriteUSBFrame(fr *transfers.Frame) error

type VideoDecoder

type VideoDecoder interface {
	ReadFrame() (image.Image, error)
	Write(pkt []byte) (int, error)
	WriteUSBFrame(fr *transfers.Frame) error
	Close() error
}

Jump to

Keyboard shortcuts

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