using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("StreplayFfmpeg")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1b240207a82c4306dc9aedbfc8c08bc923cd65f6")]
[assembly: AssemblyProduct("StreplayFfmpeg")]
[assembly: AssemblyTitle("StreplayFfmpeg")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace StreplayFfmpeg
{
public static class Bridge
{
public static int Version => 1;
}
public sealed class Encoder : IDisposable
{
private readonly Process _proc;
private readonly Queue<string> _log = new Queue<string>();
public Stream Input { get; }
public bool HasExited => _proc.HasExited;
public string LastLog
{
get
{
lock (_log)
{
return string.Join(" | ", _log);
}
}
}
public Encoder(string exe, string args)
{
_proc = new Process
{
StartInfo = new ProcessStartInfo(exe, args)
{
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardInput = true,
RedirectStandardError = true,
RedirectStandardOutput = true
}
};
_proc.ErrorDataReceived += delegate(object _, DataReceivedEventArgs e)
{
if (e.Data != null)
{
lock (_log)
{
_log.Enqueue(e.Data);
while (_log.Count > 20)
{
_log.Dequeue();
}
}
}
};
_proc.OutputDataReceived += delegate
{
};
_proc.Start();
_proc.BeginErrorReadLine();
_proc.BeginOutputReadLine();
Input = _proc.StandardInput.BaseStream;
}
public int Finish()
{
try
{
Input.Flush();
Input.Close();
}
catch (IOException)
{
}
_proc.WaitForExit();
return _proc.ExitCode;
}
public void Dispose()
{
_proc.Dispose();
}
}
}