utils

package
v0.16.4 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidSeekFlag    = errors.New("invalid seek flag")
	ErrInvalidClockFormat = errors.New("invalid clock format")
)
View Source
var (
	ErrBadStatus = errors.New("streamURL bad status code")
)
View Source
var (
	ErrInvalidInput = errors.New("invalid ffmpeg input")
)

Functions

func BuildContentFeatures

func BuildContentFeatures(mediaType string, seek string, transcode bool) (string, error)

BuildContentFeatures builds the content features string for the "contentFeatures.dlna.org" header.

func ClockTimeToSeconds

func ClockTimeToSeconds(strtime string) (int, error)

ClockTimeToSeconds converts relative time to seconds.

func ConvertFilename

func ConvertFilename(s string) string

ConvertFilename is a helper function that percent-encodes a string.

func DurationForMedia

func DurationForMedia(f string) (string, error)

func FormatClockTime

func FormatClockTime(strtime string) (string, error)

FormatClockTime converts clock time to a more expected format of clock time.

func GetMimeDetailsFromFile

func GetMimeDetailsFromFile(f io.ReadCloser) (string, error)

GetMimeDetailsFromFile returns the media file mime details.

func GetMimeDetailsFromStream

func GetMimeDetailsFromStream(s io.ReadCloser) (string, error)

GetMimeDetailsFromStream returns the media URL mime details.

func HostPortIsAlive

func HostPortIsAlive(h string) bool

HostPortIsAlive - We use this function to periodically health check the selected device and decide if we want to keep the entry in the list or to remove it.

func RandomString

func RandomString() (string, error)

RandomString generates a random string which we then use as callback path in our webserver.

func SecondsToClockTime

func SecondsToClockTime(secs int) (string, error)

SecondsToClockTime converts seconds to seconds relative time.

func ServeTranscodedStream

func ServeTranscodedStream(w io.Writer, input interface{}, ff *exec.Cmd) error

ServeTranscodedStream passes an input file or io.Reader to ffmpeg and writes the output directly to our io.Writer.

func StreamURL

func StreamURL(ctx context.Context, s string) (io.ReadCloser, error)

StreamURL returns the response body for the input media URL.

func URLtoListenIPandPort

func URLtoListenIPandPort(u string) (string, error)

URLtoListenIPandPort for a given internal URL, find the correct IP/Interface to listen to.

Types

This section is empty.

Jump to

Keyboard shortcuts

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