mjpeg

package module
v0.0.0-...-a9c60d8 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 16 Imported by: 0

README

mjpeg-go

Motion Jpeg Encoder/Decoder

Installation

go get github.com/ivanlebron/mjpeg-go

License

MIT

Author

Iwan Lebron

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTooLarge reports if more frames cannot be added,
	// else the video file would get corrupted.
	ErrTooLarge = errors.New("video file too large")
)

Functions

This section is empty.

Types

type AviWriter

type AviWriter interface {
	// AddFrame adds a frame from a JPEG encoded data slice.
	AddFrame(jpegData []byte) error

	// Close finalizes and closes the avi file.
	Close() error
}

AviWriter is an *.avi video writer. The video codec is MJPEG.

func New

func New(aviFile string, width, height, fps int32) (awr AviWriter, err error)

New returns a new AviWriter. The Close() method of the AviWriter must be called to finalize the video file.

type Decoder

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

Decoder decode motion jpeg

func NewDecoder

func NewDecoder(r io.Reader, b string) *Decoder

NewDecoder return new instance of Decoder

func NewDecoderFromResponse

func NewDecoderFromResponse(res *http.Response) (*Decoder, error)

NewDecoderFromResponse return new instance of Decoder from http.Response

func NewDecoderFromURL

func NewDecoderFromURL(u string) (*Decoder, error)

NewDecoderFromURL return new instance of Decoder from response which specified URL

func (*Decoder) Decode

func (d *Decoder) Decode() (image.Image, error)

Decode do decoding

func (*Decoder) DecodeRaw

func (d *Decoder) DecodeRaw() ([]byte, error)

DecodeRaw do decoding raw bytes

type Stream

type Stream struct {
	Interval time.Duration
	// contains filtered or unexported fields
}

func NewStream

func NewStream() *Stream

func NewStreamWithInterval

func NewStreamWithInterval(interval time.Duration) *Stream

func (*Stream) Close

func (s *Stream) Close() error

func (*Stream) Closed

func (s *Stream) Closed() bool

func (*Stream) Current

func (s *Stream) Current() []byte

func (*Stream) NWatch

func (s *Stream) NWatch() int

func (*Stream) ServeHTTP

func (s *Stream) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Stream) Update

func (s *Stream) Update(b []byte) error

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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