public void PlayStream(string name, ulong flowId, uint streamId, OutFileRTMPFLVStream flvStream) { if (_flvStream != null) { return; } var flowStream = new FlowWriter(FlowStream.Signature + (char)streamId, this, flowId); flowStream.Play(name); _flvStream = flvStream; _flvStream.SignalAttachedToInStream(); }
private static void SetupRuntimeServices(FlowWriter flowWriter, StdoutWriter stdoutWriter) { #pragma warning disable CS0618 // Type or member is obsolete RuntimeServices.ValuePresenter = new LegacyValuePresenter(); #pragma warning restore CS0618 // Type or member is obsolete RuntimeServices.InspectionWriter = new InspectionWriter(stdoutWriter); RuntimeServices.FlowWriter = flowWriter; RuntimeServices.MemoryBytesInspector = new MemoryBytesInspector(new Pool <ClrRuntime>(() => { var dataTarget = DataTarget.AttachToProcess(Current.ProcessId, suspend: false); return(dataTarget.ClrVersions.Single(c => c.Flavor == ClrFlavor.Core).CreateRuntime()); })); RuntimeServices.MemoryGraphBuilderFactory = argumentNames => new MemoryGraphBuilder(argumentNames, RuntimeServices.ValuePresenter); }
public override Session CreateSession(Peer peer, Cookie cookie) { var connection = new FlowWriter(FlowConnection.Signature, DownloadSession, 0); var connectArgs = Variant.Get(); connectArgs["app"] = AppName; connectArgs["tcUrl"] = TcUrl; connectArgs["objectEncoding"] = 3.0; connectArgs["flashVer"] = "WIN 17,0,0,134"; connectArgs["fpad"] = false; connectArgs["capabilities"] = 235.0; connectArgs["audioCodecs"] = 3575.0; connectArgs["videoCodecs"] = 252.0; connectArgs["videoFunction"] = 1.0; connectArgs["swfUrl"] = Variant.Get(); connectArgs["pageUrl"] = Variant.Get(); connection.Connect(connectArgs, (f1, message) => { Log += message[1]["code"]; if (message[1]["code"] == "NetConnection.Connect.Success") { //connection.SetPeerInfo(FarProtocol.IOHandler.Socket.LocalEndPoint as IPEndPoint); connection.CreateStream((f2, o) => { DownloadSession.PlayStream(StreamName, f2.Id, o[1], new OutFileRTMPFLVStream(this, StreamsManager, FilePath ?? Url.Substring(8).Replace('/', '_').Replace(':', '_') + ".flv", StreamName)); Status = "正在下载"; StartTime = DateTime.Now; }); } else { Status = "连接失败"; } }); return(DownloadSession); }
// TODO: Change test structure so that this can be inlined internal static void Run(Stream stdin, Stream stdout) { var stdoutWriter = new StdoutWriter(stdout, new Utf8JsonWriter(stdout, new() { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping })); var flowWriter = new FlowWriter(stdoutWriter, new Utf8ValuePresenter()); SetupRuntimeServices(flowWriter, stdoutWriter); var executeCommandHandler = new ExecuteCommandHandler(flowWriter, stdoutWriter); var shouldExit = false; while (!shouldExit) { var command = Serializer.DeserializeWithLengthPrefix <ExecuteCommand?>(stdin, PrefixStyle.Base128); if (command == null) { break; // end-of-input } executeCommandHandler.Execute(command); } }
public ExecuteCommandHandler(FlowWriter flowWriter, StdoutWriter stdoutWriter) { _flowWriter = flowWriter; _stdoutWriter = stdoutWriter; }