services

package
v0.0.0-...-269a3ce Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutputFlag = "output"

	UseSnapshotFlag  = "use-snapshot"
	StreamModeFlag   = "stream-mode"
	KeyPrefixFlag    = "key-prefix"
	ToCompletionFlag = "to-completion"
)
View Source
const (
	WebGraceFlag = "grace"
)

Variables

View Source
var DefaultRenditions = []Rendition{
	{
		Height:   240,
		DefRate:  500,
		Required: true,
	},
	{
		Height:   360,
		DefRate:  1000,
		Required: true,
	},
	{
		Height:  480,
		DefRate: 2500,
	},
	{
		Height:  720,
		DefRate: 5000,
	},
	{
		Height:  1080,
		DefRate: 8000,
	},
}

https://support.google.com/youtube/answer/1722171?hl=en#zippy=%2Cbitrate

Functions

func NewBufferedResponseWrtier

func NewBufferedResponseWrtier(w http.ResponseWriter) *bufferedResponseWriter

func RegisterCommonFlags

func RegisterCommonFlags(c *cli.App)

func RegisterContentProberFlags

func RegisterContentProberFlags(c *cli.App)

func RegisterS3SessionFlags

func RegisterS3SessionFlags(c *cli.App)

func RegisterS3StorageFlags

func RegisterS3StorageFlags(c *cli.App)

func RegisterServerWithErrorFlags

func RegisterServerWithErrorFlags(c *cli.App)

func RegisterSnapshotFlags

func RegisterSnapshotFlags(c *cli.App)

func RegisterWebExpireFlags

func RegisterWebExpireFlags(c *cli.App)

func RegisterWebFlags

func RegisterWebFlags(c *cli.App)

Types

type AccessLock

type AccessLock struct {
	C chan error
	// contains filtered or unexported fields
}

func NewAccessLock

func NewAccessLock() *AccessLock

func (*AccessLock) Unlock

func (al *AccessLock) Unlock()

func (*AccessLock) Unlocked

func (al *AccessLock) Unlocked() chan error

type ContentProbe

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

func NewContentProbe

func NewContentProbe(c *cli.Context) *ContentProbe

func (*ContentProbe) Get

func (s *ContentProbe) Get() (*cp.ProbeReply, error)

type Counter

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

func NewCounter

func NewCounter() *Counter

func (*Counter) Add

func (s *Counter) Add(n uint64)

func (*Counter) Count

func (s *Counter) Count() uint64

func (*Counter) NewResponseWriter

func (s *Counter) NewResponseWriter(w http.ResponseWriter) *responseWriterCounter

type DownloadedSizeFetcher

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

func NewDownloadedSizeFetcher

func NewDownloadedSizeFetcher(ctx context.Context, st *S3Storage, key *Key) *DownloadedSizeFetcher

func (*DownloadedSizeFetcher) Fetch

func (s *DownloadedSizeFetcher) Fetch() (uint64, error)

type DownloadedSizePool

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

func NewDownloadSizePool

func NewDownloadSizePool(st *S3Storage, counter *Counter, key *Key, isf *DownloadedSizeFetcher) *DownloadedSizePool

func (*DownloadedSizePool) Handle

func (s *DownloadedSizePool) Handle(h Handleable)

func (*DownloadedSizePool) Push

func (s *DownloadedSizePool) Push(size uint64) error

type DownloadedSizePusher

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

func NewDownloadedSizePusher

func NewDownloadedSizePusher(ctx context.Context, st *S3Storage, key string, size uint64) *DownloadedSizePusher

func (*DownloadedSizePusher) Push

func (s *DownloadedSizePusher) Push() error

type HLS

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

func NewHLS

func NewHLS(in string, out string, probe *cp.ProbeReply, sm StreamMode) *HLS

func (*HLS) GetFFmpegParams

func (h *HLS) GetFFmpegParams() ([]string, error)

func (*HLS) MakeMasterPlaylist

func (s *HLS) MakeMasterPlaylist() error

type HLSParser

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

func NewHLSParser

func NewHLSParser(c *cli.Context, pr *ContentProbe) *HLSParser

func (*HLSParser) Get

func (s *HLSParser) Get() (*HLS, error)

type HLSStream

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

func NewHLSStream

func NewHLSStream(index int, st StreamType, out string, s *cp.Stream, r *Rendition, force bool) *HLSStream

func (*HLSStream) GetCodecParams

func (h *HLSStream) GetCodecParams() []string

func (*HLSStream) GetFFmpegParams

func (h *HLSStream) GetFFmpegParams() []string

func (*HLSStream) GetLanguage

func (h *HLSStream) GetLanguage() string

func (*HLSStream) GetName

func (h *HLSStream) GetName() string

func (*HLSStream) GetPlaylistName

func (h *HLSStream) GetPlaylistName() string

func (*HLSStream) GetPlaylistPath

func (h *HLSStream) GetPlaylistPath() string

func (*HLSStream) GetSegmentExtension

func (h *HLSStream) GetSegmentExtension() string

func (*HLSStream) GetSegmentFormat

func (h *HLSStream) GetSegmentFormat() string

func (*HLSStream) MakeMasterPlaylist

