Reduce allocations

pull/6936/head
cvium 3 years ago
parent f6d8c19a7a
commit 5535b9c01f

@ -38,17 +38,9 @@ namespace MediaBrowser.Providers.MediaInfo
IHasItemChangeMonitor
{
private readonly ILogger<FFProbeProvider> _logger;
private readonly IMediaEncoder _mediaEncoder;
private readonly IItemRepository _itemRepo;
private readonly IBlurayExaminer _blurayExaminer;
private readonly ILocalizationManager _localization;
private readonly IEncodingManager _encodingManager;
private readonly IServerConfigurationManager _config;
private readonly ISubtitleManager _subtitleManager;
private readonly IChapterManager _chapterManager;
private readonly ILibraryManager _libraryManager;
private readonly IMediaSourceManager _mediaSourceManager;
private readonly SubtitleResolver _subtitleResolver;
private readonly FFProbeVideoInfo _videoProber;
private readonly FFProbeAudioInfo _audioProber;
private readonly Task<ItemUpdateType> _cachedTask = Task.FromResult(ItemUpdateType.None);
@ -66,18 +58,21 @@ namespace MediaBrowser.Providers.MediaInfo
ILibraryManager libraryManager)
{
_logger = logger;
_mediaEncoder = mediaEncoder;
_itemRepo = itemRepo;
_blurayExaminer = blurayExaminer;
_localization = localization;
_encodingManager = encodingManager;
_config = config;
_subtitleManager = subtitleManager;
_chapterManager = chapterManager;
_libraryManager = libraryManager;
_mediaSourceManager = mediaSourceManager;
_subtitleResolver = new SubtitleResolver(BaseItem.LocalizationManager);
_videoProber = new FFProbeVideoInfo(
_logger,
mediaSourceManager,
mediaEncoder,
itemRepo,
blurayExaminer,
localization,
encodingManager,
config,
subtitleManager,
chapterManager,
libraryManager);
_audioProber = new FFProbeAudioInfo(mediaSourceManager, mediaEncoder, itemRepo, libraryManager);
}
public string Name => "ffprobe";
@ -177,20 +172,7 @@ namespace MediaBrowser.Providers.MediaInfo
FetchShortcutInfo(item);
}
var prober = new FFProbeVideoInfo(
_logger,
_mediaSourceManager,
_mediaEncoder,
_itemRepo,
_blurayExaminer,
_localization,
_encodingManager,
_config,
_subtitleManager,
_chapterManager,
_libraryManager);
return prober.ProbeVideo(item, options, cancellationToken);
return _videoProber.ProbeVideo(item, options, cancellationToken);
}
private string NormalizeStrmLine(string line)
@ -226,9 +208,7 @@ namespace MediaBrowser.Providers.MediaInfo
FetchShortcutInfo(item);
}
var prober = new FFProbeAudioInfo(_mediaSourceManager, _mediaEncoder, _itemRepo, _libraryManager);
return prober.Probe(item, options, cancellationToken);
return _audioProber.Probe(item, options, cancellationToken);
}
}
}

Loading…
Cancel
Save