mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-06 15:58:29 +01:00
pass all audio codecs to server
This commit is contained in:
@@ -216,7 +216,15 @@ namespace MediaBrowser.Model.Dlna
|
||||
playlistItem.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo;
|
||||
playlistItem.EstimateContentLength = transcodingProfile.EstimateContentLength;
|
||||
playlistItem.Container = transcodingProfile.Container;
|
||||
playlistItem.AudioCodec = transcodingProfile.AudioCodec;
|
||||
|
||||
if (string.IsNullOrEmpty(transcodingProfile.AudioCodec))
|
||||
{
|
||||
playlistItem.AudioCodecs = new string[] { };
|
||||
}
|
||||
else
|
||||
{
|
||||
playlistItem.AudioCodecs = transcodingProfile.AudioCodec.Split(',');
|
||||
}
|
||||
playlistItem.SubProtocol = transcodingProfile.Protocol;
|
||||
|
||||
List<CodecProfile> audioCodecProfiles = new List<CodecProfile>();
|
||||
@@ -439,22 +447,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
playlistItem.EstimateContentLength = transcodingProfile.EstimateContentLength;
|
||||
playlistItem.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo;
|
||||
|
||||
// TODO: We should probably preserve the full list and sent it to the server that way
|
||||
string[] supportedAudioCodecs = transcodingProfile.AudioCodec.Split(',');
|
||||
string inputAudioCodec = audioStream == null ? null : audioStream.Codec;
|
||||
foreach (string supportedAudioCodec in supportedAudioCodecs)
|
||||
{
|
||||
if (StringHelper.EqualsIgnoreCase(supportedAudioCodec, inputAudioCodec))
|
||||
{
|
||||
playlistItem.AudioCodec = supportedAudioCodec;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(playlistItem.AudioCodec))
|
||||
{
|
||||
playlistItem.AudioCodec = supportedAudioCodecs[0];
|
||||
}
|
||||
playlistItem.AudioCodecs = transcodingProfile.AudioCodec.Split(',');
|
||||
|
||||
playlistItem.VideoCodec = transcodingProfile.VideoCodec;
|
||||
playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps;
|
||||
@@ -488,7 +481,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
List<ProfileCondition> audioTranscodingConditions = new List<ProfileCondition>();
|
||||
foreach (CodecProfile i in options.Profile.CodecProfiles)
|
||||
{
|
||||
if (i.Type == CodecType.VideoAudio && i.ContainsCodec(playlistItem.AudioCodec, transcodingProfile.Container))
|
||||
if (i.Type == CodecType.VideoAudio && i.ContainsCodec(playlistItem.TargetAudioCodec, transcodingProfile.Container))
|
||||
{
|
||||
foreach (ProfileCondition c in i.Conditions)
|
||||
{
|
||||
|
||||
@@ -14,6 +14,11 @@ namespace MediaBrowser.Model.Dlna
|
||||
/// </summary>
|
||||
public class StreamInfo
|
||||
{
|
||||
public StreamInfo()
|
||||
{
|
||||
AudioCodecs = new string[] { };
|
||||
}
|
||||
|
||||
public string ItemId { get; set; }
|
||||
|
||||
public PlayMethod PlayMethod { get; set; }
|
||||
@@ -32,7 +37,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
public bool CopyTimestamps { get; set; }
|
||||
public bool ForceLiveStream { get; set; }
|
||||
public string AudioCodec { get; set; }
|
||||
public string[] AudioCodecs { get; set; }
|
||||
|
||||
public int? AudioStreamIndex { get; set; }
|
||||
|
||||
@@ -191,12 +196,16 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
List<NameValuePair> list = new List<NameValuePair>();
|
||||
|
||||
string audioCodecs = item.AudioCodecs.Length == 0 ?
|
||||
string.Empty :
|
||||
string.Join(",", item.AudioCodecs);
|
||||
|
||||
list.Add(new NameValuePair("DeviceProfileId", item.DeviceProfileId ?? string.Empty));
|
||||
list.Add(new NameValuePair("DeviceId", item.DeviceId ?? string.Empty));
|
||||
list.Add(new NameValuePair("MediaSourceId", item.MediaSourceId ?? string.Empty));
|
||||
list.Add(new NameValuePair("Static", item.IsDirectStream.ToString().ToLower()));
|
||||
list.Add(new NameValuePair("VideoCodec", item.VideoCodec ?? string.Empty));
|
||||
list.Add(new NameValuePair("AudioCodec", item.AudioCodec ?? string.Empty));
|
||||
list.Add(new NameValuePair("AudioCodec", audioCodecs));
|
||||
list.Add(new NameValuePair("AudioStreamIndex", item.AudioStreamIndex.HasValue ? StringHelper.ToStringCultureInvariant(item.AudioStreamIndex.Value) : string.Empty));
|
||||
list.Add(new NameValuePair("SubtitleStreamIndex", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? StringHelper.ToStringCultureInvariant(item.SubtitleStreamIndex.Value) : string.Empty));
|
||||
list.Add(new NameValuePair("VideoBitrate", item.VideoBitrate.HasValue ? StringHelper.ToStringCultureInvariant(item.VideoBitrate.Value) : string.Empty));
|
||||
@@ -278,7 +287,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
// HLS will preserve timestamps so we can just grab the full subtitle stream
|
||||
long startPositionTicks = StringHelper.EqualsIgnoreCase(SubProtocol, "hls")
|
||||
? 0
|
||||
: (PlayMethod == PlayMethod.Transcode && !CopyTimestamps ? StartPositionTicks : 0);
|
||||
: (PlayMethod == PlayMethod.Transcode && !CopyTimestamps ? StartPositionTicks : 0);
|
||||
|
||||
// First add the selected track
|
||||
if (SubtitleStreamIndex.HasValue)
|
||||
@@ -555,9 +564,22 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
MediaStream stream = TargetAudioStream;
|
||||
|
||||
return IsDirectStream
|
||||
? (stream == null ? null : stream.Codec)
|
||||
: AudioCodec;
|
||||
string inputCodec = stream == null ? null : stream.Codec;
|
||||
|
||||
if (IsDirectStream)
|
||||
{
|
||||
return inputCodec;
|
||||
}
|
||||
|
||||
foreach (string codec in AudioCodecs)
|
||||
{
|
||||
if (StringHelper.EqualsIgnoreCase(codec, inputCodec))
|
||||
{
|
||||
return codec;
|
||||
}
|
||||
}
|
||||
|
||||
return AudioCodecs.Length == 0 ? null : AudioCodecs[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user