mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-16 05:53:03 +03:00
pass all audio codecs to server
This commit is contained in:
@@ -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