mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
parent
5c8597670c
commit
f38562aa68
1 changed files with 12 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace FFMpegCore.Builders.MetaData
|
namespace FFMpegCore.Builders.MetaData
|
||||||
|
@ -19,6 +20,17 @@ public MetaDataBuilder AddChapter(ChapterData chapterData)
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MetaDataBuilder AddChapters<T>(IEnumerable<T> values, Func<T, (TimeSpan duration, string title)> chapterGetter)
|
||||||
|
{
|
||||||
|
foreach (T value in values)
|
||||||
|
{
|
||||||
|
var (duration, title) = chapterGetter(value);
|
||||||
|
AddChapter(duration, title);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public MetaDataBuilder AddChapter(TimeSpan duration, string? title = null)
|
public MetaDataBuilder AddChapter(TimeSpan duration, string? title = null)
|
||||||
{
|
{
|
||||||
var start = _metaData.Chapters.LastOrDefault()?.End ?? TimeSpan.Zero;
|
var start = _metaData.Chapters.LastOrDefault()?.End ?? TimeSpan.Zero;
|
||||||
|
|
Loading…
Reference in a new issue