From 4ba4d8d0405ea962196769c51f7123277c1a169d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 3 Apr 2013 08:03:37 -0400 Subject: [PATCH] record level during media analysis --- .../BaseProgressiveStreamingService.cs | 45 ++++++++++++------- .../MediaInfo/BaseFFProbeProvider.cs | 1 + MediaBrowser.Model/Entities/MediaStream.cs | 7 +++ .../Api/DashboardService.cs | 2 +- 4 files changed, 39 insertions(+), 16 deletions(-) diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index 13d103608..52052e16e 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -90,8 +90,9 @@ namespace MediaBrowser.Api.Playback.Progressive /// /// The state. /// The response headers. + /// if set to true [is statically streamed]. /// true if XXXX, false otherwise - private void AddDlnaHeaders(StreamState state, IDictionary responseHeaders) + private void AddDlnaHeaders(StreamState state, IDictionary responseHeaders, bool isStaticallyStreamed) { var timeSeek = RequestContext.GetHeader("TimeSeekRange.dlna.org"); @@ -107,46 +108,56 @@ namespace MediaBrowser.Api.Playback.Progressive var contentFeatures = string.Empty; var extension = GetOutputFileExtension(state); + // first bit means Time based seek supported, second byte range seek supported (not sure about the order now), so 01 = only byte seek, 10 = time based, 11 = both, 00 = none + var org_op = isStaticallyStreamed ? ";DLNA.ORG_OP=01" : ";DLNA.ORG_OP=00"; + + // 0 = native, 1 = transcoded + var org_ci = isStaticallyStreamed ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1"; + + var dlnaflags = ";DLNA.ORG_FLAGS=01500000000000000000000000000000"; + if (string.Equals(extension, ".mp3", StringComparison.OrdinalIgnoreCase)) { - contentFeatures = "DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000"; + contentFeatures = "DLNA.ORG_PN=MP3"; } 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"; + contentFeatures = "DLNA.ORG_PN=AAC_ISO"; } 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"; + contentFeatures = "DLNA.ORG_PN=WMABASE"; } 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"; + contentFeatures = "DLNA.ORG_PN=AVI"; } 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"; + contentFeatures = "DLNA.ORG_PN=AVC_MP4_BL_L3_SD_AAC"; } 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"; + contentFeatures = "DLNA.ORG_PN=MPEG_PS_PAL"; } 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"; + contentFeatures = "DLNA.ORG_PN=WMVHIGH_BASE"; } else if (string.Equals(extension, ".asf", StringComparison.OrdinalIgnoreCase)) { - contentFeatures = "DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000"; + // ?? + contentFeatures = "DLNA.ORG_PN=WMVHIGH_BASE"; } else if (string.Equals(extension, ".mkv", StringComparison.OrdinalIgnoreCase)) { - contentFeatures = "DLNA.ORG_OP=01;DLNA.ORG_CI=0"; + // ?? + contentFeatures = ""; } if (!string.IsNullOrEmpty(contentFeatures)) { - responseHeaders["ContentFeatures.DLNA.ORG"] = contentFeatures; + responseHeaders["ContentFeatures.DLNA.ORG"] = (contentFeatures + org_op + org_ci + dlnaflags).Trim(';'); } } @@ -176,16 +187,20 @@ namespace MediaBrowser.Api.Playback.Progressive var responseHeaders = new Dictionary(); - AddDlnaHeaders(state, responseHeaders); + var outputPath = GetOutputFilePath(state); + var outputPathExists = File.Exists(outputPath); + + var isStatic = request.Static || + (outputPathExists && !ApiEntryPoint.Instance.HasActiveTranscodingJob(outputPath, TranscodingJobType.Progressive)); + + AddDlnaHeaders(state, responseHeaders, isStatic); if (request.Static) { return ResultFactory.GetStaticFileResult(RequestContext, state.Item.Path, responseHeaders, isHeadRequest); } - var outputPath = GetOutputFilePath(state); - - if (File.Exists(outputPath) && !ApiEntryPoint.Instance.HasActiveTranscodingJob(outputPath, TranscodingJobType.Progressive)) + if (outputPathExists && !ApiEntryPoint.Instance.HasActiveTranscodingJob(outputPath, TranscodingJobType.Progressive)) { return ResultFactory.GetStaticFileResult(RequestContext, outputPath, responseHeaders, isHeadRequest); } diff --git a/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs index a465adeb6..06af1c8cc 100644 --- a/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs +++ b/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs @@ -195,6 +195,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo Codec = streamInfo.codec_name, Language = GetDictionaryValue(streamInfo.tags, "language"), Profile = streamInfo.profile, + Level = streamInfo.level, Index = streamInfo.index }; diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index fe008aa0c..a17956c4d 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -133,6 +133,13 @@ namespace MediaBrowser.Model.Entities /// The filename. [ProtoMember(18)] public string Path { get; set; } + + /// + /// Gets or sets the level. + /// + /// The level. + [ProtoMember(19)] + public double Level { get; set; } } /// diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index 15ccbfb3e..3aab9c1c8 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -454,6 +454,7 @@ namespace MediaBrowser.WebDashboard.Api { "extensions.js", "site.js", + "librarybrowser.js", "aboutpage.js", "addpluginpage.js", "advancedconfigurationpage.js", @@ -467,7 +468,6 @@ namespace MediaBrowser.WebDashboard.Api "itembynamedetailpage.js", "itemdetailpage.js", "itemlistpage.js", - "librarybrowser.js", "loginpage.js", "logpage.js", "medialibrarypage.js",