Refactor for clarity; add docs and .editorconfig
Refactored code to consistently use `this.` for instance members, improving clarity and maintainability. Added XML documentation comments to multiple methods and properties for better API documentation. Streamlined `FfProbeKeyframeExtractor` logic and enhanced EBML parsing code with comments and style improvements. Introduced a new `.editorconfig` to disable legacy StyleCop and IDisposableAnalyzers rules. Updated binary files, assembly info, and NuGet cache files due to rebuilds and dependency changes. No functional changes were made.
This commit is contained in:
@@ -7263,6 +7263,13 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
return inputModifier;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attaches media source information to the encoding job state.
|
||||
/// </summary>
|
||||
/// <param name="state">The encoding job state.</param>
|
||||
/// <param name="encodingOptions">The encoding options.</param>
|
||||
/// <param name="mediaSource">The media source information.</param>
|
||||
/// <param name="requestedUrl">The requested URL.</param>
|
||||
public void AttachMediaSourceInfo(
|
||||
EncodingJobInfo state,
|
||||
EncodingOptions encodingOptions,
|
||||
@@ -7327,26 +7334,26 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
requestedUrl = "test." + videoRequest.Container;
|
||||
}
|
||||
|
||||
videoRequest.VideoCodec = InferVideoCodec(requestedUrl);
|
||||
videoRequest.VideoCodec = this.InferVideoCodec(requestedUrl);
|
||||
}
|
||||
|
||||
state.VideoStream = GetMediaStream(mediaStreams, videoRequest.VideoStreamIndex, MediaStreamType.Video);
|
||||
state.SubtitleStream = GetMediaStream(mediaStreams, videoRequest.SubtitleStreamIndex, MediaStreamType.Subtitle, false);
|
||||
state.VideoStream = this.GetMediaStream(mediaStreams, videoRequest.VideoStreamIndex, MediaStreamType.Video);
|
||||
state.SubtitleStream = this.GetMediaStream(mediaStreams, videoRequest.SubtitleStreamIndex, MediaStreamType.Subtitle, false);
|
||||
state.SubtitleDeliveryMethod = videoRequest.SubtitleMethod;
|
||||
state.AudioStream = GetMediaStream(mediaStreams, videoRequest.AudioStreamIndex, MediaStreamType.Audio);
|
||||
state.AudioStream = this.GetMediaStream(mediaStreams, videoRequest.AudioStreamIndex, MediaStreamType.Audio);
|
||||
|
||||
if (state.SubtitleStream is not null && !state.SubtitleStream.IsExternal)
|
||||
{
|
||||
state.InternalSubtitleStreamOffset = mediaStreams.Where(i => i.Type == MediaStreamType.Subtitle && !i.IsExternal).ToList().IndexOf(state.SubtitleStream);
|
||||
}
|
||||
|
||||
EnforceResolutionLimit(state);
|
||||
this.EnforceResolutionLimit(state);
|
||||
|
||||
NormalizeSubtitleEmbed(state);
|
||||
this.NormalizeSubtitleEmbed(state);
|
||||
}
|
||||
else
|
||||
{
|
||||
state.AudioStream = GetMediaStream(mediaStreams, null, MediaStreamType.Audio, true);
|
||||
state.AudioStream = this.GetMediaStream(mediaStreams, null, MediaStreamType.Audio, true);
|
||||
}
|
||||
|
||||
state.MediaSource = mediaSource;
|
||||
@@ -7357,11 +7364,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
var supportedAudioCodecsList = supportedAudioCodecs.ToList();
|
||||
|
||||
ShiftAudioCodecsIfNeeded(supportedAudioCodecsList, state.AudioStream);
|
||||
this.ShiftAudioCodecsIfNeeded(supportedAudioCodecsList, state.AudioStream);
|
||||
|
||||
state.SupportedAudioCodecs = supportedAudioCodecsList.ToArray();
|
||||
|
||||
request.AudioCodec = state.SupportedAudioCodecs.FirstOrDefault(_mediaEncoder.CanEncodeToAudioCodec)
|
||||
request.AudioCodec = state.SupportedAudioCodecs.FirstOrDefault(this._mediaEncoder.CanEncodeToAudioCodec)
|
||||
?? state.SupportedAudioCodecs.FirstOrDefault();
|
||||
}
|
||||
|
||||
@@ -7370,7 +7377,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
var supportedVideoCodecsList = supportedVideoCodecs.ToList();
|
||||
|
||||
ShiftVideoCodecsIfNeeded(supportedVideoCodecsList, encodingOptions);
|
||||
this.ShiftVideoCodecsIfNeeded(supportedVideoCodecsList, encodingOptions);
|
||||
|
||||
state.SupportedVideoCodecs = supportedVideoCodecsList.ToArray();
|
||||
|
||||
@@ -7791,6 +7798,12 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|| (state.BaseRequest.AlwaysBurnInSubtitleWhenTranscoding && !IsCopyCodec(state.OutputVideoCodec));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the video sync option based on the encoder version.
|
||||
/// </summary>
|
||||
/// <param name="videoSync">The video sync parameter.</param>
|
||||
/// <param name="encoderVersion">The encoder version.</param>
|
||||
/// <returns>The video sync option string.</returns>
|
||||
public static string GetVideoSyncOption(string videoSync, Version encoderVersion)
|
||||
{
|
||||
if (string.IsNullOrEmpty(videoSync))
|
||||
@@ -7808,7 +7821,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
0 => " -fps_mode passthrough",
|
||||
1 => " -fps_mode cfr",
|
||||
2 => " -fps_mode vfr",
|
||||
_ => string.Empty
|
||||
_ => string.Empty,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user