-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4bb96da
commit 2dd34ca
Showing
9 changed files
with
168 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
CREATE TABLE video_clips | ||
( | ||
id INTEGER, | ||
width INTEGER, | ||
height INTEGER, | ||
frame_rate REAL, | ||
frame_count INTEGER, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
CREATE VIEW video_clip_view AS | ||
SELECT | ||
o.*, | ||
v.width, | ||
v.height, | ||
v.frame_rate, | ||
v.frame_count | ||
FROM object_view o | ||
INNER JOIN video_clips v ON o.id = v.id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using System.Data; | ||
using System.Data.SQLite; | ||
using UnityDataTools.Analyzer.SerializedObjects; | ||
using UnityDataTools.FileSystem.TypeTreeReaders; | ||
|
||
namespace UnityDataTools.Analyzer.SQLite.Handlers; | ||
|
||
public class VideoClipHandler : ISQLiteHandler | ||
{ | ||
SQLiteCommand m_InsertCommand; | ||
|
||
public void Init(SQLiteConnection db) | ||
{ | ||
using var command = new SQLiteCommand(db); | ||
|
||
command.CommandText = Properties.Resources.VideoClip; | ||
command.ExecuteNonQuery(); | ||
|
||
m_InsertCommand = new SQLiteCommand(db); | ||
m_InsertCommand.CommandText = "INSERT INTO video_clips(id, width, height, frame_rate, frame_count) VALUES(@id, @width, @height, @frame_rate, @frame_count)"; | ||
m_InsertCommand.Parameters.Add("@id", DbType.Int64); | ||
m_InsertCommand.Parameters.Add("@width", DbType.UInt32); | ||
m_InsertCommand.Parameters.Add("@height", DbType.UInt32); | ||
m_InsertCommand.Parameters.Add("@frame_rate", DbType.Double); | ||
m_InsertCommand.Parameters.Add("@frame_count", DbType.UInt64); | ||
} | ||
|
||
public void Process(Context ctx, long objectId, RandomAccessReader reader, out string name, out long streamDataSize) | ||
{ | ||
var videoClip = VideoClip.Read(reader); | ||
|
||
m_InsertCommand.Parameters["@id"].Value = objectId; | ||
m_InsertCommand.Parameters["@width"].Value = videoClip.Width; | ||
m_InsertCommand.Parameters["@height"].Value = videoClip.Height; | ||
m_InsertCommand.Parameters["@frame_rate"].Value = videoClip.FrameRate; | ||
m_InsertCommand.Parameters["@frame_count"].Value = videoClip.FrameCount; | ||
|
||
m_InsertCommand.ExecuteNonQuery(); | ||
|
||
streamDataSize = (long)videoClip.StreamDataSize; | ||
name = videoClip.Name; | ||
} | ||
|
||
public void Finalize(SQLiteConnection db) | ||
{ | ||
} | ||
|
||
void IDisposable.Dispose() | ||
{ | ||
m_InsertCommand.Dispose(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using UnityDataTools.FileSystem.TypeTreeReaders; | ||
|
||
namespace UnityDataTools.Analyzer.SerializedObjects; | ||
|
||
public class VideoClip | ||
{ | ||
public string Name { get; init; } | ||
public double FrameRate { get; init; } | ||
public uint Width { get; init; } | ||
public uint Height { get; init; } | ||
public UInt64 FrameCount { get; init; } | ||
public long StreamDataSize { get; init; } | ||
|
||
private VideoClip() {} | ||
|
||
public static VideoClip Read(RandomAccessReader reader) | ||
{ | ||
return new VideoClip() | ||
{ | ||
Name = reader["m_Name"].GetValue<string>(), | ||
FrameRate = reader["m_FrameRate"].GetValue<double>(), | ||
Width = reader["Width"].GetValue<uint>(), | ||
Height = reader["Height"].GetValue<uint>(), | ||
FrameCount = reader["m_FrameCount"].GetValue<UInt64>(), | ||
StreamDataSize = reader["m_ExternalResources"]["m_Size"].GetValue<long>() | ||
}; | ||
} | ||
} |