update BdInfo probing

pull/702/head
Luke Pulverenti 9 years ago
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; video.PlayableStreamFileNames = blurayInfo.Files.ToList();
int? currentWidth = null;
int? currentBitRate = null;
var videoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);
// Grab the values that ffprobe recorded // Use BD Info if it has multiple m2ts. Otherwise, treat it like a video file and rely more on ffprobe output
if (videoStream != null) if (blurayInfo.Files.Count > 1)
{ {
currentBitRate = videoStream.BitRate; int? currentHeight = null;
currentWidth = videoStream.Width; int? currentWidth = null;
currentHeight = videoStream.Height; int? currentBitRate = null;
}
// Fill video properties from the BDInfo result var videoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);
mediaStreams.Clear();
mediaStreams.AddRange(blurayInfo.MediaStreams);
video.MainFeaturePlaylistName = blurayInfo.PlaylistName; // Grab the values that ffprobe recorded
if (videoStream != null)
if (blurayInfo.RunTimeTicks.HasValue && blurayInfo.RunTimeTicks.Value > 0) {
{ currentBitRate = videoStream.BitRate;
video.RunTimeTicks = blurayInfo.RunTimeTicks; currentWidth = videoStream.Width;
} currentHeight = videoStream.Height;
}
video.PlayableStreamFileNames = blurayInfo.Files.ToList(); // Fill video properties from the BDInfo result
mediaStreams.Clear();
mediaStreams.AddRange(blurayInfo.MediaStreams);
if (blurayInfo.Chapters != null) if (blurayInfo.RunTimeTicks.HasValue && blurayInfo.RunTimeTicks.Value > 0)
{ {
chapters.Clear(); video.RunTimeTicks = blurayInfo.RunTimeTicks;
}
chapters.AddRange(blurayInfo.Chapters.Select(c => new ChapterInfo if (blurayInfo.Chapters != null)
{ {
StartPositionTicks = TimeSpan.FromSeconds(c).Ticks chapters.Clear();
})); chapters.AddRange(blurayInfo.Chapters.Select(c => new ChapterInfo
} {
StartPositionTicks = TimeSpan.FromSeconds(c).Ticks
videoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video); }));
}
// Use the ffprobe values if these are empty videoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);
if (videoStream != null)
{ // Use the ffprobe values if these are empty
videoStream.BitRate = IsEmpty(videoStream.BitRate) ? currentBitRate : videoStream.BitRate; if (videoStream != null)
videoStream.Width = IsEmpty(videoStream.Width) ? currentWidth : videoStream.Width; {
videoStream.Height = IsEmpty(videoStream.Height) ? currentHeight : videoStream.Height; 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…
Cancel
Save