MediaInfoModel initializer -> assignment for NRE tracking

pull/6870/head
ta264 3 years ago
parent 50b273acae
commit 59fed13442

@ -63,45 +63,43 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
var analysis = FFProbe.AnalyseStreamJson(ffprobeOutput); var analysis = FFProbe.AnalyseStreamJson(ffprobeOutput);
if (analysis.PrimaryAudioStream.ChannelLayout.IsNullOrWhiteSpace()) if (analysis.PrimaryAudioStream?.ChannelLayout.IsNullOrWhiteSpace() ?? false)
{ {
ffprobeOutput = FFProbe.GetStreamJson(filename, ffOptions: new FFOptions { ExtraArguments = "-probesize 150000000 -analyzeduration 150000000" }); ffprobeOutput = FFProbe.GetStreamJson(filename, ffOptions: new FFOptions { ExtraArguments = "-probesize 150000000 -analyzeduration 150000000" });
analysis = FFProbe.AnalyseStreamJson(ffprobeOutput); analysis = FFProbe.AnalyseStreamJson(ffprobeOutput);
} }
var mediaInfoModel = new MediaInfoModel var mediaInfoModel = new MediaInfoModel();
{ mediaInfoModel.ContainerFormat = analysis.Format.FormatName;
ContainerFormat = analysis.Format.FormatName, mediaInfoModel.VideoFormat = analysis.PrimaryVideoStream?.CodecName;
VideoFormat = analysis.PrimaryVideoStream?.CodecName, mediaInfoModel.VideoCodecID = analysis.PrimaryVideoStream?.CodecTagString;
VideoCodecID = analysis.PrimaryVideoStream?.CodecTagString, mediaInfoModel.VideoProfile = analysis.PrimaryVideoStream?.Profile;
VideoProfile = analysis.PrimaryVideoStream?.Profile, mediaInfoModel.VideoBitrate = analysis.PrimaryVideoStream?.BitRate ?? 0;
VideoBitrate = analysis.PrimaryVideoStream?.BitRate ?? 0, mediaInfoModel.VideoMultiViewCount = 1;
VideoMultiViewCount = 1, mediaInfoModel.VideoBitDepth = GetPixelFormat(analysis.PrimaryVideoStream?.PixelFormat)?.Components.Min(x => x.BitDepth) ?? 8;
VideoBitDepth = GetPixelFormat(analysis.PrimaryVideoStream?.PixelFormat)?.Components.Min(x => x.BitDepth) ?? 8, mediaInfoModel.VideoColourPrimaries = analysis.PrimaryVideoStream?.ColorPrimaries;
VideoColourPrimaries = analysis.PrimaryVideoStream?.ColorPrimaries, mediaInfoModel.VideoTransferCharacteristics = analysis.PrimaryVideoStream?.ColorTransfer;
VideoTransferCharacteristics = analysis.PrimaryVideoStream?.ColorTransfer, mediaInfoModel.DoviConfigurationRecord = analysis.PrimaryVideoStream?.SideDataList?.Find(x => x.GetType().Name == nameof(DoviConfigurationRecordSideData)) as DoviConfigurationRecordSideData;
DoviConfigurationRecord = analysis.PrimaryVideoStream?.SideDataList?.Find(x => x.GetType().Name == nameof(DoviConfigurationRecordSideData)) as DoviConfigurationRecordSideData, mediaInfoModel.Height = analysis.PrimaryVideoStream?.Height ?? 0;
Height = analysis.PrimaryVideoStream?.Height ?? 0, mediaInfoModel.Width = analysis.PrimaryVideoStream?.Width ?? 0;
Width = analysis.PrimaryVideoStream?.Width ?? 0, mediaInfoModel.AudioFormat = analysis.PrimaryAudioStream?.CodecName;
AudioFormat = analysis.PrimaryAudioStream?.CodecName, mediaInfoModel.AudioCodecID = analysis.PrimaryAudioStream?.CodecTagString;
AudioCodecID = analysis.PrimaryAudioStream?.CodecTagString, mediaInfoModel.AudioProfile = analysis.PrimaryAudioStream?.Profile;
AudioProfile = analysis.PrimaryAudioStream?.Profile, mediaInfoModel.AudioBitrate = analysis.PrimaryAudioStream?.BitRate ?? 0;
AudioBitrate = analysis.PrimaryAudioStream?.BitRate ?? 0, mediaInfoModel.RunTime = GetBestRuntime(analysis.PrimaryAudioStream?.Duration, analysis.PrimaryVideoStream?.Duration, analysis.Format.Duration);
RunTime = GetBestRuntime(analysis.PrimaryAudioStream?.Duration, analysis.PrimaryVideoStream?.Duration, analysis.Format.Duration), mediaInfoModel.AudioStreamCount = analysis.AudioStreams.Count;
AudioStreamCount = analysis.AudioStreams.Count, mediaInfoModel.AudioChannels = analysis.PrimaryAudioStream?.Channels ?? 0;
AudioChannels = analysis.PrimaryAudioStream?.Channels ?? 0, mediaInfoModel.AudioChannelPositions = analysis.PrimaryAudioStream?.ChannelLayout;
AudioChannelPositions = analysis.PrimaryAudioStream?.ChannelLayout, mediaInfoModel.VideoFps = analysis.PrimaryVideoStream?.FrameRate ?? 0;
VideoFps = analysis.PrimaryVideoStream?.FrameRate ?? 0, mediaInfoModel.AudioLanguages = analysis.AudioStreams?.Select(x => x.Language)
AudioLanguages = analysis.AudioStreams?.Select(x => x.Language)
.Where(l => l.IsNotNullOrWhiteSpace()) .Where(l => l.IsNotNullOrWhiteSpace())
.ToList(), .ToList();
Subtitles = analysis.SubtitleStreams?.Select(x => x.Language) mediaInfoModel.Subtitles = analysis.SubtitleStreams?.Select(x => x.Language)
.Where(l => l.IsNotNullOrWhiteSpace()) .Where(l => l.IsNotNullOrWhiteSpace())
.ToList(), .ToList();
ScanType = "Progressive", mediaInfoModel.ScanType = "Progressive";
RawStreamData = ffprobeOutput, mediaInfoModel.RawStreamData = ffprobeOutput;
SchemaRevision = CURRENT_MEDIA_INFO_SCHEMA_REVISION mediaInfoModel.SchemaRevision = CURRENT_MEDIA_INFO_SCHEMA_REVISION;
};
FFProbeFrames frames = null; FFProbeFrames frames = null;

Loading…
Cancel
Save