mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-18 06:53:07 +03:00
Implement code feedback
- Rewrite AudioResolver - Use async & await instead of .Result - Add support for audio containers with multiple audio streams (e.g. mka) - Fix bug when using external subtitle and external audio streams at the same time
This commit is contained in:
@@ -678,12 +678,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
arg.Append("-i ")
|
||||
.Append(GetInputPathArgument(state));
|
||||
|
||||
if (state.AudioStream.IsExternal)
|
||||
{
|
||||
arg.Append(" -i ")
|
||||
.Append(string.Format(CultureInfo.InvariantCulture, "file:\"{0}\"", state.AudioStream.Path));
|
||||
}
|
||||
|
||||
if (state.SubtitleStream != null
|
||||
&& state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode
|
||||
&& state.SubtitleStream.IsExternal && !state.SubtitleStream.IsTextSubtitleStream)
|
||||
@@ -702,6 +696,12 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
arg.Append(" -i \"").Append(subtitlePath).Append('\"');
|
||||
}
|
||||
|
||||
if (state.AudioStream != null && state.AudioStream.IsExternal)
|
||||
{
|
||||
arg.Append(" -i ")
|
||||
.Append(string.Format(CultureInfo.InvariantCulture, "file:\"{0}\"", state.AudioStream.Path));
|
||||
}
|
||||
|
||||
return arg.ToString();
|
||||
}
|
||||
|
||||
@@ -2007,7 +2007,14 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
if (state.AudioStream.IsExternal)
|
||||
{
|
||||
args += " -map 1:a";
|
||||
int externalAudioMapIndex = state.SubtitleStream != null && state.SubtitleStream.IsExternal ? 2 : 1;
|
||||
int externalAudioStream = state.MediaSource.MediaStreams.Where(i => i.Path == state.AudioStream.Path).ToList().IndexOf(state.AudioStream);
|
||||
|
||||
args += string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
" -map {0}:{1}",
|
||||
externalAudioMapIndex,
|
||||
externalAudioStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user