private void SetComment(StreamState os, Stream stream) { var opusTags = new OpusTags(); opusTags.Add("ENCODER", "opusenc from libopus 1.0.1-21-gff16ab0"); opusTags.AddOption(_options.BitRate); opusTags.AddOption(_options.BitRateEncoding); opusTags.AddOption("ignorelength", string.Empty); opusTags.Pad(); var opComment = new Packet { PacketData = opusTags.GetPacked(), PacketDataLength = opusTags.GetPackedLength(), Bos = 0, Eos = 0, GranulePos = 0 }; os.AddWaveData(opComment); os.Flush(stream); }
private void SetHeader(StreamState os, Stream stream) { UInt16 preskip = 0; var header = new OpusHeader(_options.OutChannels.Value, _options.OutSamplingRate, preskip); var op = new Packet { PacketData = header.Packet, PacketDataLength = header.Packet.Length, Bos = 1, Eos = 0, GranulePos = 0 }; os.AddWaveData(op); os.Flush(stream); }