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

ipcamera

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaptureOption

type CaptureOption func(*captureOptions)

func WithLogger

func WithLogger(logger *slog.Logger) CaptureOption

type Config

type Config struct {
	Id          string                            `json:"id" validate:"required"`
	Disabled    bool                              `json:"disabled"`
	Address     netip.Addr                        `json:"address" validate:"required"`
	Credentials *UsernamePasswordCredentialConfig `json:"credentials"`
	Streams     []StreamConfig                    `json:"streams" validate:"dive"`
}

func (Config) Stream

func (cfg Config) Stream(id string) *StreamConfig

type Dimensions

type Dimensions struct {
	Width  int `json:"width" validate:"required"`
	Height int `json:"height" validate:"required"`
}

type FFMPEGRecording

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

func (*FFMPEGRecording) Close

func (recording *FFMPEGRecording) Close() error

func (*FFMPEGRecording) Config added in v0.10.0

func (recording *FFMPEGRecording) Config() Config

func (*FFMPEGRecording) OutputPath

func (recording *FFMPEGRecording) OutputPath() string

func (*FFMPEGRecording) Start

func (recording *FFMPEGRecording) Start(ctx context.Context) error

func (*FFMPEGRecording) StreamConfig added in v0.10.0

func (recording *FFMPEGRecording) StreamConfig() StreamConfig

type IPCamera

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

func New

func New(cfg Config) *IPCamera

func (*IPCamera) Capture

func (camera *IPCamera) Capture(streamId string, outputPath string, options ...CaptureOption) (Recording, error)

func (*IPCamera) Config added in v0.10.0

func (camera *IPCamera) Config() Config

func (*IPCamera) HasStream added in v0.9.0

func (camera *IPCamera) HasStream(streamId string) bool

func (*IPCamera) StreamIdsWithTag added in v0.9.0

func (camera *IPCamera) StreamIdsWithTag(tag string) []string

type MJPEGServer

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

func NewMJPEGServer

func NewMJPEGServer(cfg Config) (*MJPEGServer, error)

func (*MJPEGServer) Close

func (mjpegServer *MJPEGServer) Close() error

func (*MJPEGServer) ServeMux

func (mjpegServer *MJPEGServer) ServeMux() *http.ServeMux

func (*MJPEGServer) Start

func (mjpegServer *MJPEGServer) Start(ctx context.Context) error

type MJPEGStream

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

func NewMJPEGStream

func NewMJPEGStream(cfg Config, streamCfg StreamConfig, httpClient *http.Client) (*MJPEGStream, error)

func (*MJPEGStream) Close

func (mjpegStream *MJPEGStream) Close() error

func (*MJPEGStream) ServeHTTP

func (mjpegStream *MJPEGStream) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*MJPEGStream) Start

func (mjpegStream *MJPEGStream) Start(ctx context.Context) error

type Recording

type Recording interface {
	io.Closer

	Config() Config
	StreamConfig() StreamConfig
	OutputPath() string
	Start(ctx context.Context) error
}

type StreamConfig

type StreamConfig struct {
	Id          string                            `json:"id" validate:"required"`
	Disabled    bool                              `json:"disabled"`
	Tags        []string                          `json:"tags"`
	Credentials *UsernamePasswordCredentialConfig `json:"credentials"`
	Type        StreamType                        `json:"type" validate:"required"`
	Port        uint16                            `json:"port"`
	Path        string                            `json:"path"`
	Timeout     time.Duration                     `json:"timeout"`
	Dimensions  *Dimensions                       `json:"dimensions"`
}

func (StreamConfig) ResolveCredentials

func (streamConfig StreamConfig) ResolveCredentials(cfg Config) *UsernamePasswordCredentialConfig

func (StreamConfig) ResolveURLHost

func (streamConfig StreamConfig) ResolveURLHost(cfg Config) string

func (StreamConfig) ToURL

func (streamConfig StreamConfig) ToURL(cfg Config, includeCredentials bool) (*url.URL, error)

type StreamType

type StreamType string
const (
	StreamTypeRTSPOverUDP          StreamType = "rtsp/udp"
	StreamTypeRTSPOverTCP          StreamType = "rtsp/tcp"
	StreamTypeRTSPOverUDPMulticast StreamType = "rtsp/udp-multicast"
	StreamTypeRTSPOverHTTP         StreamType = "rtsp/http"
	StreamTypeMJPEGOverHTTP        StreamType = "mjpeg/http"
)

func (StreamType) MarshalText

func (streamType StreamType) MarshalText() ([]byte, error)

func (StreamType) String

func (streamType StreamType) String() string

func (*StreamType) UnmarshalText

func (streamType *StreamType) UnmarshalText(b []byte) error

type UsernamePasswordCredentialConfig

type UsernamePasswordCredentialConfig struct {
	Username string `json:"username" validate:"required"`
	Password string `json:"password" validate:"required"`
}

Jump to

Keyboard shortcuts

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