mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-16 11:42:22 +08:00
添加录播姬录制标记
This commit is contained in:
parent
ef1d6bb10b
commit
4344517bcf
|
@ -3,6 +3,7 @@ using BililiveRecorder.FlvProcessor;
|
|||
using DnsClient;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -250,6 +251,29 @@ namespace BililiveRecorder.Core
|
|||
Processor.ClipLengthFuture = _config.ClipLengthFuture;
|
||||
Processor.ClipLengthPast = _config.ClipLengthPast;
|
||||
Processor.CuttingNumber = _config.CuttingNumber;
|
||||
Processor.OnMetaData += (sender, e) =>
|
||||
{
|
||||
// TODO: Clip 和自动切割时也要更新这里的数据
|
||||
e.Metadata["BililiveRecorder"] = new Dictionary<string, object>()
|
||||
{
|
||||
{
|
||||
"starttime",
|
||||
DateTime.UtcNow
|
||||
},
|
||||
{
|
||||
"version",
|
||||
"TEST"
|
||||
},
|
||||
{
|
||||
"roomid",
|
||||
RealRoomid.ToString()
|
||||
},
|
||||
{
|
||||
"streamername",
|
||||
StreamerName
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
_stream = await _response.Content.ReadAsStreamAsync();
|
||||
_stream.ReadTimeout = 3 * 1000;
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
namespace BililiveRecorder.FlvProcessor
|
||||
{
|
||||
public delegate void FlvMetadataEvent(object sender, FlvMetadataArgs e);
|
||||
public class FlvMetadataArgs
|
||||
{
|
||||
public IFlvMetadata Metadata;
|
||||
}
|
||||
|
||||
public delegate void TagProcessedEvent(object sender, TagProcessedArgs e);
|
||||
public class TagProcessedArgs
|
||||
{
|
||||
public IFlvTag Tag;
|
||||
}
|
||||
|
||||
|
||||
public delegate void ClipFinalizedEvent(object sender, ClipFinalizedArgs e);
|
||||
public class ClipFinalizedArgs
|
||||
{
|
||||
|
|
|
@ -61,6 +61,7 @@ namespace BililiveRecorder.FlvProcessor
|
|||
|
||||
public event TagProcessedEvent TagProcessed;
|
||||
public event StreamFinalizedEvent StreamFinalized;
|
||||
public event FlvMetadataEvent OnMetaData;
|
||||
|
||||
public uint ClipLengthPast { get; set; } = 20;
|
||||
public uint ClipLengthFuture { get; set; } = 10;
|
||||
|
@ -330,7 +331,7 @@ namespace BililiveRecorder.FlvProcessor
|
|||
|
||||
Metadata = funcFlvMetadata(tag.Data);
|
||||
|
||||
// TODO: 添加录播姬标记、录制信息
|
||||
OnMetaData?.Invoke(this, new FlvMetadataArgs() { Metadata = Metadata });
|
||||
|
||||
tag.Data = Metadata.ToBytes();
|
||||
tag.WriteTo(_targetFile);
|
||||
|
@ -418,6 +419,9 @@ namespace BililiveRecorder.FlvProcessor
|
|||
{
|
||||
_data.Dispose();
|
||||
_targetFile?.Dispose();
|
||||
OnMetaData = null;
|
||||
StreamFinalized = null;
|
||||
TagProcessed = null;
|
||||
}
|
||||
_tags.Clear();
|
||||
disposedValue = true;
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace BililiveRecorder.FlvProcessor
|
|||
{
|
||||
event TagProcessedEvent TagProcessed;
|
||||
event StreamFinalizedEvent StreamFinalized;
|
||||
event FlvMetadataEvent OnMetaData;
|
||||
|
||||
int TotalMaxTimestamp { get; }
|
||||
int CurrentMaxTimestamp { get; }
|
||||
|
|
Loading…
Reference in New Issue
Block a user