|
2 | 2 | using AAXClean.FrameFilters; |
3 | 3 | using AAXClean.FrameFilters.Audio; |
4 | 4 | using AAXClean.FrameFilters.Text; |
| 5 | +using Mpeg4Lib; |
5 | 6 | using Mpeg4Lib.Boxes; |
6 | | -using Mpeg4Lib.Chunks; |
7 | 7 | using Mpeg4Lib.Util; |
8 | 8 | using System; |
9 | | -using System.Collections.Generic; |
10 | 9 | using System.IO; |
11 | 10 | using System.Linq; |
12 | | -using System.Text; |
13 | 11 | using System.Threading.Tasks; |
14 | 12 |
|
15 | 13 | namespace AAXClean |
@@ -41,11 +39,10 @@ public enum SampleRate : int |
41 | 39 |
|
42 | 40 | public class Mp4File : Mpeg4Lib.Mpeg4File |
43 | 41 | { |
44 | | - public ChapterInfo? Chapters { get; set; } |
| 42 | +#pragma warning disable CS0618 // Type or member is obsolete |
45 | 43 | [Obsolete("Use MetadataItems property instead.")] |
46 | 44 | public AppleTags AppleTags => lazyAppleTags.Value; |
47 | 45 |
|
48 | | -#pragma warning disable CS0618 // Type or member is obsolete |
49 | 46 | private readonly Lazy<AppleTags> lazyAppleTags; |
50 | 47 | #pragma warning restore CS0618 |
51 | 48 |
|
@@ -187,50 +184,6 @@ public Mp4Operation ConvertToMultiMp4aAsync(ChapterInfo userChapters, Action<New |
187 | 184 | return ProcessAudio(TimeSpan.Zero, TimeSpan.MaxValue, continuation, (Moov.TextTrack, chapterFilter)); |
188 | 185 | } |
189 | 186 |
|
190 | | - public ChapterInfo? GetChaptersFromMetadata() |
191 | | - { |
192 | | - TrakBox? textTrak = Moov.TextTrack; |
193 | | - |
194 | | - //Get chapter names from metadata box in chapter track |
195 | | - List<string>? chapterNames = |
196 | | - textTrak |
197 | | - ?.GetChild<UdtaBox>() |
198 | | - ?.GetChild<MetaBox>() |
199 | | - ?.GetChild<AppleListBox>() |
200 | | - ?.Children |
201 | | - ?.OfType<AppleTagBox>() |
202 | | - ?.Where(b => b.Header.Type == "©nam") |
203 | | - ?.Select(b => b.Data.ReadAsString()) |
204 | | - ?.ToList(); |
205 | | - |
206 | | - if (chapterNames is null) return null; |
207 | | - |
208 | | - List<SttsBox.SampleEntry> sampleTimes = textTrak!.Mdia.Minf.Stbl.Stts.Samples; |
209 | | - |
210 | | - if (sampleTimes.Count != chapterNames.Count) return null; |
211 | | - |
212 | | - var cEntryList = new ChunkEntryList(textTrak).OrderBy(s => s.ChunkOffset).ToList(); |
213 | | - |
214 | | - if (cEntryList.Count != chapterNames.Count) return null; |
215 | | - |
216 | | - ChapterInfo chapterInfo = new(); |
217 | | - |
218 | | - int subtractNext = 0; |
219 | | - |
220 | | - for (int i = 0; i < chapterNames.Count; i++) |
221 | | - { |
222 | | - var sif = (int)sampleTimes[i].FrameDelta; |
223 | | - |
224 | | - TimeSpan duration = TimeSpan.FromSeconds(Math.Max(0d, sif + subtractNext) / TimeScale); |
225 | | - chapterInfo.AddChapter(chapterNames[(int)cEntryList[i].ChunkIndex], duration); |
226 | | - subtractNext = sif < 0 ? sif : 0; |
227 | | - } |
228 | | - |
229 | | - Chapters ??= chapterInfo; |
230 | | - |
231 | | - return chapterInfo; |
232 | | - } |
233 | | - |
234 | 187 | protected virtual IChunkReader CreateChunkReader(Stream inputStream, TimeSpan startTime, TimeSpan endTime) |
235 | 188 | => new ChunkReader(inputStream, startTime, endTime); |
236 | 189 |
|
|
0 commit comments