mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-25 06:58:40 +02:00
update BdInfo probing
This commit is contained in:
parent
d5a4a9424f
commit
f6491c69fd
|
@ -304,8 +304,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return base.IsValidFromResolver(newItem);
|
return base.IsValidFromResolver(newItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string MainFeaturePlaylistName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the playable stream files.
|
/// Gets the playable stream files.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -170,8 +170,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
VideoType = item.VideoType,
|
VideoType = item.VideoType,
|
||||||
MediaType = DlnaProfileType.Video,
|
MediaType = DlnaProfileType.Video,
|
||||||
InputPath = item.Path,
|
InputPath = item.Path,
|
||||||
Protocol = protocol,
|
Protocol = protocol
|
||||||
ExtractKeyFrameInterval = true
|
|
||||||
|
|
||||||
}, cancellationToken).ConfigureAwait(false);
|
}, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -298,52 +297,54 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
{
|
{
|
||||||
var video = (Video)item;
|
var video = (Video)item;
|
||||||
|
|
||||||
int? currentHeight = null;
|
|
||||||
int? currentWidth = null;
|
|
||||||
int? currentBitRate = null;
|
|
||||||
|
|
||||||
var videoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);
|
|
||||||
|
|
||||||
// Grab the values that ffprobe recorded
|
|
||||||
if (videoStream != null)
|
|
||||||
{
|
|
||||||
currentBitRate = videoStream.BitRate;
|
|
||||||
currentWidth = videoStream.Width;
|
|
||||||
currentHeight = videoStream.Height;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fill video properties from the BDInfo result
|
|
||||||
mediaStreams.Clear();
|
|
||||||
mediaStreams.AddRange(blurayInfo.MediaStreams);
|
|
||||||
|
|
||||||
video.MainFeaturePlaylistName = blurayInfo.PlaylistName;
|
|
||||||
|
|
||||||
if (blurayInfo.RunTimeTicks.HasValue && blurayInfo.RunTimeTicks.Value > 0)
|
|
||||||
{
|
|
||||||
video.RunTimeTicks = blurayInfo.RunTimeTicks;
|
|
||||||
}
|
|
||||||
|
|
||||||
video.PlayableStreamFileNames = blurayInfo.Files.ToList();
|
video.PlayableStreamFileNames = blurayInfo.Files.ToList();
|
||||||
|
|
||||||
if (blurayInfo.Chapters != null)
|
// Use BD Info if it has multiple m2ts. Otherwise, treat it like a video file and rely more on ffprobe output
|
||||||
|
if (blurayInfo.Files.Count > 1)
|
||||||
{
|
{
|
||||||
chapters.Clear();
|
int? currentHeight = null;
|
||||||
|
int? currentWidth = null;
|
||||||
|
int? currentBitRate = null;
|
||||||
|
|
||||||
chapters.AddRange(blurayInfo.Chapters.Select(c => new ChapterInfo
|
var videoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);
|
||||||
|
|
||||||
|
// Grab the values that ffprobe recorded
|
||||||
|
if (videoStream != null)
|
||||||
{
|
{
|
||||||
StartPositionTicks = TimeSpan.FromSeconds(c).Ticks
|
currentBitRate = videoStream.BitRate;
|
||||||
|
currentWidth = videoStream.Width;
|
||||||
|
currentHeight = videoStream.Height;
|
||||||
|
}
|
||||||
|
|
||||||
}));
|
// Fill video properties from the BDInfo result
|
||||||
}
|
mediaStreams.Clear();
|
||||||
|
mediaStreams.AddRange(blurayInfo.MediaStreams);
|
||||||
|
|
||||||
videoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);
|
if (blurayInfo.RunTimeTicks.HasValue && blurayInfo.RunTimeTicks.Value > 0)
|
||||||
|
{
|
||||||
|
video.RunTimeTicks = blurayInfo.RunTimeTicks;
|
||||||
|
}
|
||||||
|
|
||||||
// Use the ffprobe values if these are empty
|
if (blurayInfo.Chapters != null)
|
||||||
if (videoStream != null)
|
{
|
||||||
{
|
chapters.Clear();
|
||||||
videoStream.BitRate = IsEmpty(videoStream.BitRate) ? currentBitRate : videoStream.BitRate;
|
|
||||||
videoStream.Width = IsEmpty(videoStream.Width) ? currentWidth : videoStream.Width;
|
chapters.AddRange(blurayInfo.Chapters.Select(c => new ChapterInfo
|
||||||
videoStream.Height = IsEmpty(videoStream.Height) ? currentHeight : videoStream.Height;
|
{
|
||||||
|
StartPositionTicks = TimeSpan.FromSeconds(c).Ticks
|
||||||
|
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
videoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);
|
||||||
|
|
||||||
|
// Use the ffprobe values if these are empty
|
||||||
|
if (videoStream != null)
|
||||||
|
{
|
||||||
|
videoStream.BitRate = IsEmpty(videoStream.BitRate) ? currentBitRate : videoStream.BitRate;
|
||||||
|
videoStream.Width = IsEmpty(videoStream.Width) ? currentWidth : videoStream.Width;
|
||||||
|
videoStream.Height = IsEmpty(videoStream.Height) ? currentHeight : videoStream.Height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue