finish removing cabac

pull/702/head
Luke Pulverenti 9 years ago
parent 2b4dece54a
commit 169554ccc4

@ -21,7 +21,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
AddPixelFormatColumnCommand(); AddPixelFormatColumnCommand();
AddBitDepthCommand(); AddBitDepthCommand();
AddIsAnamorphicColumn(); AddIsAnamorphicColumn();
AddIsCabacColumn();
AddKeyFramesColumn(); AddKeyFramesColumn();
AddRefFramesCommand(); AddRefFramesCommand();
AddCodecTagColumn(); AddCodecTagColumn();
@ -215,37 +214,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
_connection.RunQueries(new[] { builder.ToString() }, _logger); _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() private void AddKeyFramesColumn()
{ {
using (var cmd = _connection.CreateCommand()) using (var cmd = _connection.CreateCommand())

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

Loading…
Cancel
Save