mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-10 04:06:17 +00:00
Add pagination and fixes
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user