fix colorspace filter for some files with invalid color metadata (#1254)

This commit is contained in:
Jason Dove
2023-04-20 11:59:31 -05:00
committed by GitHub
parent 73c6758537
commit 6bb1c4299f
4 changed files with 15 additions and 11 deletions
+1
View File
@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Maintain watermark alpha channel (built-in transparency) using QSV acceleration - Maintain watermark alpha channel (built-in transparency) using QSV acceleration
- Properly extract and burn in embedded text subtitles using Jellyfin, Emby and Plex libraries - Properly extract and burn in embedded text subtitles using Jellyfin, Emby and Plex libraries
- Fix bug where deleting a channel would not remove its data from XMLTV - Fix bug where deleting a channel would not remove its data from XMLTV
- Fix colorspace filter for some files with invalid color metadata
### Changed ### Changed
- Remove duplicate items from smart collections before scheduling - Remove duplicate items from smart collections before scheduling
@@ -10,14 +10,14 @@ public record MediaItemInfoStream(
string Profile, string Profile,
string Language, string Language,
int? Channels, int? Channels,
bool Default, bool? Default,
bool Forced, bool? Forced,
bool AttachedPic, bool? AttachedPic,
string PixelFormat, string PixelFormat,
string ColorRange, string ColorRange,
string ColorSpace, string ColorSpace,
string ColorTransfer, string ColorTransfer,
string ColorPrimaries, string ColorPrimaries,
int BitsPerRawSample, int? BitsPerRawSample,
string FileName, string FileName,
string MimeType); string MimeType);
@@ -83,15 +83,15 @@ public class GetMediaItemInfoHandler : IRequestHandler<GetMediaItemInfo, Either<
mediaStream.Profile, mediaStream.Profile,
mediaStream.Language, mediaStream.Language,
mediaStream.Channels > 0 ? mediaStream.Channels : null, mediaStream.Channels > 0 ? mediaStream.Channels : null,
mediaStream.Default, mediaStream.Default ? true : null,
mediaStream.Forced, mediaStream.Forced ? true : null,
mediaStream.AttachedPic, mediaStream.AttachedPic ? true : null,
mediaStream.PixelFormat, mediaStream.PixelFormat,
mediaStream.ColorRange, mediaStream.ColorRange,
mediaStream.ColorSpace, mediaStream.ColorSpace,
mediaStream.ColorTransfer, mediaStream.ColorTransfer,
mediaStream.ColorPrimaries, mediaStream.ColorPrimaries,
mediaStream.BitsPerRawSample, mediaStream.BitsPerRawSample > 0 ? mediaStream.BitsPerRawSample : null,
mediaStream.FileName, mediaStream.FileName,
mediaStream.MimeType); mediaStream.MimeType);
} }
+6 -3
View File
@@ -82,13 +82,16 @@ public class ColorspaceFilter : BaseFilter
if (cp.IsMixed || _forceInputOverrides) if (cp.IsMixed || _forceInputOverrides)
{ {
string range = string.IsNullOrWhiteSpace(cp.ColorRange) ? "tv" : cp.ColorRange; string range = string.IsNullOrWhiteSpace(cp.ColorRange) ? "tv" : cp.ColorRange;
string transfer = string.IsNullOrWhiteSpace(cp.ColorTransfer)
string transfer = string.IsNullOrWhiteSpace(cp.ColorTransfer) || string.Equals(cp.ColorTransfer, "reserved", StringComparison.OrdinalIgnoreCase)
? "bt709" ? "bt709"
: cp.ColorTransfer; : cp.ColorTransfer;
string primaries = string.IsNullOrWhiteSpace(cp.ColorPrimaries)
string primaries = string.IsNullOrWhiteSpace(cp.ColorPrimaries) || string.Equals(cp.ColorPrimaries, "reserved", StringComparison.OrdinalIgnoreCase)
? "bt709" ? "bt709"
: cp.ColorPrimaries; : cp.ColorPrimaries;
string space = string.IsNullOrWhiteSpace(cp.ColorSpace)
string space = string.IsNullOrWhiteSpace(cp.ColorSpace) || string.Equals(cp.ColorSpace, "reserved", StringComparison.OrdinalIgnoreCase)
? "bt709" ? "bt709"
: cp.ColorSpace; : cp.ColorSpace;