mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 05:47:14 -04:00
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:
parent
c2902dd108
commit
54b3debd27
@ -255,6 +255,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))
|
||||||
@ -4962,6 +4977,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();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user