record level during media analysis

This commit is contained in:
Luke Pulverenti 2013-04-03 08:03:37 -04:00
parent 9363281fb6
commit 4ba4d8d040
4 changed files with 39 additions and 16 deletions

View File

@ -90,8 +90,9 @@ namespace MediaBrowser.Api.Playback.Progressive
/// </summary>
/// <param name="state">The state.</param>
/// <param name="responseHeaders">The response headers.</param>
/// <param name="isStaticallyStreamed">if set to <c>true</c> [is statically streamed].</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
private void AddDlnaHeaders(StreamState state, IDictionary<string, string> responseHeaders)
private void AddDlnaHeaders(StreamState state, IDictionary<string, string> 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<string, string>();
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);
}

View File

@ -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
};

View File

@ -133,6 +133,13 @@ namespace MediaBrowser.Model.Entities
/// <value>The filename.</value>
[ProtoMember(18)]
public string Path { get; set; }
/// <summary>
/// Gets or sets the level.
/// </summary>
/// <value>The level.</value>
[ProtoMember(19)]
public double Level { get; set; }
}
/// <summary>

View File

@ -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",