Exemplo n.º 1
0
        private void WriteFrame(FrameDecompressedEventArgs <Mp3Frame> e)
        {
            if (State != StreamRecorderStates.Recording)
            {
                return;
            }

            if (e.DecompressedDataLen <= 0)
            {
                return;
            }

            if (_mp3writer == null)
            {
                _mp3writer = new LameMP3FileWriter(
                    _fileStream,
                    e.DecompressedFormat,
                    e.Frame.BitRate,
                    new ID3TagData {
                    Title   = $"{e.StreamSource.DisplayName} ({DateTime.Now.ToString()})",
                    Comment = e.StreamSource.StreamUrl
                }
                    );
            }

            _mp3writer.Write(e.DecompressedData, 0, e.DecompressedDataLen);
        }
Exemplo n.º 2
0
        protected void RaiseFrameDecompressed(TFrameType frame, WaveFormat frameFormat, WaveFormat decompressedFormat, byte[] decompressedData, int decompressedDataLen)
        {
            var args = new FrameDecompressedEventArgs <TFrameType> {
                StreamSource        = CurrentStreamSource,
                Frame               = frame,
                FrameFormat         = frameFormat,
                DecompressedFormat  = decompressedFormat,
                DecompressedData    = decompressedData,
                DecompressedDataLen = decompressedDataLen
            };

            if (_frameDecompressed != null)
            {
                _frameDecompressed(args);
            }

            if (BackFrames != null)
            {
                BackFrames.Enqueue(args);
            }
        }
Exemplo n.º 3
0
 public override void OnFrameDecompressed(FrameDecompressedEventArgs <Mp3Frame> e)
 {
     lock (_lck) {
         WriteFrame(e);
     }
 }
Exemplo n.º 4
0
 public abstract void OnFrameDecompressed(FrameDecompressedEventArgs <TFrameType> e);