media

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2025 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MediaMTXWebrtcSession = "webrtcsession"
	MediaMTXRtmpConn      = "rtmpconn"
)

Variables

View Source
var WebrtcConfig = webrtc.Configuration{
	ICEServers: []webrtc.ICEServer{
		{URLs: []string{"stun:stun.l.google.com:19302"}},
	},
}

ICE server configuration. TODO make this configurable

Functions

func GenICELinkHeaders added in v0.8.4

func GenICELinkHeaders(iceServers []webrtc.ICEServer) []string

func MediamtxSourceTypeToString added in v0.8.2

func MediamtxSourceTypeToString(s string) (string, error)

func NoopReader

func NoopReader(reader CloneableReader)

func StartFileCleanup added in v0.8.3

func StartFileCleanup(ctx context.Context, workDir string)

StartFileCleanup starts a goroutine to periodically remove any old temporary files accidentally left behind

Types

type CloneableReader added in v0.8.2

type CloneableReader interface {
	io.Reader
	Clone() CloneableReader
}

type EOSReader

type EOSReader struct{}

func (*EOSReader) Clone added in v0.8.2

func (r *EOSReader) Clone() CloneableReader

func (*EOSReader) Read

func (r *EOSReader) Read(p []byte) (n int, err error)

type IncomingTrack added in v0.8.4

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

func (*IncomingTrack) ClockRate added in v0.8.4

func (t *IncomingTrack) ClockRate() int

ClockRate returns the clock rate. Needed by rtptime.GlobalDecoder

func (*IncomingTrack) PTSEqualsDTS added in v0.8.4

func (*IncomingTrack) PTSEqualsDTS(*rtp.Packet) bool

PTSEqualsDTS returns whether PTS equals DTS. Needed by rtptime.GlobalDecoder TODO handle bframes; look at mediamtx

type MediaMTXClient added in v0.8.1

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

func NewMediaMTXClient added in v0.8.1

func NewMediaMTXClient(host, apiPassword, sourceID, sourceType string) *MediaMTXClient

func (*MediaMTXClient) KickInputConnection added in v0.8.1

func (mc *MediaMTXClient) KickInputConnection(ctx context.Context) error

func (*MediaMTXClient) StreamExists added in v0.8.1

func (mc *MediaMTXClient) StreamExists() (bool, error)

type MediaReader added in v0.8.2

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

func (*MediaReader) Clone added in v0.8.2

func (mr *MediaReader) Clone() CloneableReader

func (*MediaReader) Read added in v0.8.2

func (mr *MediaReader) Read(p []byte) (int, error)

type MediaSegmenter

type MediaSegmenter struct {
	Workdir        string
	MediaMTXClient *MediaMTXClient
}

func (*MediaSegmenter) RunSegmentation

func (ms *MediaSegmenter) RunSegmentation(ctx context.Context, in string, segmentHandler SegmentHandler)

type MediaState added in v0.8.4

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

MediaState manages the lifecycle of a media connection

func NewMediaState added in v0.8.4

func NewMediaState(pc WHIPPeerConnection) *MediaState

NewMediaState creates a new MediaState with the given peerconnection

func (*MediaState) AwaitClose added in v0.8.4

func (m *MediaState) AwaitClose()

AwaitClose blocks until the connection is closed

func (*MediaState) Close added in v0.8.4

func (m *MediaState) Close()

Close closes the underlying connection and signals any waiters

type MediaWriter added in v0.8.2

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

func NewMediaWriter added in v0.8.2

func NewMediaWriter() *MediaWriter

func (*MediaWriter) Close added in v0.8.2

func (mw *MediaWriter) Close()

func (*MediaWriter) MakeReader added in v0.8.2

func (mw *MediaWriter) MakeReader() CloneableReader

func (*MediaWriter) Write added in v0.8.2

func (mw *MediaWriter) Write(data []byte) (int, error)

type RTPSegmenter added in v0.8.4

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

func NewRTPSegmenter added in v0.8.4

func NewRTPSegmenter(tracks []RTPTrack, ssr *SwitchableSegmentReader) *RTPSegmenter

func (*RTPSegmenter) CloseSegment added in v0.8.4

func (s *RTPSegmenter) CloseSegment()

func (*RTPSegmenter) IsReady added in v0.8.4

func (s *RTPSegmenter) IsReady() bool

func (*RTPSegmenter) StartSegment added in v0.8.4

func (s *RTPSegmenter) StartSegment(startTs int64)

func (*RTPSegmenter) WriteAudio added in v0.8.4

func (s *RTPSegmenter) WriteAudio(source RTPTrack, pts int64, au [][]byte) error

func (*RTPSegmenter) WriteVideo added in v0.8.4

func (s *RTPSegmenter) WriteVideo(source RTPTrack, pts, dts int64, au [][]byte) error

type RTPTrack added in v0.8.4

type RTPTrack interface {
	Codec() webrtc.RTPCodecParameters
}

type SegmentHandler

type SegmentHandler func(reader CloneableReader)

type SwitchableSegmentReader

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

func NewSwitchableSegmentReader

func NewSwitchableSegmentReader() *SwitchableSegmentReader

func (*SwitchableSegmentReader) Close

func (sr *SwitchableSegmentReader) Close()

func (*SwitchableSegmentReader) Read

func (sr *SwitchableSegmentReader) Read(reader CloneableReader)

func (*SwitchableSegmentReader) SwitchReader

func (sr *SwitchableSegmentReader) SwitchReader(newReader SegmentHandler)

type WHIPConnection added in v0.8.4

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

use this to set peerconnection state when we need it kinda convoluted because the peerconnection gets created async separate from the goroutines where it might be closed from

func NewWHIPConnection added in v0.8.4

func NewWHIPConnection() *WHIPConnection

func (*WHIPConnection) AwaitClose added in v0.8.4

func (w *WHIPConnection) AwaitClose()

func (*WHIPConnection) Close added in v0.8.4

func (w *WHIPConnection) Close()

func (*WHIPConnection) SetWHIPConnection added in v0.8.4

func (w *WHIPConnection) SetWHIPConnection(p *MediaState)

type WHIPPeerConnection added in v0.8.4

type WHIPPeerConnection interface {
	io.Closer
}

type WHIPServer added in v0.8.4

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

func NewWHIPServer added in v0.8.4

func NewWHIPServer() *WHIPServer

func (*WHIPServer) CreateWHIP added in v0.8.4

handleCreate implements the POST that creates a new resource.

Jump to

Keyboard shortcuts

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