streamer

package module
v0.0.0-...-2815f68 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IProcess

type IProcess interface {
	Spawn(path, URI string) *exec.Cmd
}

IProcess is an interface around the FFMPEG process

type IStream

type IStream interface {
	Start() *sync.WaitGroup
	Restart() *sync.WaitGroup
	Stop() error
}

IStream is almost like icecream, that's why it is perfect

type Process

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

Process is the main type for creating new processes

func NewProcess

func NewProcess(
	keepFiles bool,
	audio bool,
) *Process

NewProcess creates a new process able to spawn transcoding FFMPEG processes

func (Process) Spawn

func (p Process) Spawn(path, URI string) *exec.Cmd

Spawn creates a new FFMPEG cmd

type ProcessLoggingOpts

type ProcessLoggingOpts struct {
	Enabled    bool   // Option to set logging for transcoding processes
	Directory  string // Directory for the logs
	MaxSize    int    // Maximum size of kept logging files in megabytes
	MaxBackups int    // Maximum number of old log files to retain
	MaxAge     int    // Maximum number of days to retain an old log file.
	Compress   bool   // Indicates if the log rotation should compress the log files
}

ProcessLoggingOpts describes options for process logging

type Stream

type Stream struct {
	ID          string               `json:"id"`
	Path        string               `json:"path"`
	Running     bool                 `json:"running"`
	CMD         *exec.Cmd            `json:"-"`
	Process     IProcess             `json:"-"`
	Mux         *sync.Mutex          `json:"-"`
	Streak      *hotstreak.Hotstreak `json:"-"`
	OriginalURI string               `json:"-"`
	StorePath   string               `json:"-"`
	KeepFiles   bool                 `json:"-"`
	LoggingOpts *ProcessLoggingOpts  `json:"-"`
	Logger      *lumberjack.Logger   `json:"-"`
	WaitTimeOut time.Duration        `json:"-"`
}

Stream describes a given host's streaming

func NewStream

func NewStream(
	URI string,
	storingDirectory string,
	keepFiles bool,
	audio bool,
	loggingOpts ProcessLoggingOpts,
	waitTimeOut time.Duration,
) (*Stream, string)

NewStream creates a new transcoding process for ffmpeg

func (*Stream) Restart

func (strm *Stream) Restart() *sync.WaitGroup

Restart restarts the given CMD

func (*Stream) Start

func (strm *Stream) Start() *sync.WaitGroup

Start is starting a new transcoding process

func (*Stream) Stop

func (strm *Stream) Stop() error

Stop makes sure that the transcoding process is killed correctly

Jump to

Keyboard shortcuts

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