aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-05-14 01:40:01 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-05-14 01:40:01 -0400
commit187b1099bc0ce50b8b2bef8ff37fa4be6e1b3739 (patch)
tree4e7f9c5edd44f22f5d933053dd6420ff8d6b705b
parent4837b08e7db68f81e9b6b3ab3751f5e3f27e9457 (diff)
update firefox profile
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs21
-rw-r--r--MediaBrowser.Api/Playback/StreamRequest.cs4
-rw-r--r--MediaBrowser.Model/Dlna/StreamBuilder.cs9
-rw-r--r--MediaBrowser.Model/Dlna/StreamInfo.cs5
-rw-r--r--MediaBrowser.Model/Dlna/TranscodingProfile.cs3
5 files changed, 36 insertions, 6 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 800f246c4..792e46842 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -712,15 +712,16 @@ namespace MediaBrowser.Api.Playback
inputChannels = null;
}
+ int? resultChannels = null;
var codec = outputAudioCodec ?? string.Empty;
if (codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1)
{
// wmav2 currently only supports two channel output
- return Math.Min(2, inputChannels ?? 2);
+ resultChannels = Math.Min(2, inputChannels ?? 2);
}
- if (request.MaxAudioChannels.HasValue)
+ else if (request.MaxAudioChannels.HasValue)
{
var channelLimit = codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1
? 2
@@ -732,10 +733,18 @@ namespace MediaBrowser.Api.Playback
}
// If we don't have any media info then limit it to 5 to prevent encoding errors due to asking for too many channels
- return Math.Min(request.MaxAudioChannels.Value, channelLimit);
+ resultChannels = Math.Min(request.MaxAudioChannels.Value, channelLimit);
}
- return request.AudioChannels;
+ if (resultChannels.HasValue && !string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
+ {
+ if (request.TranscodingMaxAudioChannels.HasValue)
+ {
+ resultChannels = Math.Min(request.TranscodingMaxAudioChannels.Value, resultChannels.Value);
+ }
+ }
+
+ return resultChannels ?? request.AudioChannels;
}
/// <summary>
@@ -1504,6 +1513,10 @@ namespace MediaBrowser.Api.Playback
}
}
}
+ else if (i == 26)
+ {
+ request.TranscodingMaxAudioChannels = int.Parse(val, UsCulture);
+ }
}
}
diff --git a/MediaBrowser.Api/Playback/StreamRequest.cs b/MediaBrowser.Api/Playback/StreamRequest.cs
index 371dbbda2..370915ec3 100644
--- a/MediaBrowser.Api/Playback/StreamRequest.cs
+++ b/MediaBrowser.Api/Playback/StreamRequest.cs
@@ -51,7 +51,9 @@ namespace MediaBrowser.Api.Playback
[ApiMember(Name = "MaxAudioChannels", Description = "Optional. Specify a maximum number of audio channels to encode to, e.g. 2", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? MaxAudioChannels { get; set; }
-
+
+ public int? TranscodingMaxAudioChannels { get; set; }
+
/// <summary>
/// Gets or sets the audio sample rate.
/// </summary>
diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs
index 07a4b8995..7721bfd15 100644
--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs
+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs
@@ -459,6 +459,15 @@ namespace MediaBrowser.Model.Dlna
playlistItem.VideoCodec = transcodingProfile.VideoCodec;
playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps;
playlistItem.ForceLiveStream = transcodingProfile.ForceLiveStream;
+
+ if (!string.IsNullOrEmpty(transcodingProfile.MaxAudioChannels))
+ {
+ int transcodingMaxAudioChannels;
+ if (IntHelper.TryParseCultureInvariant(transcodingProfile.MaxAudioChannels, out transcodingMaxAudioChannels))
+ {
+ playlistItem.TranscodingMaxAudioChannels = transcodingMaxAudioChannels;
+ }
+ }
playlistItem.SubProtocol = transcodingProfile.Protocol;
playlistItem.AudioStreamIndex = audioStreamIndex;
diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs
index 644f732a7..313c30e2c 100644
--- a/MediaBrowser.Model/Dlna/StreamInfo.cs
+++ b/MediaBrowser.Model/Dlna/StreamInfo.cs
@@ -38,6 +38,7 @@ namespace MediaBrowser.Model.Dlna
public int? SubtitleStreamIndex { get; set; }
+ public int? TranscodingMaxAudioChannels { get; set; }
public int? MaxAudioChannels { get; set; }
public int? AudioBitrate { get; set; }
@@ -237,7 +238,9 @@ namespace MediaBrowser.Model.Dlna
list.Add(new NameValuePair("CopyTimestamps", item.CopyTimestamps.ToString().ToLower()));
list.Add(new NameValuePair("ForceLiveStream", item.ForceLiveStream.ToString().ToLower()));
list.Add(new NameValuePair("SubtitleMethod", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? item.SubtitleDeliveryMethod.ToString() : string.Empty));
-
+
+ list.Add(new NameValuePair("TranscodingMaxAudioChannels", item.TranscodingMaxAudioChannels.HasValue ? StringHelper.ToStringCultureInvariant(item.TranscodingMaxAudioChannels.Value) : string.Empty));
+
return list;
}
diff --git a/MediaBrowser.Model/Dlna/TranscodingProfile.cs b/MediaBrowser.Model/Dlna/TranscodingProfile.cs
index 36c357926..d1314c17b 100644
--- a/MediaBrowser.Model/Dlna/TranscodingProfile.cs
+++ b/MediaBrowser.Model/Dlna/TranscodingProfile.cs
@@ -38,6 +38,9 @@ namespace MediaBrowser.Model.Dlna
[XmlAttribute("forceLiveStream")]
public bool ForceLiveStream { get; set; }
+ [XmlAttribute("maxAudioChannels")]
+ public string MaxAudioChannels { get; set; }
+
public List<string> GetAudioCodecs()
{
List<string> list = new List<string>();