Add referer parameter to ffmpeg

As of https://trac.ffmpeg.org/ticket/2179, ffmpeg supports referer parameter which injects Referer header to the HTTP request for remote content. Have EncodingHelper pass this in if it's included in RemoteHttpHeaders.
This commit is contained in:
Joseph 2022-07-18 23:30:27 -07:00 committed by GitHub
parent c2902dd108
commit 54b3debd27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -255,6 +255,21 @@ namespace MediaBrowser.Controller.MediaEncoding
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)
{
if (string.IsNullOrEmpty(container))
@ -4962,6 +4977,15 @@ namespace MediaBrowser.Controller.MediaEncoding
inputModifier = inputModifier.Trim();
var refererParam = GetRefererParam(state);
if (!string.IsNullOrEmpty(refererParam))
{
inputModifier += " " + refererParam;
}
inputModifier = inputModifier.Trim();
inputModifier += " " + GetFastSeekCommandLineParameter(state, encodingOptions, segmentContainer);
inputModifier = inputModifier.Trim();