updated dlna profiles

This commit is contained in:
Luke Pulverenti
2014-04-24 01:08:10 -04:00
parent 0ab3a1bf8e
commit a748c660cb
46 changed files with 1146 additions and 287 deletions

View File

@@ -1,11 +1,11 @@
using System.Text;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -40,7 +40,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
// Add PixelFormat column
createTableCommand += "(ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, PRIMARY KEY (ItemId, StreamIndex))";
createTableCommand += "(ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, PRIMARY KEY (ItemId, StreamIndex))";
string[] queries = {
@@ -57,6 +57,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
_connection.RunQueries(queries, _logger);
AddPixelFormatColumnCommand();
AddBitDepthCommand();
PrepareStatements();
@@ -94,6 +95,37 @@ namespace MediaBrowser.Server.Implementations.Persistence
_connection.RunQueries(new[] { builder.ToString() }, _logger);
}
private void AddBitDepthCommand()
{
using (var cmd = _connection.CreateCommand())
{
cmd.CommandText = "PRAGMA table_info(mediastreams)";
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
{
while (reader.Read())
{
if (!reader.IsDBNull(1))
{
var name = reader.GetString(1);
if (string.Equals(name, "BitDepth", StringComparison.OrdinalIgnoreCase))
{
return;
}
}
}
}
}
var builder = new StringBuilder();
builder.AppendLine("alter table mediastreams");
builder.AppendLine("add column BitDepth INT NULL");
_connection.RunQueries(new[] { builder.ToString() }, _logger);
}
private readonly string[] _saveColumns =
{
"ItemId",
@@ -117,7 +149,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
"AverageFrameRate",
"RealFrameRate",
"Level",
"PixelFormat"
"PixelFormat",
"BitDepth"
};
/// <summary>
@@ -281,6 +314,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
item.PixelFormat = reader.GetString(21);
}
if (!reader.IsDBNull(22))
{
item.BitDepth = reader.GetInt32(22);
}
return item;
}
@@ -343,6 +381,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
_saveStreamCommand.GetParameter(19).Value = stream.RealFrameRate;
_saveStreamCommand.GetParameter(20).Value = stream.Level;
_saveStreamCommand.GetParameter(21).Value = stream.PixelFormat;
_saveStreamCommand.GetParameter(22).Value = stream.BitDepth;
_saveStreamCommand.Transaction = transaction;
_saveStreamCommand.ExecuteNonQuery();