streamcore

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenditionDefaultIndex

func RenditionDefaultIndex(renditions []*Rendition) int

func SortResponses

func SortResponses(items []*StreamResponse)

func UpstreamEnabled

func UpstreamEnabled(upstream *Upstream) bool

func UpstreamName

func UpstreamName(index int, upstream *Upstream) string

func UpstreamServeStream

func UpstreamServeStream(upstream *Upstream) bool

func UpstreamSourceType

func UpstreamSourceType(upstream *Upstream) string

func UpstreamUsesUSBFFmpeg added in v1.1.0

func UpstreamUsesUSBFFmpeg(upstream *Upstream) bool

func ValidateUpstream

func ValidateUpstream(upstream *Upstream) error

func VariantName

func VariantName(groupName, renditionName string) string

Types

type CapabilitiesResponse

type CapabilitiesResponse struct {
	Name         string                         `json:"name"`
	SourceType   string                         `json:"sourceType"`
	Device       string                         `json:"device,omitempty"`
	Capabilities *gwebrtp.UsbDeviceCapabilities `json:"capabilities,omitempty"`
}

type Config

type Config struct {
	TelemetryServiceName *string     `yaml:"telemetryServiceName"`
	TelemetryEndpoint    *string     `yaml:"telemetryEndpoint"`
	Upstreams            []*Upstream `yaml:"upstreams"`
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

type Group

type Group struct {
	Name     string
	Upstream *Upstream
	Streams  []*Stream
	Default  *Stream
}

type Manager

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

func NewManager

func NewManager(options ...ManagerOption) (*Manager, error)

func (*Manager) CalibrationTargets

func (m *Manager) CalibrationTargets(name, quality string) []*Stream

func (*Manager) Capabilities

func (m *Manager) Capabilities(name string) (*CapabilitiesResponse, bool, error)

func (*Manager) Close

func (m *Manager) Close()

func (*Manager) Create

func (m *Manager) Create(req *StreamRequest) (*StreamResponse, error)

func (*Manager) Delete

func (m *Manager) Delete(name string) error

func (*Manager) Get

func (m *Manager) Get(name string) (*StreamResponse, bool)

func (*Manager) List

func (m *Manager) List() []*Stream

func (*Manager) ListExpanded

func (m *Manager) ListExpanded() []*Stream

func (*Manager) ListExpandedActive

func (m *Manager) ListExpandedActive() []*Stream

func (*Manager) ListResponses

func (m *Manager) ListResponses() []*StreamResponse

func (*Manager) Save

func (m *Manager) Save() error

func (*Manager) SetEnabled

func (m *Manager) SetEnabled(name string, enabled bool) (*StreamResponse, error)

func (*Manager) Start

func (m *Manager) Start(name, quality string) (*StreamResponse, error)

func (*Manager) Stop

func (m *Manager) Stop(name, quality string) (*StreamResponse, error)

func (*Manager) StreamByIndex

func (m *Manager) StreamByIndex(index int) (*Stream, bool)

func (*Manager) StreamByName

func (m *Manager) StreamByName(name string) (*Stream, bool)

func (*Manager) StreamByNameAny

func (m *Manager) StreamByNameAny(name string) (*Stream, bool)

func (*Manager) StreamByNameQuality

func (m *Manager) StreamByNameQuality(name, quality string) (*Stream, bool)

func (*Manager) StreamByNameQualityAny

func (m *Manager) StreamByNameQualityAny(name, quality string) (*Stream, bool)

func (*Manager) Update

func (m *Manager) Update(name string, req *StreamRequest) (*StreamResponse, error)

func (*Manager) UpdateMode

func (m *Manager) UpdateMode(name string, req *ModeRequest) (*StreamResponse, error)

type ManagerOption

type ManagerOption func(*managerOptions) error

func WithConfig

func WithConfig(cfg *Config) ManagerOption

func WithConfigFile

func WithConfigFile(path string) ManagerOption

type ModeRequest

type ModeRequest struct {
	Width     int      `json:"width"`
	Height    int      `json:"height"`
	FrameRate *float64 `json:"frameRate"`
}

type Rendition

type Rendition struct {
	Name         string   `yaml:"name" json:"name"`
	Width        *int     `yaml:"width,omitempty" json:"width,omitempty"`
	Height       *int     `yaml:"height,omitempty" json:"height,omitempty"`
	FrameRate    *float64 `yaml:"frameRate,omitempty" json:"frameRate,omitempty"`
	BitrateKbps  *int     `yaml:"bitrateKbps,omitempty" json:"bitrateKbps,omitempty"`
	FFmpegFilter string   `yaml:"ffmpegFilter,omitempty" json:"ffmpegFilter,omitempty"`
	OnDemand     *bool    `yaml:"onDemand,omitempty" json:"onDemand,omitempty"`
}

type RenditionResponse

type RenditionResponse struct {
	Name         string               `json:"name"`
	Width        *int                 `json:"width,omitempty"`
	Height       *int                 `json:"height,omitempty"`
	FrameRate    *float64             `json:"frameRate,omitempty"`
	BitrateKbps  *int                 `json:"bitrateKbps,omitempty"`
	FFmpegFilter string               `json:"ffmpegFilter,omitempty"`
	OnDemand     bool                 `json:"onDemand"`
	WsPath       string               `json:"wsPath"`
	Stats        *gwebrtp.StreamStats `json:"stats,omitempty"`
}

type Stream

type Stream struct {
	Name          string
	GroupName     string
	RenditionName string
	URL           string
	Inst          *gwebrtp.Instance
	Hub           *gwebrtp.Hub
	Stop          func() error
	OnDemand      bool
	// contains filtered or unexported fields
}

func (*Stream) ActiveClientCount

func (s *Stream) ActiveClientCount() int32

func (*Stream) EnsureStarted

func (s *Stream) EnsureStarted()

func (*Stream) FiberHandler

func (s *Stream) FiberHandler() fiber.Handler

func (*Stream) HandleWebsocket

func (s *Stream) HandleWebsocket(conn *websocket.Conn)

func (*Stream) HasActiveRecording

func (s *Stream) HasActiveRecording() bool

func (*Stream) MaybeScheduleStop

func (s *Stream) MaybeScheduleStop(idle time.Duration)

func (*Stream) StopNow

func (s *Stream) StopNow() error

type StreamRequest

type StreamRequest struct {
	Name              *string           `json:"name"`
	SourceType        *string           `json:"sourceType"`
	RtspUrl           string            `json:"rtspUrl"`
	Device            string            `json:"device"`
	Path              string            `json:"path"`
	Codec             string            `json:"codec"`
	FFmpegInputFormat string            `json:"ffmpegInputFormat"`
	FFmpegInputArgs   []string          `json:"ffmpegInputArgs"`
	FFmpegFilter      string            `json:"ffmpegFilter"`
	FFmpegEncoder     string            `json:"ffmpegEncoder"`
	FFmpegEncoderArgs []string          `json:"ffmpegEncoderArgs"`
	Width             *int              `json:"width"`
	Height            *int              `json:"height"`
	FrameRate         *float64          `json:"frameRate"`
	BitrateKbps       *int              `json:"bitrateKbps"`
	ServeStream       *bool             `json:"serveStream,omitempty"`
	CalibrationFrom   string            `json:"calibrationFrom,omitempty"`
	KeyframeSink      string            `json:"keyframeSink,omitempty"`
	KeyframeOutput    string            `json:"keyframeOutput,omitempty"`
	KeyframeFormat    string            `json:"keyframeFormat,omitempty"`
	KeyframeMqttURL   string            `json:"keyframeMqttUrl,omitempty"`
	KeyframeMqttTopic string            `json:"keyframeMqttTopic,omitempty"`
	Keyframer         gwebrtp.Keyframer `json:"-"`
	Enabled           *bool             `json:"enabled"`
	OnDemand          bool              `json:"onDemand"`
	Renditions        []*Rendition      `json:"renditions"`
}

type StreamResponse

type StreamResponse struct {
	Index             int                  `json:"index"`
	Name              string               `json:"name"`
	SourceType        string               `json:"sourceType"`
	RtspUrl           string               `json:"rtspUrl,omitempty"`
	Device            string               `json:"device,omitempty"`
	Path              string               `json:"path,omitempty"`
	Codec             string               `json:"codec,omitempty"`
	FFmpegInputFormat string               `json:"ffmpegInputFormat,omitempty"`
	FFmpegInputArgs   []string             `json:"ffmpegInputArgs,omitempty"`
	FFmpegFilter      string               `json:"ffmpegFilter,omitempty"`
	FFmpegEncoder     string               `json:"ffmpegEncoder,omitempty"`
	FFmpegEncoderArgs []string             `json:"ffmpegEncoderArgs,omitempty"`
	Width             *int                 `json:"width,omitempty"`
	Height            *int                 `json:"height,omitempty"`
	FrameRate         *float64             `json:"frameRate,omitempty"`
	BitrateKbps       *int                 `json:"bitrateKbps,omitempty"`
	ServeStream       bool                 `json:"serveStream"`
	CalibrationFrom   string               `json:"calibrationFrom,omitempty"`
	KeyframeSink      string               `json:"keyframeSink,omitempty"`
	KeyframeOutput    string               `json:"keyframeOutput,omitempty"`
	KeyframeFormat    string               `json:"keyframeFormat,omitempty"`
	KeyframeMqttURL   string               `json:"keyframeMqttUrl,omitempty"`
	KeyframeMqttTopic string               `json:"keyframeMqttTopic,omitempty"`
	Enabled           bool                 `json:"enabled"`
	OnDemand          bool                 `json:"onDemand,omitempty"`
	URL               string               `json:"url"`
	WsPath            string               `json:"wsPath"`
	Stats             *gwebrtp.StreamStats `json:"stats"`
	Renditions        []*RenditionResponse `json:"renditions,omitempty"`
	ActiveRendition   string               `json:"activeRendition,omitempty"`
}

type Upstream

type Upstream struct {
	Name              *string           `yaml:"name" json:"name,omitempty"`
	SourceType        *string           `yaml:"sourceType" json:"sourceType,omitempty"`
	RtspUrl           string            `yaml:"rtspUrl" json:"rtspUrl,omitempty"`
	Device            string            `yaml:"device" json:"device,omitempty"`
	Path              string            `yaml:"path" json:"path,omitempty"`
	Codec             string            `yaml:"codec" json:"codec,omitempty"`
	FFmpegInputFormat string            `yaml:"ffmpegInputFormat" json:"ffmpegInputFormat,omitempty"`
	FFmpegInputArgs   []string          `yaml:"ffmpegInputArgs" json:"ffmpegInputArgs,omitempty"`
	FFmpegFilter      string            `yaml:"ffmpegFilter" json:"ffmpegFilter,omitempty"`
	FFmpegEncoder     string            `yaml:"ffmpegEncoder" json:"ffmpegEncoder,omitempty"`
	FFmpegEncoderArgs []string          `yaml:"ffmpegEncoderArgs" json:"ffmpegEncoderArgs,omitempty"`
	H264Profile       *string           `yaml:"h264Profile" json:"h264Profile,omitempty"`
	Width             *int              `yaml:"width" json:"width,omitempty"`
	Height            *int              `yaml:"height" json:"height,omitempty"`
	FrameRate         *float64          `yaml:"frameRate" json:"frameRate,omitempty"`
	BitrateKbps       *int              `yaml:"bitrateKbps" json:"bitrateKbps,omitempty"`
	ServeStream       *bool             `yaml:"serveStream,omitempty" json:"serveStream,omitempty"`
	CalibrationFrom   string            `yaml:"calibrationFrom,omitempty" json:"calibrationFrom,omitempty"`
	KeyframeSink      string            `yaml:"keyframeSink" json:"keyframeSink,omitempty"`
	KeyframeOutput    string            `yaml:"keyframeOutput" json:"keyframeOutput,omitempty"`
	KeyframeFormat    string            `yaml:"keyframeFormat" json:"keyframeFormat,omitempty"`
	KeyframeMqttURL   string            `yaml:"keyframeMqttUrl,omitempty" json:"keyframeMqttUrl,omitempty"`
	KeyframeMqttTopic string            `yaml:"keyframeMqttTopic,omitempty" json:"keyframeMqttTopic,omitempty"`
	Keyframer         gwebrtp.Keyframer `yaml:"-" json:"-"`
	Enabled           *bool             `yaml:"enabled" json:"enabled,omitempty"`
	OnDemand          bool              `yaml:"onDemand" json:"onDemand,omitempty"`
	Renditions        []*Rendition      `yaml:"renditions" json:"renditions,omitempty"`
}

func RequestUpstream

func RequestUpstream(req *StreamRequest) (*Upstream, error)

func UpstreamWithRendition

func UpstreamWithRendition(upstream *Upstream, rendition *Rendition) *Upstream

Jump to

Keyboard shortcuts

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