Documentation
¶
Overview ¶
Package gomjpeg provides a client for fetching and decoding MJPEG streams.
Index ¶
- type Mjpeg
- func (m *Mjpeg) GetControlChannel() chan StreamControl
- func (m *Mjpeg) GetStatusChannel() chan StatusCode
- func (m *Mjpeg) GetStatusCode() StatusCode
- func (m *Mjpeg) GetStatusCodeString() string
- func (m *Mjpeg) Pause()
- func (m *Mjpeg) ResetTimer(duration int)
- func (m *Mjpeg) Resume()
- func (m *Mjpeg) Start() chan image.Image
- func (m *Mjpeg) Stop()
- type MjpegOpts
- type StatusCode
- type StreamControl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mjpeg ¶
type Mjpeg struct {
// ImageStream is a channel that receives decoded images from the stream.
ImageStream chan image.Image
// EnableLog enables or disables logging.
EnableLog bool
// contains filtered or unexported fields
}
Mjpeg represents an MJPEG stream client.
func NewMjpeg ¶
NewMjpeg creates a new Mjpeg client with the given options. It loads environment variables from a .env file to override the options.
func (*Mjpeg) GetControlChannel ¶
func (m *Mjpeg) GetControlChannel() chan StreamControl
GetControlChannel returns the channel for controlling the stream.
func (*Mjpeg) GetStatusChannel ¶
func (m *Mjpeg) GetStatusChannel() chan StatusCode
GetStatusChannel returns the channel for receiving status updates.
func (*Mjpeg) GetStatusCode ¶
func (m *Mjpeg) GetStatusCode() StatusCode
GetStatusCode returns the current status code of the stream.
func (*Mjpeg) GetStatusCodeString ¶
GetStatusCodeString returns the current status as a string.
func (*Mjpeg) ResetTimer ¶
ResetTimer resets the auto-stop timer with a new duration.
type MjpegOpts ¶
type MjpegOpts struct {
// URL of the MJPEG stream.
URL string
// AutoStopTimer stops the stream after the specified duration in seconds.
// A value of -1 disables the auto-stop timer.
AutoStopTimer int
// Resize enables resizing of the received JPEG images.
Resize bool
// Width of the resized image.
Width int
// Height of the resized image.
Height int
// EnableLog enables or disables logging.
EnableLog bool
}
MjpegOpts holds configuration options for the MJPEG stream.
type StatusCode ¶
type StatusCode int
StatusCode represents the status of the MJPEG stream.
const ( StatusPlaying StatusCode = iota StatusStopped StatusError StatusPaused )
type StreamControl ¶
type StreamControl int
StreamControl represents a command to control the MJPEG stream.
const ( StartStream StreamControl = iota StopStream PauseStream ResumeStream )