streamer

package
v0.0.0-...-e61f6d1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDecoder = errors.New("decoder error")
	ErrForce   = errors.New("force stop")
)

Functions

func Execute

func Execute(ctx context.Context, cfg config.Config) error

Execute starts a streamer instance and its RPC API server

func NewGRPCServer

func NewGRPCServer(ctx context.Context, cfg config.Config, storage radio.StorageService,
	queue radio.QueueService, announce radio.AnnounceService,
	streamer *Streamer) (*grpc.Server, error)

NewGRPCServer returns a http server with RPC API handler and debug handlers

func NewTracks

func NewTracks(ctx context.Context, fds *fdstore.Store, st []StreamTrack) *trackstore

Types

type QueueService

type QueueService struct {
	Storage radio.StorageService
	// contains filtered or unexported fields
}

QueueService implements radio.QueueService that uses a random population algorithm

func NewQueueService

func NewQueueService(ctx context.Context, cfg config.Config, storage radio.StorageService) (*QueueService, error)

NewQueueService returns you a new QueueService with the configuration given

func (*QueueService) AddRequest

func (qs *QueueService) AddRequest(ctx context.Context, song radio.Song, identifier string) error

AddRequest implements radio.QueueService

func (*QueueService) Entries

func (qs *QueueService) Entries(ctx context.Context) (radio.Queue, error)

Entries returns all entries in the queue

func (*QueueService) Remove

func (qs *QueueService) Remove(ctx context.Context, id radio.QueueID) (bool, error)

Remove removes the song given from the queue

func (*QueueService) ReserveNext

func (qs *QueueService) ReserveNext(ctx context.Context) (*radio.QueueEntry, error)

ReserveNext implements radio.QueueService

func (*QueueService) ResetReserved

func (qs *QueueService) ResetReserved(ctx context.Context) error

ResetReserved implements radio.QueueService

type StreamTrack

type StreamTrack struct {
	radio.QueueEntry
	Audio audio.Reader
}

func (*StreamTrack) StoreSelf

func (st *StreamTrack) StoreSelf(fdstorage *fdstore.Store) error

func (*StreamTrack) TotalLength

func (st *StreamTrack) TotalLength() time.Duration

type Streamer

type Streamer struct {
	// configuration fields, these shouldn't change after creation
	config.Config
	// AudioFormat is the format of the audio we're streaming
	AudioFormat audio.AudioFormat
	// StreamUser is the user we're streaming as
	StreamUser radio.User
	// contains filtered or unexported fields
}

func NewStreamer

func NewStreamer(ctx context.Context, cfg config.Config,
	fdstorage *fdstore.Store,
	qs radio.QueueService,
	us radio.UserStorage,
) (*Streamer, error)

NewStreamer returns a new streamer using the state given

func (*Streamer) Start

func (s *Streamer) Start(_ context.Context) error

func (*Streamer) Stop

func (s *Streamer) Stop(ctx context.Context, force bool) error

func (*Streamer) Wait

func (s *Streamer) Wait(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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