mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-26 03:57:12 +00:00
separate deinterlacing params by video codec
This commit is contained in:
@@ -796,12 +796,13 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
if (videoStream.IsInterlaced)
|
||||
{
|
||||
if (request.DeInterlace)
|
||||
if (state.DeInterlace(videoStream.Codec))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (videoStream.IsAnamorphic ?? false)
|
||||
{
|
||||
if (request.RequireNonAnamorphic)
|
||||
@@ -1357,7 +1358,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
filters.Add("hwupload");
|
||||
}
|
||||
|
||||
if (state.DeInterlace && !string.Equals(outputVideoCodec, "h264_vaapi", StringComparison.OrdinalIgnoreCase))
|
||||
if (state.DeInterlace("h264") && !string.Equals(outputVideoCodec, "h264_vaapi", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (string.Equals(options.DeinterlaceMethod, "bobandweave", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -1799,11 +1800,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
state.InternalSubtitleStreamOffset = mediaStreams.Where(i => i.Type == MediaStreamType.Subtitle && !i.IsExternal).ToList().IndexOf(state.SubtitleStream);
|
||||
}
|
||||
|
||||
if (state.VideoStream != null && state.VideoStream.IsInterlaced)
|
||||
{
|
||||
state.DeInterlace = true;
|
||||
}
|
||||
|
||||
EnforceResolutionLimit(state);
|
||||
|
||||
NormalizeSubtitleEmbed(state);
|
||||
|
||||
@@ -160,7 +160,26 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
public int? OutputAudioBitrate;
|
||||
public int? OutputAudioChannels;
|
||||
public bool DeInterlace { get; set; }
|
||||
|
||||
public bool DeInterlace(string videoCodec)
|
||||
{
|
||||
// Support general param
|
||||
if (BaseRequest.DeInterlace)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(videoCodec))
|
||||
{
|
||||
if (string.Equals(BaseRequest.GetOption(videoCodec, "deinterlace"), "true", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsVideoRequest { get; set; }
|
||||
public TranscodingJobType TranscodingType { get; set; }
|
||||
|
||||
@@ -435,6 +454,28 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
}
|
||||
}
|
||||
|
||||
public string ActualOutputVideoCodec
|
||||
{
|
||||
get
|
||||
{
|
||||
var codec = OutputVideoCodec;
|
||||
|
||||
if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var stream = VideoStream;
|
||||
|
||||
if (stream != null)
|
||||
{
|
||||
return stream.Codec;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return codec;
|
||||
}
|
||||
}
|
||||
|
||||
public bool? IsTargetInterlaced
|
||||
{
|
||||
get
|
||||
@@ -444,7 +485,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
return VideoStream == null ? (bool?)null : VideoStream.IsInterlaced;
|
||||
}
|
||||
|
||||
if (DeInterlace)
|
||||
if (DeInterlace(ActualOutputVideoCodec))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Globalization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Services;
|
||||
|
||||
@@ -224,12 +226,41 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
public EncodingContext Context { get; set; }
|
||||
|
||||
public void SetOption(string qualifier, string name, string value)
|
||||
{
|
||||
SetOption(qualifier + "-" + name, value);
|
||||
}
|
||||
|
||||
public Dictionary<string, string> StreamOptions { get; private set; }
|
||||
|
||||
public void SetOption(string name, string value)
|
||||
{
|
||||
StreamOptions[name] = value;
|
||||
}
|
||||
|
||||
public string GetOption(string qualifier, string name)
|
||||
{
|
||||
return GetOption(qualifier + "-" + name);
|
||||
}
|
||||
|
||||
public string GetOption(string name)
|
||||
{
|
||||
string value;
|
||||
if (StreamOptions.TryGetValue(name, out value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public BaseEncodingJobOptions()
|
||||
{
|
||||
EnableAutoStreamCopy = true;
|
||||
AllowVideoStreamCopy = true;
|
||||
AllowAudioStreamCopy = true;
|
||||
Context = EncodingContext.Streaming;
|
||||
StreamOptions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user