Exemplo n.º 1
0
        /// <summary>
        /// Close player for writing frames.
        /// </summary>
        public void CloseWrite()
        {
            if (!OpenedForWriting)
            {
                throw new InvalidOperationException("Player is not opened for writing frames!");
            }

            try
            {
                try
                {
                    if (!ffplayp.HasExited)
                    {
                        ffplayp.Kill();
                    }
                }
                catch { }

                InputDataStream.Dispose();
            }
            finally
            {
                OpenedForWriting = false;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Closes output audio file.
        /// </summary>
        public void CloseWrite()
        {
            if (!OpenedForWriting)
            {
                throw new InvalidOperationException("File is not opened for writing!");
            }

            try
            {
                InputDataStream.Dispose();
                ffmpegp.WaitForExit();
                csc?.Cancel();

                if (!UseFilename)
                {
                    OutputDataStream?.Dispose();
                }

                try
                {
                    if (ffmpegp?.HasExited == false)
                    {
                        ffmpegp.Kill();
                    }
                }
                catch { }
            }
            finally
            {
                OpenedForWriting = false;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Writes frame to output. Make sure to call OpenWrite() before calling this.
        /// </summary>
        /// <param name="frame">Frame containing media data</param>
        public virtual void WriteFrame(Frame frame)
        {
            if (!OpenedForWriting)
            {
                throw new InvalidOperationException("Media needs to be prepared for writing first!");
            }

            InputDataStream.Write(frame.RawData.Span);
        }