コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
c53ba71bb5 | ||
|
|
aeeb221a0a | ||
|
|
4cfe9a0ff3 | ||
|
|
78fe1fe0e1 | ||
|
|
7d79561bba | ||
|
|
fb44c7f90d | ||
|
|
9d12098663 |
検索条件に一致するファイルはありません
@@ -13,7 +13,8 @@ internal sealed class VideoCacheDatabase : IVideoCacheDatabase
|
||||
private const int FormatVersion = 1;
|
||||
private const int HeaderSize = 32;
|
||||
private const int HeaderCrcOffset = 16;
|
||||
private const string DbFileName = "zerodiskproxy.vdb";
|
||||
private const string OldDbFileName = "zerodiskproxy.vdb";
|
||||
private const string DbFileName = "proxyforge.vdb";
|
||||
private const string BackupSuffix = ".bak";
|
||||
private const string TempSuffix = ".tmp";
|
||||
|
||||
@@ -33,6 +34,49 @@ internal sealed class VideoCacheDatabase : IVideoCacheDatabase
|
||||
Directory.CreateDirectory(_cacheDirectory);
|
||||
_dbPath = Path.Combine(_cacheDirectory, DbFileName);
|
||||
_backupPath = _dbPath + BackupSuffix;
|
||||
|
||||
var oldDbPath = Path.Combine(_cacheDirectory, OldDbFileName);
|
||||
if (File.Exists(oldDbPath) && !File.Exists(_dbPath))
|
||||
{
|
||||
Debug.WriteLine("[VideoCacheDatabase] Starting robust data migration to ProxyForge format.");
|
||||
try
|
||||
{
|
||||
var migrationTempPath = _dbPath + ".migration.tmp";
|
||||
File.Copy(oldDbPath, migrationTempPath, true);
|
||||
|
||||
var oldBackupPath = oldDbPath + BackupSuffix;
|
||||
var migrationBackupTempPath = _backupPath + ".migration.tmp";
|
||||
var hasBackup = File.Exists(oldBackupPath);
|
||||
if (hasBackup)
|
||||
{
|
||||
File.Copy(oldBackupPath, migrationBackupTempPath, true);
|
||||
}
|
||||
|
||||
File.Move(migrationTempPath, _dbPath, true);
|
||||
if (hasBackup)
|
||||
{
|
||||
File.Move(migrationBackupTempPath, _backupPath, true);
|
||||
}
|
||||
|
||||
File.Delete(oldDbPath);
|
||||
if (hasBackup)
|
||||
{
|
||||
File.Delete(oldBackupPath);
|
||||
}
|
||||
var oldTempPath = oldDbPath + TempSuffix;
|
||||
if (File.Exists(oldTempPath))
|
||||
{
|
||||
File.Delete(oldTempPath);
|
||||
}
|
||||
|
||||
Debug.WriteLine("[VideoCacheDatabase] Migration completed successfully. Legacy files removed.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(string.Concat("[VideoCacheDatabase] Migration failed: ", ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
_diskStore = new VideoCacheDiskStore(_cacheDirectory);
|
||||
|
||||
Span<byte> hashBuf = stackalloc byte[32];
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ProxyForge.Interfaces;
|
||||
|
||||
internal interface IWindowThemeService
|
||||
{
|
||||
void Bind(Window window);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using ProxyForge.Core;
|
||||
using ProxyForge.Detection;
|
||||
using ProxyForge.Interfaces;
|
||||
using ProxyForge.Memory;
|
||||
using ProxyForge.Services;
|
||||
using ProxyForge.Settings;
|
||||
using ProxyForge.Streaming;
|
||||
using ProxyForge.ViewModels;
|
||||
@@ -60,6 +61,7 @@ internal sealed class PluginHost : IDisposable
|
||||
var chunkAllocator = new ChunkAllocator(65536);
|
||||
|
||||
MfSession.AddRef();
|
||||
WindowThemeRegistry.Register(new WindowThemeService());
|
||||
|
||||
IProxyEncoderFactory encoderFactory = new MfProxyEncoderFactory(
|
||||
budget,
|
||||
@@ -124,6 +126,7 @@ internal sealed class PluginHost : IDisposable
|
||||
{
|
||||
var vm = new GenerationPopupViewModel(CacheManager.ActiveGenerations);
|
||||
_popupView = new GenerationPopupView(vm);
|
||||
WindowThemeRegistry.Bind(_popupView);
|
||||
|
||||
var mainWindow = Application.Current?.MainWindow;
|
||||
if (mainWindow is { IsLoaded: true })
|
||||
|
||||
@@ -30,7 +30,7 @@ internal sealed class ProxyForgePlugin : IVideoFileSourcePlugin
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(string.Concat("[ProxyForge] CreateCore failed for ", filePath, ": ", ex.Message));
|
||||
return FallbackLoad(devices, filePath);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ internal sealed class ProxyForgePlugin : IVideoFileSourcePlugin
|
||||
return null;
|
||||
|
||||
if (host.ExportDetector.IsExporting())
|
||||
return WrapFromOther(devices, filePath);
|
||||
return null;
|
||||
|
||||
if (!IsLargeEnough(filePath, settings.MinFileSizeForProxy))
|
||||
return null;
|
||||
@@ -78,7 +78,7 @@ internal sealed class ProxyForgePlugin : IVideoFileSourcePlugin
|
||||
if (!host.CacheManager.ProxyExists(filePath, proxyScale))
|
||||
host.CacheManager.StartProxyGeneration(filePath, proxyScale, settings);
|
||||
|
||||
return WrapFromOther(devices, filePath);
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -147,23 +147,6 @@ internal sealed class ProxyForgePlugin : IVideoFileSourcePlugin
|
||||
return null;
|
||||
}
|
||||
|
||||
private static IVideoFileSource? FallbackLoad(IGraphicsDevicesAndContext devices, string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
var lightSource = CreateLightweightSource(devices, filePath);
|
||||
if (lightSource is not null)
|
||||
return lightSource;
|
||||
|
||||
return WrapFromOther(devices, filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(string.Concat("[ProxyForge] FallbackLoad failed for ", filePath, ": ", ex.Message));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static IVideoFileSource? TryLoadProxy(
|
||||
IGraphicsDevicesAndContext devices, string filePath, float proxyScale, PluginHost host)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>1.0.0</Version>
|
||||
<Version>1.0.2</Version>
|
||||
<Platforms>AnyCPU;x64;x64</Platforms>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using ProxyForge.Interfaces;
|
||||
using System.Windows;
|
||||
|
||||
namespace ProxyForge.Services;
|
||||
|
||||
internal static class WindowThemeRegistry
|
||||
{
|
||||
private static IWindowThemeService _service = NullWindowThemeService.Instance;
|
||||
|
||||
internal static void Register(IWindowThemeService service)
|
||||
=> Interlocked.Exchange(ref _service, service ?? NullWindowThemeService.Instance);
|
||||
|
||||
internal static void Bind(Window window)
|
||||
=> _service.Bind(window);
|
||||
|
||||
private sealed class NullWindowThemeService : IWindowThemeService
|
||||
{
|
||||
internal static readonly NullWindowThemeService Instance = new();
|
||||
private NullWindowThemeService() { }
|
||||
public void Bind(Window window) { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using ProxyForge.Interfaces;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace ProxyForge.Services;
|
||||
|
||||
internal sealed class WindowThemeService : IWindowThemeService
|
||||
{
|
||||
public void Bind(Window window)
|
||||
{
|
||||
if (window is null) return;
|
||||
window.SourceInitialized += (_, _) => ApplyCurrentTheme(window);
|
||||
window.Loaded += (_, _) => ApplyCurrentTheme(window);
|
||||
}
|
||||
|
||||
private static void ApplyCurrentTheme(Window window)
|
||||
{
|
||||
if (!OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000)) return;
|
||||
var hwnd = new WindowInteropHelper(window).Handle;
|
||||
if (hwnd == nint.Zero) return;
|
||||
|
||||
var captionBrush = (window.TryFindResource(SystemColors.ControlBrushKey) as SolidColorBrush) ?? Brushes.White;
|
||||
var textBrush = (window.TryFindResource(SystemColors.WindowTextBrushKey) as SolidColorBrush) ?? Brushes.Black;
|
||||
|
||||
SetDwmColor(hwnd, NativeMethods.DwmwaCaption, captionBrush.Color);
|
||||
SetDwmColor(hwnd, NativeMethods.DwmwaBorder, captionBrush.Color);
|
||||
SetDwmColor(hwnd, NativeMethods.DwmwaText, textBrush.Color);
|
||||
}
|
||||
|
||||
private static void SetDwmColor(nint hwnd, uint attribute, Color color)
|
||||
{
|
||||
uint colorRef = color.R | ((uint)color.G << 8) | ((uint)color.B << 16);
|
||||
NativeMethods.DwmSetWindowAttribute(hwnd, attribute, ref colorRef, sizeof(uint));
|
||||
}
|
||||
|
||||
private static class NativeMethods
|
||||
{
|
||||
internal const uint DwmwaCaption = 35;
|
||||
internal const uint DwmwaBorder = 34;
|
||||
internal const uint DwmwaText = 36;
|
||||
|
||||
[DllImport("dwmapi.dll")]
|
||||
internal static extern int DwmSetWindowAttribute(nint hwnd, uint dwAttribute, ref uint pvAttribute, uint cbAttribute);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ YukkuriMovieMaker4 (YMM4) 上で動作する**動画プロキシ自動生成プ
|
||||
大容量の動画ファイルから低解像度プロキシを自動生成し、編集中のプレビュー負荷を軽減します。
|
||||
プロキシはディスクにキャッシュされ、動画出力(エクスポート)時にはオリジナル解像度に自動で切り替わるため、最終出力の品質に影響を与えません。
|
||||
|
||||

|
||||
|
||||
## 概要
|
||||
|
||||
本プラグインは、YMM4の映像ファイルソースとして動作します。
|
||||
@@ -64,7 +66,7 @@ YukkuriMovieMaker4 (YMM4) 上で動作する**動画プロキシ自動生成プ
|
||||
## インストール方法
|
||||
|
||||
1. [リリースページ](https://github.com/routersys/YMM4-ProxyForge/releases/latest)から最新の `ProxyForge` プラグインファイルをダウンロードしてください。
|
||||
2. YMM4が起動していないことを確認し、ダウンロードしたファイルをYMM4のプラグインフォルダ(`user/plugin/ProxyForge`)に配置します。
|
||||
2. YMM4が起動していないことを確認し、ダウンロードしたファイルを実行(ダブルクリック)してインストールします。
|
||||
3. YMM4を起動すると、自動的にプラグインが読み込まれます。
|
||||
|
||||
## 使い方ガイド
|
||||
@@ -78,7 +80,7 @@ YukkuriMovieMaker4 (YMM4) 上で動作する**動画プロキシ自動生成プ
|
||||
|
||||
### 設定画面
|
||||
|
||||
YMM4の「ファイル」→「設定」→「映像ファイルソース」からProxyForge設定画面を開きます。
|
||||
YMM4の「ファイル」→「設定」からProxyForge設定画面を開きます。
|
||||
|
||||
| セクション | 設定項目 | 説明 |
|
||||
|---|---|---|
|
||||
@@ -116,6 +118,11 @@ YMM4の「ファイル」→「設定」→「映像ファイルソース」か
|
||||
|
||||
ご利用は自己責任でお願いします。
|
||||
|
||||
## 参考
|
||||
|
||||
本プロジェクトは、Dolphin-kun氏の[ProxyVideoSource](https://github.com/Dolphin-kun/ProxyVideoSource)を参考に開発されました。
|
||||
オリジナルのプロジェクトに深く感謝いたします。
|
||||
|
||||
## ライセンス
|
||||
|
||||
[MIT License](LICENSE)
|
||||
サブモジュール
+1
サブモジュール YukkuriMovieMaker.Generator が 9d67caf6e6 で追加されました。
バイナリファイルは表示されません。
|
変更後 幅: | 高さ: | サイズ: 519 KiB |
新しいイシューから参照
ユーザーをブロックする