Add EqualsAny for VideoCodecTag condition
Signed-off-by: nyanmisaka <nst799610810@gmail.com>
This commit is contained in:
parent
a32fe89dad
commit
be265cd87f
|
@ -87,6 +87,12 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
/// <value>The level.</value>
|
/// <value>The level.</value>
|
||||||
public string Level { get; set; }
|
public string Level { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the codec tag.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The codec tag.</value>
|
||||||
|
public string CodecTag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the framerate.
|
/// Gets or sets the framerate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -619,6 +619,26 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
return Array.Empty<string>();
|
return Array.Empty<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string[] GetRequestedCodecTags(string codec)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(BaseRequest.CodecTag))
|
||||||
|
{
|
||||||
|
return BaseRequest.CodecTag.Split(new[] { '|', ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(codec))
|
||||||
|
{
|
||||||
|
var codectag = BaseRequest.GetOption(codec, "codectag");
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(codectag))
|
||||||
|
{
|
||||||
|
return codectag.Split(new[] { '|', ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.Empty<string>();
|
||||||
|
}
|
||||||
|
|
||||||
public string GetRequestedLevel(string codec)
|
public string GetRequestedLevel(string codec)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(BaseRequest.Level))
|
if (!string.IsNullOrEmpty(BaseRequest.Level))
|
||||||
|
|
|
@ -1944,6 +1944,38 @@ namespace MediaBrowser.Model.Dlna
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ProfileConditionValue.VideoCodecTag:
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(qualifier))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// change from split by | to comma
|
||||||
|
// strip spaces to avoid having to encode
|
||||||
|
var values = value
|
||||||
|
.Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||||
|
|
||||||
|
if (condition.Condition == ProfileConditionType.Equals)
|
||||||
|
{
|
||||||
|
item.SetOption(qualifier, "codectag", string.Join(',', values));
|
||||||
|
}
|
||||||
|
else if (condition.Condition == ProfileConditionType.EqualsAny)
|
||||||
|
{
|
||||||
|
var currentValue = item.GetOption(qualifier, "codectag");
|
||||||
|
if (!string.IsNullOrEmpty(currentValue) && values.Any(v => string.Equals(v, currentValue, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
{
|
||||||
|
item.SetOption(qualifier, "codectag", currentValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item.SetOption(qualifier, "codectag", string.Join(',', values));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case ProfileConditionValue.Height:
|
case ProfileConditionValue.Height:
|
||||||
{
|
{
|
||||||
if (!enableNonQualifiedConditions)
|
if (!enableNonQualifiedConditions)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user