aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs72
-rw-r--r--MediaBrowser.Controller/MediaInfo/FFMpegManager.cs8
-rw-r--r--MediaBrowser.Controller/Providers/MediaInfo/FFMpegVideoImageProvider.cs9
3 files changed, 86 insertions, 3 deletions
diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
index 56bb18752..ef9b48d5a 100644
--- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Common.IO;
+using System;
+using MediaBrowser.Common.IO;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
@@ -82,6 +83,70 @@ namespace MediaBrowser.Api.Playback.Progressive
}
/// <summary>
+ /// Adds the dlna headers.
+ /// </summary>
+ private bool AddDlnaHeaders(StreamState state)
+ {
+ var headers = Request.Headers;
+
+ if (!string.IsNullOrEmpty(headers["TimeSeekRange.dlna.org"]))
+ {
+ Response.StatusCode = 406;
+ return false;
+ }
+
+ var transferMode = headers["transferMode.dlna.org"];
+ Response.AddHeader("transferMode.dlna.org", string.IsNullOrEmpty(transferMode) ? "Streaming" : transferMode);
+
+ var contentFeatures = string.Empty;
+ var extension = GetOutputFileExtension(state);
+
+ if (string.Equals(extension, ".mp3", StringComparison.OrdinalIgnoreCase))
+ {
+ contentFeatures = "DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000";
+ }
+ else if (string.Equals(extension, ".aac", StringComparison.OrdinalIgnoreCase))
+ {
+ contentFeatures = "DLNA.ORG_PN=AAC_ISO;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000";
+ }
+ else if (string.Equals(extension, ".wma", StringComparison.OrdinalIgnoreCase))
+ {
+ contentFeatures = "DLNA.ORG_PN=WMABASE;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000";
+ }
+ else if (string.Equals(extension, ".avi", StringComparison.OrdinalIgnoreCase))
+ {
+ contentFeatures = "DLNA.ORG_PN=AVI;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000";
+ }
+ else if (string.Equals(extension, ".mp4", StringComparison.OrdinalIgnoreCase))
+ {
+ contentFeatures = "DLNA.ORG_PN=MPEG4_P2_SP_AAC;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000";
+ }
+ else if (string.Equals(extension, ".mpeg", StringComparison.OrdinalIgnoreCase))
+ {
+ contentFeatures = "DLNA.ORG_PN=MPEG_PS_PAL;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000";
+ }
+ else if (string.Equals(extension, ".wmv", StringComparison.OrdinalIgnoreCase))
+ {
+ contentFeatures = "DLNA.ORG_PN=WMVHIGH_BASE;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000";
+ }
+ else if (string.Equals(extension, ".asf", StringComparison.OrdinalIgnoreCase))
+ {
+ contentFeatures = "DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000";
+ }
+ else if (string.Equals(extension, ".mkv", StringComparison.OrdinalIgnoreCase))
+ {
+ contentFeatures = "DLNA.ORG_OP=01;DLNA.ORG_CI=0";
+ }
+
+ if (!string.IsNullOrEmpty(contentFeatures))
+ {
+ Response.AddHeader("ContentFeatures.DLNA.ORG", contentFeatures);
+ }
+
+ return true;
+ }
+
+ /// <summary>
/// Gets the type of the transcoding job.
/// </summary>
/// <value>The type of the transcoding job.</value>
@@ -100,6 +165,11 @@ namespace MediaBrowser.Api.Playback.Progressive
{
var state = GetState(request);
+ if (!AddDlnaHeaders(state))
+ {
+ return null;
+ }
+
if (request.Static)
{
return ToStaticFileResult(state.Item.Path, isHeadRequest);
diff --git a/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs b/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs
index 4c4bc0873..01746c7ce 100644
--- a/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs
+++ b/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs
@@ -51,7 +51,7 @@ namespace MediaBrowser.Controller.MediaInfo
/// The _logger
/// </summary>
private readonly Kernel _kernel;
-
+
/// <summary>
/// The _logger
/// </summary>
@@ -591,6 +591,12 @@ namespace MediaBrowser.Controller.MediaInfo
throw new ArgumentNullException();
}
+ // Can't extract images if there are no video streams
+ if (video.MediaStreams == null || video.MediaStreams.All(m => m.Type != MediaStreamType.Video))
+ {
+ return;
+ }
+
var changesMade = false;
foreach (var chapter in video.Chapters)
diff --git a/MediaBrowser.Controller/Providers/MediaInfo/FFMpegVideoImageProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/FFMpegVideoImageProvider.cs
index 5a8157ebf..3d258fe66 100644
--- a/MediaBrowser.Controller/Providers/MediaInfo/FFMpegVideoImageProvider.cs
+++ b/MediaBrowser.Controller/Providers/MediaInfo/FFMpegVideoImageProvider.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Common.IO;
+using System.Linq;
+using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Entities;
@@ -47,6 +48,12 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
if (video != null)
{
+ // Can't extract images if there are no video streams
+ if (video.MediaStreams == null || video.MediaStreams.All(m => m.Type != MediaStreamType.Video))
+ {
+ return false;
+ }
+
if (video.VideoType == VideoType.Iso && video.IsoType.HasValue && _isoManager.CanMount(item.Path))
{
return true;