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;
@@ -81,6 +82,70 @@ namespace MediaBrowser.Api.Playback.Progressive
return null;
}
+ ///
+ /// Adds the dlna headers.
+ ///
+ 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;
+ }
+
///
/// Gets the type of the transcoding job.
///
@@ -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);