BililiveRecorder/BililiveRecorder.Flv/Pipeline/Rules/HandleNewScriptRule.cs
2021-02-08 16:51:19 +08:00

25 lines
624 B
C#

using System;
using System.Threading.Tasks;
namespace BililiveRecorder.Flv.Pipeline.Rules
{
/// <summary>
/// 处理收到 Script Tag 的情况
/// </summary>
/// <remarks>
/// 本规则为一般规则
/// </remarks>
public class HandleNewScriptRule : ISimpleProcessingRule
{
public Task RunAsync(FlvProcessingContext context, Func<Task> next)
{
if (context.OriginalInput is PipelineScriptAction)
{
context.AddNewFileAtStart();
return Task.CompletedTask;
}
else return next();
}
}
}