aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Model')
-rw-r--r--MediaBrowser.Model/Configuration/EncodingOptionsDto.cs257
-rw-r--r--MediaBrowser.Model/Configuration/MetadataConfigurationDto.cs12
-rw-r--r--MediaBrowser.Model/Configuration/ServerConfiguration.cs5
-rw-r--r--MediaBrowser.Model/Configuration/ServerConfigurationDto.cs125
-rw-r--r--MediaBrowser.Model/Configuration/XbmcMetadataOptionsDto.cs32
-rw-r--r--MediaBrowser.Model/Dlna/StreamBuilder.cs212
-rw-r--r--MediaBrowser.Model/Dto/ItemCounts.cs8
-rw-r--r--MediaBrowser.Model/Entities/MediaStream.cs24
-rw-r--r--MediaBrowser.Model/Globalization/LocalizationManagerExtensions.cs48
-rw-r--r--MediaBrowser.Model/LiveTv/LiveTvOptionsDto.cs84
-rw-r--r--MediaBrowser.Model/MediaInfo/MediaInfo.cs2
-rw-r--r--MediaBrowser.Model/Querying/QueryFilters.cs6
12 files changed, 799 insertions, 16 deletions
diff --git a/MediaBrowser.Model/Configuration/EncodingOptionsDto.cs b/MediaBrowser.Model/Configuration/EncodingOptionsDto.cs
new file mode 100644
index 0000000000..0bc009f402
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/EncodingOptionsDto.cs
@@ -0,0 +1,257 @@
+#pragma warning disable CA1819
+
+#nullable disable
+using MediaBrowser.Model.Entities;
+
+namespace MediaBrowser.Model.Configuration;
+
+/// <summary>
+/// The encoding options DTO for API use.
+/// </summary>
+public class EncodingOptionsDto
+{
+ /// <summary>
+ /// Gets or sets the thread count used for encoding.
+ /// </summary>
+ public int EncodingThreadCount { get; set; }
+
+ /// <summary>
+ /// Gets or sets the temporary transcoding path.
+ /// </summary>
+ public string TranscodingTempPath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the path to the fallback font.
+ /// </summary>
+ public string FallbackFontPath { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to use the fallback font.
+ /// </summary>
+ public bool EnableFallbackFont { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether audio VBR is enabled.
+ /// </summary>
+ public bool EnableAudioVbr { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio boost applied when downmixing audio.
+ /// </summary>
+ public double DownMixAudioBoost { get; set; }
+
+ /// <summary>
+ /// Gets or sets the algorithm used for downmixing audio to stereo.
+ /// </summary>
+ public DownMixStereoAlgorithms DownMixStereoAlgorithm { get; set; }
+
+ /// <summary>
+ /// Gets or sets the maximum size of the muxing queue.
+ /// </summary>
+ public int MaxMuxingQueueSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether throttling is enabled.
+ /// </summary>
+ public bool EnableThrottling { get; set; }
+
+ /// <summary>
+ /// Gets or sets the delay after which throttling happens.
+ /// </summary>
+ public int ThrottleDelaySeconds { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether segment deletion is enabled.
+ /// </summary>
+ public bool EnableSegmentDeletion { get; set; }
+
+ /// <summary>
+ /// Gets or sets seconds for which segments should be kept before being deleted.
+ /// </summary>
+ public int SegmentKeepSeconds { get; set; }
+
+ /// <summary>
+ /// Gets or sets the hardware acceleration type.
+ /// </summary>
+ public HardwareAccelerationType HardwareAccelerationType { get; set; }
+
+ /// <summary>
+ /// Gets or sets the FFmpeg path as set by the user via the UI.
+ /// </summary>
+ public string EncoderAppPath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the current FFmpeg path being used by the system and displayed on the transcode page.
+ /// </summary>
+ public string EncoderAppPathDisplay { get; set; }
+
+ /// <summary>
+ /// Gets or sets the VA-API device.
+ /// </summary>
+ public string VaapiDevice { get; set; }
+
+ /// <summary>
+ /// Gets or sets the QSV device.
+ /// </summary>
+ public string QsvDevice { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether tonemapping is enabled.
+ /// </summary>
+ public bool EnableTonemapping { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether VPP tonemapping is enabled.
+ /// </summary>
+ public bool EnableVppTonemapping { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether videotoolbox tonemapping is enabled.
+ /// </summary>
+ public bool EnableVideoToolboxTonemapping { get; set; }
+
+ /// <summary>
+ /// Gets or sets the tone-mapping algorithm.
+ /// </summary>
+ public TonemappingAlgorithm TonemappingAlgorithm { get; set; }
+
+ /// <summary>
+ /// Gets or sets the tone-mapping mode.
+ /// </summary>
+ public TonemappingMode TonemappingMode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the tone-mapping range.
+ /// </summary>
+ public TonemappingRange TonemappingRange { get; set; }
+
+ /// <summary>
+ /// Gets or sets the tone-mapping desaturation.
+ /// </summary>
+ public double TonemappingDesat { get; set; }
+
+ /// <summary>
+ /// Gets or sets the tone-mapping peak.
+ /// </summary>
+ public double TonemappingPeak { get; set; }
+
+ /// <summary>
+ /// Gets or sets the tone-mapping parameters.
+ /// </summary>
+ public double TonemappingParam { get; set; }
+
+ /// <summary>
+ /// Gets or sets the VPP tone-mapping brightness.
+ /// </summary>
+ public double VppTonemappingBrightness { get; set; }
+
+ /// <summary>
+ /// Gets or sets the VPP tone-mapping contrast.
+ /// </summary>
+ public double VppTonemappingContrast { get; set; }
+
+ /// <summary>
+ /// Gets or sets the H264 CRF.
+ /// </summary>
+ public int H264Crf { get; set; }
+
+ /// <summary>
+ /// Gets or sets the H265 CRF.
+ /// </summary>
+ public int H265Crf { get; set; }
+
+ /// <summary>
+ /// Gets or sets the encoder preset.
+ /// </summary>
+ public EncoderPreset EncoderPreset { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the framerate is doubled when deinterlacing.
+ /// </summary>
+ public bool DeinterlaceDoubleRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the deinterlace method.
+ /// </summary>
+ public DeinterlaceMethod DeinterlaceMethod { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether 10bit HEVC decoding is enabled.
+ /// </summary>
+ public bool EnableDecodingColorDepth10Hevc { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether 10bit VP9 decoding is enabled.
+ /// </summary>
+ public bool EnableDecodingColorDepth10Vp9 { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether 8/10bit HEVC RExt decoding is enabled.
+ /// </summary>
+ public bool EnableDecodingColorDepth10HevcRext { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether 12bit HEVC RExt decoding is enabled.
+ /// </summary>
+ public bool EnableDecodingColorDepth12HevcRext { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the enhanced NVDEC is enabled.
+ /// </summary>
+ public bool EnableEnhancedNvdecDecoder { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the system native hardware decoder should be used.
+ /// </summary>
+ public bool PreferSystemNativeHwDecoder { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the Intel H264 low-power hardware encoder should be used.
+ /// </summary>
+ public bool EnableIntelLowPowerH264HwEncoder { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the Intel HEVC low-power hardware encoder should be used.
+ /// </summary>
+ public bool EnableIntelLowPowerHevcHwEncoder { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether hardware encoding is enabled.
+ /// </summary>
+ public bool EnableHardwareEncoding { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether HEVC encoding is enabled.
+ /// </summary>
+ public bool AllowHevcEncoding { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether AV1 encoding is enabled.
+ /// </summary>
+ public bool AllowAv1Encoding { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether subtitle extraction is enabled.
+ /// </summary>
+ public bool EnableSubtitleExtraction { get; set; }
+
+ /// <summary>
+ /// Gets or sets the timeout for subtitle extraction in minutes.
+ /// </summary>
+ public int SubtitleExtractionTimeoutMinutes { get; set; }
+
+ /// <summary>
+ /// Gets or sets the codecs hardware encoding is used for.
+ /// </summary>
+ public string[] HardwareDecodingCodecs { get; set; }
+
+ /// <summary>
+ /// Gets or sets the file extensions on-demand metadata based keyframe extraction is enabled for.
+ /// </summary>
+ public string[] AllowOnDemandMetadataBasedKeyframeExtractionForExtensions { get; set; }
+
+ /// <summary>
+ /// Gets or sets the method used for audio seeking in HLS.
+ /// </summary>
+ public HlsAudioSeekStrategy HlsAudioSeekStrategy { get; set; }
+}
diff --git a/MediaBrowser.Model/Configuration/MetadataConfigurationDto.cs b/MediaBrowser.Model/Configuration/MetadataConfigurationDto.cs
new file mode 100644
index 0000000000..e07f9e34de
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/MetadataConfigurationDto.cs
@@ -0,0 +1,12 @@
+namespace MediaBrowser.Model.Configuration;
+
+/// <summary>
+/// The metadata configuration DTO for API use.
+/// </summary>
+public class MetadataConfigurationDto
+{
+ /// <summary>
+ /// Gets or sets a value indicating whether to use file creation time for date added.
+ /// </summary>
+ public bool UseFileCreationTimeForDateAdded { get; set; }
+}
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index ac5c12304e..97a996c479 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -288,4 +288,9 @@ public class ServerConfiguration : BaseApplicationConfiguration
/// Gets or sets a value indicating whether old authorization methods are allowed.
/// </summary>
public bool EnableLegacyAuthorization { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether obsolete endpoints are allowed.
+ /// </summary>
+ public bool EnableObsoleteEndpoints { get; set; } = true;
}
diff --git a/MediaBrowser.Model/Configuration/ServerConfigurationDto.cs b/MediaBrowser.Model/Configuration/ServerConfigurationDto.cs
new file mode 100644
index 0000000000..3f2bfe04f0
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/ServerConfigurationDto.cs
@@ -0,0 +1,125 @@
+#pragma warning disable CS1591
+#pragma warning disable CA1819
+
+using MediaBrowser.Model.Drawing;
+using MediaBrowser.Model.Dto;
+using MediaBrowser.Model.System;
+using MediaBrowser.Model.Updates;
+
+namespace MediaBrowser.Model.Configuration;
+
+/// <summary>
+/// The server configuration DTO for API use.
+/// </summary>
+public class ServerConfigurationDto
+{
+ public int LogFileRetentionDays { get; set; }
+
+ public bool IsStartupWizardCompleted { get; set; }
+
+ public string? CachePath { get; set; }
+
+ public string? PreviousVersionStr { get; set; }
+
+ public bool EnableMetrics { get; set; }
+
+ public bool EnableNormalizedItemByNameIds { get; set; }
+
+ public bool IsPortAuthorized { get; set; }
+
+ public bool QuickConnectAvailable { get; set; }
+
+ public bool EnableCaseSensitiveItemIds { get; set; }
+
+ public bool DisableLiveTvChannelUserDataName { get; set; }
+
+ public string MetadataPath { get; set; } = null!;
+
+ public string PreferredMetadataLanguage { get; set; } = null!;
+
+ public string MetadataCountryCode { get; set; } = null!;
+
+ public string[] SortReplaceCharacters { get; set; } = null!;
+
+ public string[] SortRemoveCharacters { get; set; } = null!;
+
+ public string[] SortRemoveWords { get; set; } = null!;
+
+ public int MinResumePct { get; set; }
+
+ public int MaxResumePct { get; set; }
+
+ public int MinResumeDurationSeconds { get; set; }
+
+ public int MinAudiobookResume { get; set; }
+
+ public int MaxAudiobookResume { get; set; }
+
+ public int InactiveSessionThreshold { get; set; }
+
+ public int LibraryMonitorDelay { get; set; }
+
+ public int LibraryUpdateDuration { get; set; }
+
+ public int CacheSize { get; set; }
+
+ public ImageSavingConvention ImageSavingConvention { get; set; }
+
+ public MetadataOptions[] MetadataOptions { get; set; } = null!;
+
+ public bool SkipDeserializationForBasicTypes { get; set; }
+
+ public string ServerName { get; set; } = null!;
+
+ public string UICulture { get; set; } = null!;
+
+ public bool SaveMetadataHidden { get; set; }
+
+ public NameValuePair[] ContentTypes { get; set; } = null!;
+
+ public int RemoteClientBitrateLimit { get; set; }
+
+ public bool EnableFolderView { get; set; }
+
+ public bool EnableGroupingMoviesIntoCollections { get; set; }
+
+ public bool EnableGroupingShowsIntoCollections { get; set; }
+
+ public bool DisplaySpecialsWithinSeasons { get; set; }
+
+ public string[] CodecsUsed { get; set; } = null!;
+
+ public RepositoryInfo[] PluginRepositories { get; set; } = null!;
+
+ public bool EnableExternalContentInSuggestions { get; set; }
+
+ public int ImageExtractionTimeoutMs { get; set; }
+
+ public PathSubstitution[] PathSubstitutions { get; set; } = null!;
+
+ public bool EnableSlowResponseWarning { get; set; }
+
+ public long SlowResponseThresholdMs { get; set; }
+
+ public string[] CorsHosts { get; set; } = null!;
+
+ public int? ActivityLogRetentionDays { get; set; }
+
+ public int LibraryScanFanoutConcurrency { get; set; }
+
+ public int LibraryMetadataRefreshConcurrency { get; set; }
+
+ public bool AllowClientLogUpload { get; set; }
+
+ public int DummyChapterDuration { get; set; }
+
+ public ImageResolution ChapterImageResolution { get; set; }
+
+ public int ParallelImageEncodingLimit { get; set; }
+
+ public CastReceiverApplication[] CastReceiverApplications { get; set; } = null!;
+
+ public TrickplayOptions TrickplayOptions { get; set; } = null!;
+
+ public bool EnableLegacyAuthorization { get; set; }
+}
diff --git a/MediaBrowser.Model/Configuration/XbmcMetadataOptionsDto.cs b/MediaBrowser.Model/Configuration/XbmcMetadataOptionsDto.cs
new file mode 100644
index 0000000000..e2c118ddbe
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/XbmcMetadataOptionsDto.cs
@@ -0,0 +1,32 @@
+namespace MediaBrowser.Model.Configuration;
+
+/// <summary>
+/// The XBMC metadata options DTO for API use.
+/// </summary>
+public class XbmcMetadataOptionsDto
+{
+ /// <summary>
+ /// Gets or sets the user id.
+ /// </summary>
+ public string? UserId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the release date format.
+ /// </summary>
+ public string ReleaseDateFormat { get; set; } = null!;
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to save image paths in NFO.
+ /// </summary>
+ public bool SaveImagePathsInNfo { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to enable path substitution.
+ /// </summary>
+ public bool EnablePathSubstitution { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to enable extra thumbs duplication.
+ /// </summary>
+ public bool EnableExtraThumbsDuplication { get; set; }
+}
diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs
index 4799ed5410..7e2c3d4773 100644
--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs
+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs
@@ -25,6 +25,7 @@ namespace MediaBrowser.Model.Dlna
internal const TranscodeReason VideoCodecReasons = TranscodeReason.VideoResolutionNotSupported | TranscodeReason.AnamorphicVideoNotSupported | TranscodeReason.InterlacedVideoNotSupported | TranscodeReason.VideoBitDepthNotSupported | TranscodeReason.VideoBitrateNotSupported | TranscodeReason.VideoFramerateNotSupported | TranscodeReason.VideoLevelNotSupported | TranscodeReason.RefFramesNotSupported | TranscodeReason.VideoRangeTypeNotSupported | TranscodeReason.VideoProfileNotSupported | TranscodeReason.VideoRotationNotSupported;
internal const TranscodeReason VideoReasons = TranscodeReason.VideoCodecNotSupported | VideoCodecReasons;
internal const TranscodeReason DirectStreamReasons = AudioReasons | TranscodeReason.ContainerNotSupported | TranscodeReason.VideoCodecTagNotSupported;
+ internal const TranscodeReason GenericReasons = TranscodeReason.VideoCodecNotSupported | TranscodeReason.AudioCodecNotSupported | TranscodeReason.ContainerNotSupported;
private const string ManifestContainers = "hls,applehttp,dash";
@@ -77,6 +78,8 @@ namespace MediaBrowser.Model.Dlna
private StreamInfo? GetOptimalAudioStream(MediaSourceInfo item, MediaOptions options)
{
+ CheckCompatibility(MediaType.Audio, item, options);
+
var playlistItem = new StreamInfo
{
ItemId = options.ItemId,
@@ -649,6 +652,8 @@ namespace MediaBrowser.Model.Dlna
{
ArgumentNullException.ThrowIfNull(item);
+ CheckCompatibility(MediaType.Video, item, options);
+
StreamInfo playlistItem = new StreamInfo
{
ItemId = options.ItemId,
@@ -1311,24 +1316,18 @@ namespace MediaBrowser.Model.Dlna
// Check container conditions
var containerProfileReasons = GetCompatibilityContainer(options, mediaSource, container, videoStream);
- // Check video conditions
- var videoCodecProfileReasons = videoStream is null ? default : GetCompatibilityVideoCodec(options, mediaSource, container, videoStream);
+ // FIXME: Throw if DirectPlayErrors has no value?
+ var videoCodecProfileReasons = (videoStream?.DirectPlayErrors ?? 0) & ~GenericReasons;
- // Check audio candidates profile conditions
- var audioStreamMatches = candidateAudioStreams.ToDictionary(s => s, audioStream => GetCompatibilityAudioCodecDirect(options, mediaSource, container, audioStream, true, mediaSource.IsSecondaryAudio(audioStream) ?? false));
+ // FIXME: Throw if DirectPlayErrors has no value?
+ var audioStreamMatches = candidateAudioStreams.ToDictionary(s => s, audioStream => (audioStream.DirectPlayErrors ?? 0) & ~GenericReasons);
- TranscodeReason subtitleProfileReasons = 0;
- if (subtitleStream is not null)
- {
- var subtitleProfile = GetSubtitleProfile(mediaSource, subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.DirectPlay, _transcoderSupport, container, null);
+ // FIXME: Throw if DirectPlayErrors has no value?
+ var subtitleProfileReasons = (subtitleStream?.DirectPlayErrors ?? 0) & ~GenericReasons;
- if (subtitleProfile.Method != SubtitleDeliveryMethod.Drop
- && subtitleProfile.Method != SubtitleDeliveryMethod.External
- && subtitleProfile.Method != SubtitleDeliveryMethod.Embed)
- {
- _logger.LogDebug("Not eligible for {0} due to unsupported subtitles", PlayMethod.DirectPlay);
- subtitleProfileReasons |= TranscodeReason.SubtitleCodecNotSupported;
- }
+ if ((subtitleProfileReasons & TranscodeReason.SubtitleCodecNotSupported) != 0)
+ {
+ _logger.LogDebug("Not eligible for {0} due to unsupported subtitles", PlayMethod.DirectPlay);
}
var containerSupported = false;
@@ -2489,5 +2488,188 @@ namespace MediaBrowser.Model.Dlna
return failures;
}
+
+ /// <summary>
+ /// Sets compatibility errors (if any) for streams.
+ /// </summary>
+ /// <param name="mediaType">The <see cref="MediaType"/> of object for which to check compatibility.</param>
+ /// <param name="options">The <see cref="MediaOptions"/> object for which to check compatibility.</param>
+ public void CheckCompatibility(MediaType mediaType, MediaOptions options)
+ {
+ foreach (var mediaSource in options.MediaSources)
+ {
+ CheckCompatibility(mediaType, mediaSource, options);
+ }
+ }
+
+ /// <summary>
+ /// Sets compatibility errors (if any) for streams.
+ /// </summary>
+ /// <param name="mediaType">The <see cref="MediaType"/> of object for which to check compatibility.</param>
+ /// <param name="mediaSource">The <see cref="MediaSourceInfo"/>.</param>
+ /// <param name="options">The <see cref="MediaOptions"/> object for which to check compatibility.</param>
+ public void CheckCompatibility(MediaType mediaType, MediaSourceInfo mediaSource, MediaOptions options)
+ {
+ foreach (var stream in mediaSource.MediaStreams)
+ {
+ stream.DirectPlayErrors ??= GetCompatibility(mediaType, mediaSource, stream, options);
+ }
+ }
+
+ /// <summary>
+ /// Gets stream compatibility errors, if any.
+ /// </summary>
+ /// <param name="mediaType">The <see cref="MediaType"/> of object for which to check compatibility.</param>
+ /// <param name="mediaSource">The <see cref="MediaSourceInfo"/>.</param>
+ /// <param name="stream">The <see cref="MediaStream"/> for which to check compatibility.</param>
+ /// <param name="options">The <see cref="MediaOptions"/> object for which to check compatibility.</param>
+ /// <returns>Stream compatibility errors, if any.</returns>
+ private TranscodeReason GetCompatibility(MediaType mediaType, MediaSourceInfo mediaSource, MediaStream stream, MediaOptions options)
+ {
+ switch (stream.Type)
+ {
+ case MediaStreamType.Audio:
+ return GetCompatibilityAudio(options, mediaSource, stream, mediaType == MediaType.Video);
+
+ case MediaStreamType.Video:
+ return GetCompatibilityVideo(options, mediaSource, stream);
+
+ case MediaStreamType.Subtitle:
+ var subtitleProfile = GetSubtitleProfile(mediaSource, stream, options.Profile.SubtitleProfiles, PlayMethod.DirectPlay, _transcoderSupport, mediaSource.Container, null);
+
+ if (subtitleProfile.Method != SubtitleDeliveryMethod.Drop
+ && subtitleProfile.Method != SubtitleDeliveryMethod.External
+ && subtitleProfile.Method != SubtitleDeliveryMethod.Embed)
+ {
+ return TranscodeReason.SubtitleCodecNotSupported;
+ }
+
+ break;
+ }
+
+ return 0;
+ }
+
+ /// <summary>
+ /// Gets video stream compatibility errors, if any.
+ /// </summary>
+ /// <param name="options">Media options.</param>
+ /// <param name="mediaSource">Media source.</param>
+ /// <param name="videoStream">Video stream.</param>
+ /// <returns>Video stream compatibility errors, if any.</returns>
+ private TranscodeReason GetCompatibilityVideo(MediaOptions options, MediaSourceInfo mediaSource, MediaStream videoStream)
+ {
+ var profile = options.Profile;
+ string container = mediaSource.Container;
+ string videoCodec = videoStream.Codec;
+
+ bool containerSupported = false;
+ bool videoSupported = false;
+
+ foreach (var directPlayProfile in profile.DirectPlayProfiles)
+ {
+ if (directPlayProfile.Type == DlnaProfileType.Video)
+ {
+ bool profileSupportsContainer = directPlayProfile.SupportsContainer(container);
+
+ if (!videoSupported && profileSupportsContainer)
+ {
+ containerSupported = true;
+ }
+
+ if (directPlayProfile.SupportsVideoCodec(videoCodec))
+ {
+ videoSupported = true;
+ containerSupported = profileSupportsContainer;
+
+ if (containerSupported)
+ {
+ break;
+ }
+ }
+ }
+ }
+
+ TranscodeReason failures = default;
+
+ if (!containerSupported)
+ {
+ failures |= TranscodeReason.ContainerNotSupported;
+ }
+
+ if (videoSupported)
+ {
+ failures |= GetCompatibilityVideoCodec(options, mediaSource, container, videoStream);
+ }
+ else
+ {
+ failures |= TranscodeReason.VideoCodecNotSupported;
+ }
+
+ return failures;
+ }
+
+ /// <summary>
+ /// Gets audio stream compatibility errors, if any.
+ /// </summary>
+ /// <param name="options">Media options.</param>
+ /// <param name="mediaSource">The <see cref="MediaSourceInfo"/>.</param>
+ /// <param name="audioStream">The <see cref="MediaStream"/> of the audio stream.</param>
+ /// <param name="isVideo">True if source is video.</param>
+ /// <returns>Audio stream compatibility errors, if any.</returns>
+ private TranscodeReason GetCompatibilityAudio(MediaOptions options, MediaSourceInfo mediaSource, MediaStream audioStream, bool isVideo)
+ {
+ var profile = options.Profile;
+ string container = mediaSource.Container;
+ string audioCodec = audioStream.Codec;
+ DlnaProfileType profileType = isVideo ? DlnaProfileType.Video : DlnaProfileType.Audio;
+
+ bool containerSupported = false;
+ bool audioSupported = false;
+
+ foreach (var directPlayProfile in profile.DirectPlayProfiles)
+ {
+ if (directPlayProfile.Type == profileType)
+ {
+ bool profileSupportsContainer = directPlayProfile.SupportsContainer(container);
+
+ if (!audioSupported && profileSupportsContainer)
+ {
+ containerSupported = true;
+ }
+
+ if (directPlayProfile.SupportsAudioCodec(audioCodec))
+ {
+ audioSupported = true;
+ containerSupported = profileSupportsContainer;
+
+ if (containerSupported)
+ {
+ break;
+ }
+ }
+ }
+ }
+
+ TranscodeReason failures = default;
+
+ if (!containerSupported)
+ {
+ failures |= TranscodeReason.ContainerNotSupported;
+ }
+
+ if (audioSupported)
+ {
+ bool isSecondaryAudio = isVideo ? mediaSource.IsSecondaryAudio(audioStream) ?? false : false;
+
+ failures |= GetCompatibilityAudioCodecDirect(options, mediaSource, container, audioStream, isVideo, isSecondaryAudio);
+ }
+ else
+ {
+ failures |= TranscodeReason.AudioCodecNotSupported;
+ }
+
+ return failures;
+ }
}
}
diff --git a/MediaBrowser.Model/Dto/ItemCounts.cs b/MediaBrowser.Model/Dto/ItemCounts.cs
index a15a0c82a8..6204645f64 100644
--- a/MediaBrowser.Model/Dto/ItemCounts.cs
+++ b/MediaBrowser.Model/Dto/ItemCounts.cs
@@ -72,6 +72,12 @@ namespace MediaBrowser.Model.Dto
public int BookCount { get; set; }
/// <summary>
+ /// Gets or sets the audio book count.
+ /// </summary>
+ /// <value>The audio book count.</value>
+ public int AudioBookCount { get; set; }
+
+ /// <summary>
/// Gets or sets the item count.
/// </summary>
/// <value>The item count.</value>
@@ -83,7 +89,7 @@ namespace MediaBrowser.Model.Dto
/// <returns>The total of the counts.</returns>
public int TotalItemCount()
{
- return MovieCount + SeriesCount + EpisodeCount + ArtistCount + ProgramCount + TrailerCount + SongCount + AlbumCount + MusicVideoCount + BoxSetCount + BookCount;
+ return MovieCount + SeriesCount + EpisodeCount + ArtistCount + ProgramCount + TrailerCount + SongCount + AlbumCount + MusicVideoCount + BoxSetCount + BookCount + AudioBookCount;
}
}
}
diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs
index 67af843626..2d1bed4b85 100644
--- a/MediaBrowser.Model/Entities/MediaStream.cs
+++ b/MediaBrowser.Model/Entities/MediaStream.cs
@@ -12,6 +12,7 @@ using Jellyfin.Extensions;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
+using MediaBrowser.Model.Session;
namespace MediaBrowser.Model.Entities
{
@@ -701,6 +702,29 @@ namespace MediaBrowser.Model.Entities
/// <value><c>true</c> if this instance is anamorphic; otherwise, <c>false</c>.</value>
public bool? IsAnamorphic { get; set; }
+ /// <summary>
+ /// Gets or sets DirectPlay errors.
+ /// </summary>
+ /// <value>DirectPlay errors.</value>
+ public TranscodeReason? DirectPlayErrors { get; set; }
+
+ /// <summary>
+ /// Gets a value indicating whether this instance is compatible with the device.
+ /// </summary>
+ /// <value><c>true</c> if this instance is compatible with the device; otherwise, <c>false</c>.</value>
+ public bool? SupportsDirectPlay
+ {
+ get
+ {
+ if (!DirectPlayErrors.HasValue)
+ {
+ return null;
+ }
+
+ return DirectPlayErrors.Value == 0;
+ }
+ }
+
internal string GetResolutionText()
{
if (!Width.HasValue || !Height.HasValue)
diff --git a/MediaBrowser.Model/Globalization/LocalizationManagerExtensions.cs b/MediaBrowser.Model/Globalization/LocalizationManagerExtensions.cs
new file mode 100644
index 0000000000..67cf88e5b8
--- /dev/null
+++ b/MediaBrowser.Model/Globalization/LocalizationManagerExtensions.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace MediaBrowser.Model.Globalization
+{
+ /// <summary>
+ /// Extension methods for <see cref="ILocalizationManager"/>.
+ /// </summary>
+ public static class LocalizationManagerExtensions
+ {
+ /// <summary>
+ /// Gets every code a media stream in the given language can be tagged with, the most specific first.
+ /// </summary>
+ /// <param name="localizationManager">The localization manager.</param>
+ /// <param name="language">The language, as stored in a setting or a preference.</param>
+ /// <returns>The language codes.</returns>
+ public static IReadOnlyList<string> GetMediaStreamLanguageCodes(this ILocalizationManager localizationManager, string language)
+ {
+ var culture = localizationManager.FindLanguageInfo(language);
+ if (culture is null)
+ {
+ return [language];
+ }
+
+ List<string> codes = [];
+ var tag = culture.TwoLetterISOLanguageName;
+ var separator = tag.IndexOf('-', StringComparison.Ordinal);
+ if (separator > 0)
+ {
+ codes.Add(tag);
+ }
+
+ codes.AddRange(culture.ThreeLetterISOLanguageNames);
+
+ // ffprobe tags a regional track with the code of its base language, a fr-CA track as "fre".
+ if (separator > 0 && localizationManager.FindLanguageInfo(tag[..separator]) is { } baseCulture)
+ {
+ codes.AddRange(baseCulture.ThreeLetterISOLanguageNames);
+ }
+
+ // A stream scanned with a legacy code (pob) keeps it until the item is refreshed.
+ codes.Add(language);
+
+ return codes.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
+ }
+ }
+}
diff --git a/MediaBrowser.Model/LiveTv/LiveTvOptionsDto.cs b/MediaBrowser.Model/LiveTv/LiveTvOptionsDto.cs
new file mode 100644
index 0000000000..3ed7d5b2e5
--- /dev/null
+++ b/MediaBrowser.Model/LiveTv/LiveTvOptionsDto.cs
@@ -0,0 +1,84 @@
+#pragma warning disable CA1819
+
+namespace MediaBrowser.Model.LiveTv;
+
+/// <summary>
+/// The LiveTV options DTO for API use.
+/// </summary>
+public class LiveTvOptionsDto
+{
+ /// <summary>
+ /// Gets or sets the guide days.
+ /// </summary>
+ public int? GuideDays { get; set; }
+
+ /// <summary>
+ /// Gets or sets the recording path.
+ /// </summary>
+ public string? RecordingPath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the movie recording path.
+ /// </summary>
+ public string? MovieRecordingPath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the series recording path.
+ /// </summary>
+ public string? SeriesRecordingPath { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to enable recording subfolders.
+ /// </summary>
+ public bool EnableRecordingSubfolders { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to enable original audio with encoded recordings.
+ /// </summary>
+ public bool EnableOriginalAudioWithEncodedRecordings { get; set; }
+
+ /// <summary>
+ /// Gets or sets the tuner hosts.
+ /// </summary>
+ public TunerHostInfo[] TunerHosts { get; set; } = null!;
+
+ /// <summary>
+ /// Gets or sets the listing providers.
+ /// </summary>
+ public ListingsProviderInfo[] ListingProviders { get; set; } = null!;
+
+ /// <summary>
+ /// Gets or sets the pre-padding seconds.
+ /// </summary>
+ public int PrePaddingSeconds { get; set; }
+
+ /// <summary>
+ /// Gets or sets the post-padding seconds.
+ /// </summary>
+ public int PostPaddingSeconds { get; set; }
+
+ /// <summary>
+ /// Gets or sets the media locations created.
+ /// </summary>
+ public string[] MediaLocationsCreated { get; set; } = null!;
+
+ /// <summary>
+ /// Gets or sets the recording post processor.
+ /// </summary>
+ public string? RecordingPostProcessor { get; set; }
+
+ /// <summary>
+ /// Gets or sets the recording post processor arguments.
+ /// </summary>
+ public string RecordingPostProcessorArguments { get; set; } = null!;
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to save recording NFO.
+ /// </summary>
+ public bool SaveRecordingNFO { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to save recording images.
+ /// </summary>
+ public bool SaveRecordingImages { get; set; }
+}
diff --git a/MediaBrowser.Model/MediaInfo/MediaInfo.cs b/MediaBrowser.Model/MediaInfo/MediaInfo.cs
index 453aeb028a..2e67daba63 100644
--- a/MediaBrowser.Model/MediaInfo/MediaInfo.cs
+++ b/MediaBrowser.Model/MediaInfo/MediaInfo.cs
@@ -61,6 +61,8 @@ namespace MediaBrowser.Model.MediaInfo
public DateTime? PremiereDate { get; set; }
+ public DateTime? ContainerCreationDate { get; set; }
+
public BaseItemPerson[] People { get; set; }
public Dictionary<string, string> ProviderIds { get; set; }
diff --git a/MediaBrowser.Model/Querying/QueryFilters.cs b/MediaBrowser.Model/Querying/QueryFilters.cs
index 095f460923..d4a3d92934 100644
--- a/MediaBrowser.Model/Querying/QueryFilters.cs
+++ b/MediaBrowser.Model/Querying/QueryFilters.cs
@@ -15,6 +15,8 @@ namespace MediaBrowser.Model.Querying
Genres = Array.Empty<NameGuidPair>();
AudioLanguages = Array.Empty<NameValuePair>();
SubtitleLanguages = Array.Empty<NameValuePair>();
+ Years = Array.Empty<int>();
+ OfficialRatings = Array.Empty<string>();
}
public IReadOnlyList<NameGuidPair> Genres { get; set; }
@@ -24,5 +26,9 @@ namespace MediaBrowser.Model.Querying
public IReadOnlyList<NameValuePair> AudioLanguages { get; set; }
public IReadOnlyList<NameValuePair> SubtitleLanguages { get; set; }
+
+ public IReadOnlyList<int> Years { get; set; }
+
+ public IReadOnlyList<string> OfficialRatings { get; set; }
}
}