< Summary - Jellyfin

Information
Class: Jellyfin.MediaEncoding.Hls.Extensions.MediaEncodingHlsServiceCollectionExtensions
Assembly: Jellyfin.MediaEncoding.Hls
File(s): /srv/git/jellyfin/src/Jellyfin.MediaEncoding.Hls/Extensions/MediaEncodingHlsServiceCollectionExtensions.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 36
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 5/16/2026 - 12:15:55 AM Line coverage: 100% (14/14) Total lines: 3610/29/2026 - 12:17:11 AM Line coverage: 100% (11/11) Total lines: 36

Coverage delta

Coverage delta 1 -1

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
AddHlsPlaylistGenerator(...)100%11100%
AddSingletonWithDecorator(...)100%11100%

File(s)

/srv/git/jellyfin/src/Jellyfin.MediaEncoding.Hls/Extensions/MediaEncodingHlsServiceCollectionExtensions.cs

#LineLine coverage
 1using System;
 2using Jellyfin.MediaEncoding.Hls.Cache;
 3using Jellyfin.MediaEncoding.Hls.Extractors;
 4using Jellyfin.MediaEncoding.Hls.Playlist;
 5using Microsoft.Extensions.DependencyInjection;
 6
 7namespace Jellyfin.MediaEncoding.Hls.Extensions;
 8
 9/// <summary>
 10/// Extensions for the <see cref="IServiceCollection"/> interface.
 11/// </summary>
 12public static class MediaEncodingHlsServiceCollectionExtensions
 13{
 14    /// <summary>
 15    /// Adds the hls playlist generators to the <see cref="IServiceCollection"/>.
 16    /// </summary>
 17    /// <param name="serviceCollection">An instance of the <see cref="IServiceCollection"/> interface.</param>
 18    /// <returns>The updated service collection.</returns>
 19    public static IServiceCollection AddHlsPlaylistGenerator(this IServiceCollection serviceCollection)
 20    {
 2821        serviceCollection.AddSingletonWithDecorator(typeof(FfProbeKeyframeExtractor));
 2822        serviceCollection.AddSingletonWithDecorator(typeof(MatroskaKeyframeExtractor));
 2823        serviceCollection.AddSingleton<IDynamicHlsPlaylistGenerator, DynamicHlsPlaylistGenerator>();
 2824        return serviceCollection;
 25    }
 26
 27    private static void AddSingletonWithDecorator(this IServiceCollection serviceCollection, Type type)
 28    {
 5629        serviceCollection.AddSingleton<IKeyframeExtractor>(serviceProvider =>
 5630        {
 5631            var extractor = ActivatorUtilities.CreateInstance(serviceProvider, type);
 5632            var decorator = ActivatorUtilities.CreateInstance<CacheDecorator>(serviceProvider, extractor);
 5633            return decorator;
 5634        });
 5635    }
 36}