mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-09-01 03:30:06 +00:00
Add pagination and fixes
This commit is contained in:
parent
70751722d2
commit
90736ee346
4 changed files with 60 additions and 23 deletions
|
|
@ -106,7 +106,7 @@ internal static class EbmlReaderExtensions
|
|||
|
||||
if (!tracksPosition.HasValue || !cuesPosition.HasValue || !infoPosition.HasValue)
|
||||
{
|
||||
throw new InvalidOperationException("SeekHead is missing or does not contain Info, Tracks and Cues positions");
|
||||
throw new InvalidOperationException("SeekHead is missing or does not contain Info, Tracks and Cues positions. SeekHead referencing another SeekHead is not supported");
|
||||
}
|
||||
|
||||
return new SeekHead(infoPosition.Value, tracksPosition.Value, cuesPosition.Value);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Jellyfin.MediaEncoding.Keyframes.Matroska.Extensions;
|
||||
using Jellyfin.MediaEncoding.Keyframes.Matroska.Models;
|
||||
using NEbml.Core;
|
||||
|
||||
namespace Jellyfin.MediaEncoding.Keyframes.Matroska;
|
||||
|
|
@ -22,8 +23,19 @@ public static class MatroskaKeyframeExtractor
|
|||
using var reader = new EbmlReader(stream);
|
||||
|
||||
var seekHead = reader.ReadSeekHead();
|
||||
var info = reader.ReadInfo(seekHead.InfoPosition);
|
||||
var videoTrackNumber = reader.FindFirstTrackNumberByType(seekHead.TracksPosition, MatroskaConstants.TrackTypeVideo);
|
||||
// External lib does not support seeking backwards (yet)
|
||||
Info info;
|
||||
ulong videoTrackNumber;
|
||||
if (seekHead.InfoPosition < seekHead.TracksPosition)
|
||||
{
|
||||
info = reader.ReadInfo(seekHead.InfoPosition);
|
||||
videoTrackNumber = reader.FindFirstTrackNumberByType(seekHead.TracksPosition, MatroskaConstants.TrackTypeVideo);
|
||||
}
|
||||
else
|
||||
{
|
||||
videoTrackNumber = reader.FindFirstTrackNumberByType(seekHead.TracksPosition, MatroskaConstants.TrackTypeVideo);
|
||||
info = reader.ReadInfo(seekHead.InfoPosition);
|
||||
}
|
||||
|
||||
var keyframes = new List<long>();
|
||||
reader.ReadAt(seekHead.CuesPosition);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue