aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-03-17 16:23:34 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-03-17 16:23:34 -0400
commitc9ee7633caacb548fd54c33c7c9df1be29b71d29 (patch)
tree5d820adf0ec9a243a9c497af784a46adbebb5fb1
parentdb904832388278a36d5f1b1e7c1609931694e9e7 (diff)
embed recording button into video player
-rw-r--r--Emby.Common.Implementations/Net/SocketFactory.cs12
-rw-r--r--MediaBrowser.Api/Playback/Hls/BaseHlsService.cs7
-rw-r--r--MediaBrowser.Api/Playback/StreamRequest.cs3
-rw-r--r--MediaBrowser.Api/Playback/StreamState.cs18
-rw-r--r--MediaBrowser.Model/Dlna/StreamBuilder.cs9
-rw-r--r--MediaBrowser.Model/Dlna/StreamInfo.cs14
-rw-r--r--MediaBrowser.Model/Dlna/TranscodingProfile.cs6
7 files changed, 67 insertions, 2 deletions
diff --git a/Emby.Common.Implementations/Net/SocketFactory.cs b/Emby.Common.Implementations/Net/SocketFactory.cs
index 0f4306a6b..1fd367afb 100644
--- a/Emby.Common.Implementations/Net/SocketFactory.cs
+++ b/Emby.Common.Implementations/Net/SocketFactory.cs
@@ -52,6 +52,18 @@ namespace Emby.Common.Implementations.Net
{
throw new SocketCreateException(ex.SocketErrorCode.ToString(), ex);
}
+ catch (ArgumentException ex)
+ {
+ if (dualMode)
+ {
+ // Mono for BSD incorrectly throws ArgumentException instead of SocketException
+ throw new SocketCreateException("AddressFamilyNotSupported", ex);
+ }
+ else
+ {
+ throw;
+ }
+ }
}
public ISocket CreateTcpSocket(IpAddressInfo remoteAddress, int remotePort)
diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
index 98115b840..d2f14f4b8 100644
--- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
@@ -110,8 +110,11 @@ namespace MediaBrowser.Api.Playback.Hls
throw;
}
- var waitForSegments = state.SegmentLength >= 10 ? 2 : 3;
- await WaitForMinimumSegmentCount(playlist, waitForSegments, cancellationTokenSource.Token).ConfigureAwait(false);
+ var minSegments = state.MinSegments;
+ if (minSegments > 0)
+ {
+ await WaitForMinimumSegmentCount(playlist, minSegments, cancellationTokenSource.Token).ConfigureAwait(false);
+ }
}
}
finally
diff --git a/MediaBrowser.Api/Playback/StreamRequest.cs b/MediaBrowser.Api/Playback/StreamRequest.cs
index d1bf9c120..f49fd87e0 100644
--- a/MediaBrowser.Api/Playback/StreamRequest.cs
+++ b/MediaBrowser.Api/Playback/StreamRequest.cs
@@ -42,6 +42,9 @@ namespace MediaBrowser.Api.Playback
public string LiveStreamId { get; set; }
public string Tag { get; set; }
public string SegmentContainer { get; set; }
+
+ public int? SegmentLength { get; set; }
+ public int? MinSegments { get; set; }
}
public class VideoStreamRequest : StreamRequest
diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs
index 912d60889..22a0fa7c9 100644
--- a/MediaBrowser.Api/Playback/StreamState.cs
+++ b/MediaBrowser.Api/Playback/StreamState.cs
@@ -60,6 +60,11 @@ namespace MediaBrowser.Api.Playback
{
get
{
+ if (Request.SegmentLength.HasValue)
+ {
+ return Request.SegmentLength.Value;
+ }
+
if (string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
var userAgent = UserAgent ?? string.Empty;
@@ -86,6 +91,19 @@ namespace MediaBrowser.Api.Playback
}
}
+ public int MinSegments
+ {
+ get
+ {
+ if (Request.MinSegments.HasValue)
+ {
+ return Request.MinSegments.Value;
+ }
+
+ return SegmentLength >= 10 ? 2 : 3;
+ }
+ }
+
public bool IsSegmentedLiveStream
{
get
diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs
index 80d3ea3fb..bfb65ed42 100644
--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs
+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs
@@ -484,6 +484,15 @@ namespace MediaBrowser.Model.Dlna
playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps;
playlistItem.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest;
+ if (transcodingProfile.MinSegments > 0)
+ {
+ playlistItem.MinSegments = transcodingProfile.MinSegments;
+ }
+ if (transcodingProfile.SegmentLength > 0)
+ {
+ playlistItem.SegmentLength = transcodingProfile.SegmentLength;
+ }
+
if (!string.IsNullOrEmpty(transcodingProfile.MaxAudioChannels))
{
int transcodingMaxAudioChannels;
diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs
index 7e42e7fae..5705e6477 100644
--- a/MediaBrowser.Model/Dlna/StreamInfo.cs
+++ b/MediaBrowser.Model/Dlna/StreamInfo.cs
@@ -6,6 +6,7 @@ using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Session;
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.Linq;
namespace MediaBrowser.Model.Dlna
@@ -37,6 +38,9 @@ namespace MediaBrowser.Model.Dlna
public string VideoProfile { get; set; }
+ public int? SegmentLength { get; set; }
+ public int? MinSegments { get; set; }
+
public bool RequireAvc { get; set; }
public bool DeInterlace { get; set; }
public bool RequireNonAnamorphic { get; set; }
@@ -291,6 +295,16 @@ namespace MediaBrowser.Model.Dlna
if (!isDlna && isHls)
{
list.Add(new NameValuePair("SegmentContainer", item.Container ?? string.Empty));
+
+ if (item.SegmentLength.HasValue)
+ {
+ list.Add(new NameValuePair("SegmentLength", item.SegmentLength.Value.ToString(CultureInfo.InvariantCulture)));
+ }
+
+ if (item.MinSegments.HasValue)
+ {
+ list.Add(new NameValuePair("MinSegments", item.MinSegments.Value.ToString(CultureInfo.InvariantCulture)));
+ }
}
return list;
diff --git a/MediaBrowser.Model/Dlna/TranscodingProfile.cs b/MediaBrowser.Model/Dlna/TranscodingProfile.cs
index 76f2332f2..350556e90 100644
--- a/MediaBrowser.Model/Dlna/TranscodingProfile.cs
+++ b/MediaBrowser.Model/Dlna/TranscodingProfile.cs
@@ -42,6 +42,12 @@ namespace MediaBrowser.Model.Dlna
[XmlAttribute("maxAudioChannels")]
public string MaxAudioChannels { get; set; }
+ [XmlAttribute("minSegments")]
+ public int MinSegments { get; set; }
+
+ [XmlAttribute("segmentLength")]
+ public int SegmentLength { get; set; }
+
public List<string> GetAudioCodecs()
{
List<string> list = new List<string>();