func (h *HLSStream) MakeMasterPlaylist() string

type Handleable

type Handleable interface {
	Handle(h func(h http.Handler) http.Handler)
}

type Key

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

func NewKey

func NewKey(c *cli.Context) *Key

func (*Key) Get

func (s *Key) Get() string

type OriginalSizeFetcher

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

func NewOriginalSizeFetcher

func NewOriginalSizeFetcher(c *cli.Context, cl *http.Client) *OriginalSizeFetcher

func (*OriginalSizeFetcher) Fetch

func (s *OriginalSizeFetcher) Fetch() (uint64, error)

type Rendition

type Rendition struct {
	Height   uint
	DefRate  uint
	Required bool
}

func (*Rendition) Rate

func (s *Rendition) Rate() uint

type S3Client

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

func NewS3Client

func NewS3Client(sess *S3Session) *S3Client

func (*S3Client) Get

func (s *S3Client) Get() *s3.S3

type S3Session

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

S3Client makes AWS SDK S3 Client from cli and environment variables

func NewS3Session

func NewS3Session(c *cli.Context, cl *http.Client) *S3Session

func (*S3Session) Get

func (s *S3Session) Get() *session.Session

type S3Storage

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

func NewS3Storage

func NewS3Storage(c *cli.Context, cl *S3Client, sess *S3Session) *S3Storage

func (*S3Storage) CheckDoneMarker

func (s *S3Storage) CheckDoneMarker(ctx context.Context, key string) (bool, error)

func (*S3Storage) FetchDownloadedSize

func (s *S3Storage) FetchDownloadedSize(ctx context.Context, key string) (uint64, error)

func (*S3Storage) SetDoneMarker

func (s *S3Storage) SetDoneMarker(ctx context.Context, key string) (err error)

func (*S3Storage) StoreDownloadedSize

func (s *S3Storage) StoreDownloadedSize(ctx context.Context, key string, i uint64) (err error)

func (*S3Storage) Touch

func (s *S3Storage) Touch(ctx context.Context, key string) (err error)

func (*S3Storage) Upload

func (s *S3Storage) Upload(ctx context.Context, key string, out string) error

type ServeWithStatus

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

func NewServeWithStatus

func NewServeWithStatus(c *cli.Context, s cs.Servable, eh func(err error)) *ServeWithStatus

func (*ServeWithStatus) Serve

func (s *ServeWithStatus) Serve() (err error)

type Snapshotter

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

func NewSpapshotter

func NewSpapshotter(c *cli.Context, co *Counter, st *S3Storage, key *Key, transcoder *Transcoder, osf *OriginalSizeFetcher, dsf *DownloadedSizeFetcher) *Snapshotter

func (*Snapshotter) Close

func (s *Snapshotter) Close()

func (*Snapshotter) Serve

func (s *Snapshotter) Serve() error

type StreamMode

type StreamMode int
const (
	Online       StreamMode = 0
	MultiBitrate StreamMode = 1
)

type StreamType

type StreamType string
const (
	Audio    StreamType = "a"
	Video    StreamType = "v"
	Subtitle StreamType = "s"
)

type TouchPool

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

func NewTouchPool

func NewTouchPool(st *S3Storage, key *Key) *TouchPool

func (*TouchPool) Handle

func (s *TouchPool) Handle(h Handleable)

func (*TouchPool) Touch

func (s *TouchPool) Touch() error

type Toucher

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

func NewToucher

func NewToucher(ctx context.Context, st *S3Storage, key string) *Toucher

func (*Toucher) Touch

func (s *Toucher) Touch() error

type Transcoder

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

func NewTranscoder

func NewTranscoder(c *cli.Context, h *HLSParser) *Transcoder

func (*Transcoder) Close

func (s *Transcoder) Close() error

func (*Transcoder) Serve

func (s *Transcoder) Serve() (err error)

type Waiter

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

func NewWaiter

func NewWaiter(c *cli.Context, re *regexp.Regexp) *Waiter

func (*Waiter) Close

func (s *Waiter) Close()

func (*Waiter) Handle

func (s *Waiter) Handle(h Handleable)

func (*Waiter) Serve

func (s *Waiter) Serve() error

func (*Waiter) Wait

func (s *Waiter) Wait(ctx context.Context, path string) chan error

type Web

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

func NewWeb

func NewWeb(c *cli.Context, h *HLSParser) *Web

func (*Web) Close

func (s *Web) Close()

func (*Web) Handle

func (s *Web) Handle(h func(h http.Handler) http.Handler)

func (*Web) Serve

func (s *Web) Serve() error

type WebExpire

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

func NewWebExpire

func NewWebExpire(c *cli.Context) *WebExpire

func (*WebExpire) Expire

func (s *WebExpire) Expire() <-chan time.Time

func (*WebExpire) Handle

func (s *WebExpire) Handle(h Handleable)

func (*WebExpire) NewResponseWriter

func (s *WebExpire) NewResponseWriter(w http.ResponseWriter) *expireResponseWriter

func (*WebExpire) Reset

func (s *WebExpire) Reset()

func (*WebExpire) Serve

func (s *WebExpire) Serve() error

Jump to

Keyboard shortcuts

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