Merge pull request #8144 from joseph39/ffmpeg-referer

This commit is contained in:
Bond-009 2022-09-14 19:49:04 +02:00 committed by GitHub
commit 43ec8e9743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -256,6 +256,21 @@ namespace MediaBrowser.Controller.MediaEncoding
return string.Empty; return string.Empty;
} }
/// <summary>
/// Gets the referer param.
/// </summary>
/// <param name="state">The state.</param>
/// <returns>System.String.</returns>
public string GetRefererParam(EncodingJobInfo state)
{
if (state.RemoteHttpHeaders.TryGetValue("Referer", out string referer))
{
return "-referer \"" + referer + "\"";
}
return string.Empty;
}
public static string GetInputFormat(string container) public static string GetInputFormat(string container)
{ {
if (string.IsNullOrEmpty(container)) if (string.IsNullOrEmpty(container))
@ -5001,6 +5016,15 @@ namespace MediaBrowser.Controller.MediaEncoding
inputModifier = inputModifier.Trim(); inputModifier = inputModifier.Trim();
var refererParam = GetRefererParam(state);
if (!string.IsNullOrEmpty(refererParam))
{
inputModifier += " " + refererParam;
}
inputModifier = inputModifier.Trim();
inputModifier += " " + GetFastSeekCommandLineParameter(state, encodingOptions, segmentContainer); inputModifier += " " + GetFastSeekCommandLineParameter(state, encodingOptions, segmentContainer);
inputModifier = inputModifier.Trim(); inputModifier = inputModifier.Trim();