Browse Source

Register video rotation side data in DB

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
nyanmisaka 1 year ago
parent
commit
5967d26228
1 changed files with 12 additions and 2 deletions
  1. 12 2
      Emby.Server.Implementations/Data/SqliteItemRepository.cs

+ 12 - 2
Emby.Server.Implementations/Data/SqliteItemRepository.cs

@@ -182,7 +182,8 @@ namespace Emby.Server.Implementations.Data
             "ElPresentFlag",
             "ElPresentFlag",
             "BlPresentFlag",
             "BlPresentFlag",
             "DvBlSignalCompatibilityId",
             "DvBlSignalCompatibilityId",
-            "IsHearingImpaired"
+            "IsHearingImpaired",
+            "Rotation"
         };
         };
 
 
         private static readonly string _mediaStreamSaveColumnsInsertQuery =
         private static readonly string _mediaStreamSaveColumnsInsertQuery =
@@ -343,7 +344,7 @@ namespace Emby.Server.Implementations.Data
             base.Initialize();
             base.Initialize();
 
 
             const string CreateMediaStreamsTableCommand
             const string 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, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, IsAvc BIT NULL, Title TEXT NULL, TimeBase TEXT NULL, CodecTimeBase TEXT NULL, ColorPrimaries TEXT NULL, ColorSpace TEXT NULL, ColorTransfer TEXT NULL, DvVersionMajor INT NULL, DvVersionMinor INT NULL, DvProfile INT NULL, DvLevel INT NULL, RpuPresentFlag INT NULL, ElPresentFlag INT NULL, BlPresentFlag INT NULL, DvBlSignalCompatibilityId INT NULL, IsHearingImpaired BIT 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, IsAvc BIT NULL, Title TEXT NULL, TimeBase TEXT NULL, CodecTimeBase TEXT NULL, ColorPrimaries TEXT NULL, ColorSpace TEXT NULL, ColorTransfer TEXT NULL, DvVersionMajor INT NULL, DvVersionMinor INT NULL, DvProfile INT NULL, DvLevel INT NULL, RpuPresentFlag INT NULL, ElPresentFlag INT NULL, BlPresentFlag INT NULL, DvBlSignalCompatibilityId INT NULL, IsHearingImpaired BIT NULL, Rotation INT NULL, PRIMARY KEY (ItemId, StreamIndex))";
 
 
             const string CreateMediaAttachmentsTableCommand
             const string CreateMediaAttachmentsTableCommand
                     = "create table if not exists mediaattachments (ItemId GUID, AttachmentIndex INT, Codec TEXT, CodecTag TEXT NULL, Comment TEXT NULL, Filename TEXT NULL, MIMEType TEXT NULL, PRIMARY KEY (ItemId, AttachmentIndex))";
                     = "create table if not exists mediaattachments (ItemId GUID, AttachmentIndex INT, Codec TEXT, CodecTag TEXT NULL, Comment TEXT NULL, Filename TEXT NULL, MIMEType TEXT NULL, PRIMARY KEY (ItemId, AttachmentIndex))";
@@ -537,6 +538,8 @@ namespace Emby.Server.Implementations.Data
 
 
                 AddColumn(connection, "MediaStreams", "IsHearingImpaired", "BIT", existingColumnNames);
                 AddColumn(connection, "MediaStreams", "IsHearingImpaired", "BIT", existingColumnNames);
 
 
+                AddColumn(connection, "MediaStreams", "Rotation", "INT", existingColumnNames);
+
                 connection.Execute(string.Join(';', postQueries));
                 connection.Execute(string.Join(';', postQueries));
 
 
                 transaction.Commit();
                 transaction.Commit();
@@ -5479,6 +5482,8 @@ AND Type = @InternalPersonType)");
                         statement.TryBind("@DvBlSignalCompatibilityId" + index, stream.DvBlSignalCompatibilityId);
                         statement.TryBind("@DvBlSignalCompatibilityId" + index, stream.DvBlSignalCompatibilityId);
 
 
                         statement.TryBind("@IsHearingImpaired" + index, stream.IsHearingImpaired);
                         statement.TryBind("@IsHearingImpaired" + index, stream.IsHearingImpaired);
+
+                        statement.TryBind("@Rotation" + index, stream.Rotation);
                     }
                     }
 
 
                     statement.ExecuteNonQuery();
                     statement.ExecuteNonQuery();
@@ -5690,6 +5695,11 @@ AND Type = @InternalPersonType)");
 
 
             item.IsHearingImpaired = reader.TryGetBoolean(43, out var result) && result;
             item.IsHearingImpaired = reader.TryGetBoolean(43, out var result) && result;
 
 
+            if (reader.TryGetInt32(44, out var rotation))
+            {
+                item.Rotation = rotation;
+            }
+
             if (item.Type == MediaStreamType.Subtitle)
             if (item.Type == MediaStreamType.Subtitle)
             {
             {
                 item.LocalizedUndefined = _localization.GetLocalizedString("Undefined");
                 item.LocalizedUndefined = _localization.GetLocalizedString("Undefined");