public Player(ConfBot config, Id id, LibrespotPlayer librespotPlayer) { FfmpegProducer = new FfmpegProducer(config.GetParent().Tools.Ffmpeg, id, librespotPlayer); WebSocketPipe = new WebSocketPipe(config.WebSocket); StallCheckPipe = new StallCheckPipe(); VolumePipe = new VolumePipe(); Volume = config.Audio.Volume.Default; EncoderPipe = new EncoderPipe(SendCodec) { Bitrate = ScaleBitrate(config.Audio.Bitrate) }; EncoderPipeHighQuality = new EncoderPipe(Codec.OpusMusic) { Bitrate = 320000 }; TimePipe = new PreciseTimedPipe { ReadBufferSize = EncoderPipe.PacketSize }; TimePipe.Initialize(EncoderPipe, id); MergePipe = new PassiveMergePipe(); SplitterPipe = new PassiveSplitterPipe(); config.Audio.Bitrate.Changed += (s, e) => EncoderPipe.Bitrate = ScaleBitrate(e.NewValue); MergePipe.Into(TimePipe).Chain <CheckActivePipe>().Chain(SplitterPipe); SplitterPipe.Chain(EncoderPipeHighQuality).Chain(WebSocketPipe); SplitterPipe.Chain(StallCheckPipe).Chain(VolumePipe).Chain(EncoderPipe); FfmpegProducer.OnSongLengthSet += (sender, args) => OnSongLengthParsed?.Invoke(sender, args); }
public FfmpegProducer(ConfToolsFfmpeg config, Id id, LibrespotPlayer librespot) { this.config = config; this.id = id; this.librespot = librespot; }