finish removing cabac

This commit is contained in:
Luke Pulverenti 2016-04-18 00:25:12 -04:00
parent 8d230261a3
commit d12bc8596a
2 changed files with 7 additions and 43 deletions

View File

@ -21,7 +21,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
AddPixelFormatColumnCommand();
AddBitDepthCommand();
AddIsAnamorphicColumn();
AddIsCabacColumn();
AddKeyFramesColumn();
AddRefFramesCommand();
AddCodecTagColumn();
@ -215,37 +214,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
_connection.RunQueries(new[] { builder.ToString() }, _logger);
}
private void AddIsCabacColumn()
{
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, "IsCabac", StringComparison.OrdinalIgnoreCase))
{
return;
}
}
}
}
}
var builder = new StringBuilder();
builder.AppendLine("alter table mediastreams");
builder.AppendLine("add column IsCabac BIT NULL");
_connection.RunQueries(new[] { builder.ToString() }, _logger);
}
private void AddKeyFramesColumn()
{
using (var cmd = _connection.CreateCommand())

View File

@ -124,7 +124,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
_connection = await SqliteExtensions.ConnectToDb(dbFile, Logger).ConfigureAwait(false);
var createMediaStreamsTableCommand
= "create table if not exists mediastreams (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, IsAnamorphic BIT NULL, RefFrames INT NULL, IsCabac BIT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))";
= "create table if not exists mediastreams (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, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))";
string[] queries = {
@ -389,7 +389,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
"BitDepth",
"IsAnamorphic",
"RefFrames",
"IsCabac",
"CodecTag",
"Comment",
"NalLengthSize"
@ -2890,7 +2889,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
_saveStreamCommand.GetParameter(index++).Value = stream.BitDepth;
_saveStreamCommand.GetParameter(index++).Value = stream.IsAnamorphic;
_saveStreamCommand.GetParameter(index++).Value = stream.RefFrames;
_saveStreamCommand.GetParameter(index++).Value = null;
_saveStreamCommand.GetParameter(index++).Value = stream.CodecTag;
_saveStreamCommand.GetParameter(index++).Value = stream.Comment;
@ -3043,21 +3041,19 @@ namespace MediaBrowser.Server.Implementations.Persistence
item.RefFrames = reader.GetInt32(24);
}
// cabac no longer used
if (!reader.IsDBNull(25))
{
item.CodecTag = reader.GetString(25);
}
if (!reader.IsDBNull(26))
{
item.CodecTag = reader.GetString(26);
item.Comment = reader.GetString(26);
}
if (!reader.IsDBNull(27))
{
item.Comment = reader.GetString(27);
}
if (!reader.IsDBNull(28))
{
item.NalLengthSize = reader.GetString(28);
item.NalLengthSize = reader.GetString(27);
}
return item;