diff options
Diffstat (limited to 'mkvtool-gui')
| -rw-r--r-- | mkvtool-gui/MainWindow.axaml | 62 | ||||
| -rw-r--r-- | mkvtool-gui/MainWindow.axaml.cs | 136 | ||||
| -rw-r--r-- | mkvtool-gui/Properties/PublishProfiles/FolderProfile.pubxml | 18 | ||||
| -rw-r--r-- | mkvtool-gui/mkvtool.csproj | 26 | ||||
| -rw-r--r-- | mkvtool-gui/mkvtool.sln | 25 | ||||
| -rw-r--r-- | mkvtool-gui/sdk.cs | 132 |
6 files changed, 343 insertions, 56 deletions
diff --git a/mkvtool-gui/MainWindow.axaml b/mkvtool-gui/MainWindow.axaml index a6d2d94..4023497 100644 --- a/mkvtool-gui/MainWindow.axaml +++ b/mkvtool-gui/MainWindow.axaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="600" - Width="850" + Width="1050" Height="670" x:Class="mkvtool.MainWindow" WindowStartupLocation="CenterScreen" @@ -37,7 +37,7 @@ <StackPanel Orientation="Horizontal" Margin="5"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <StackPanel Orientation="Horizontal"> - <TextBlock Text="Fonts:" /> + <TextBlock Text="Extra fonts folder:" /> <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> <TextBlock Name="sa2" /> @@ -168,7 +168,7 @@ <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <TextBlock Text="Default Subtitle language:" VerticalAlignment="Center" TextAlignment="Center" /> - <TextBox Name="ma4" /> + <TextBox Name="ma4" Text="chi" /> </StackPanel> </StackPanel> <StackPanel Orientation="Horizontal" Margin="5"> @@ -211,7 +211,7 @@ </StackPanel> <StackPanel Orientation="Horizontal" Margin="5"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> - <TextBlock Text="Fonts folder:" /> + <TextBlock Text="Extra fonts folder:" /> <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> <TextBlock Name="ca3" /> @@ -233,7 +233,7 @@ <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <TextBlock Text="Default Subtitle language:" VerticalAlignment="Center" TextAlignment="Center" /> - <TextBox Name="ca5" /> + <TextBox Name="ca5" Text="chi" /> </StackPanel> </StackPanel> <StackPanel Orientation="Horizontal" Margin="5"> @@ -250,6 +250,58 @@ </Controlz:GroupBox> </StackPanel> </TabItem> + <TabItem Header="Cache / Settings"> + <StackPanel> + <StackPanel> + <Controlz:GroupBox Header="Create cache" Margin="10"> + <StackPanel Margin="5" HorizontalAlignment="Center"> + <StackPanel Orientation="Horizontal" Margin="5"> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="Fonts folder:" /> + <ScrollViewer HorizontalScrollBarVisibility="Auto" + VerticalScrollBarVisibility="Auto"> + <TextBlock Name="cca1" /> + </ScrollViewer> + </StackPanel> + </StackPanel> + <Button Content="Select..." Click="CacheSelectBtns_OnClick" /> + </StackPanel> + <Controls:ToggleSwitch Content="Clean old caches" IsChecked="False" Name="cca2" /> + <Button Margin="10" Content="Go" Click="CacheBtn_OnClick" + HorizontalAlignment="Center" /> + </StackPanel> + </Controlz:GroupBox> + </StackPanel> + <StackPanel> + <Controlz:GroupBox Header="Settings" Margin="10"> + <StackPanel Margin="5" HorizontalAlignment="Center"> + <Controls:ToggleSwitch Content="Ass to pgs" IsChecked="False" Name="ssa1" /> + <Controls:ToggleSwitch Content="Ass and pgs coexist" IsChecked="False" Name="ssa2" /> + <Controls:ToggleSwitch Content="Check mode" IsChecked="True" Name="ssa3" /> + <Controls:ToggleSwitch Content="Strict for check mode" IsChecked="True" Name="ssa4" /> + <Controls:ToggleSwitch Content="Not rename subsetted font" IsChecked="False" Name="ssa5" /> + <StackPanel Orientation="Horizontal" Margin="5"> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> + <TextBlock Text="PGS resolution:" VerticalAlignment="Center" + TextAlignment="Center" /> + <TextBox Name="ssa6" Text="1080p" /> + </StackPanel> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="5"> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> + <TextBlock Text="PGS frame rate:" VerticalAlignment="Center" + TextAlignment="Center" /> + <TextBox Name="ssa7" Text="23.976" /> + </StackPanel> + </StackPanel> + <Button Margin="10" Content="Save" Click="SaveBtn_OnClick" + HorizontalAlignment="Center" /> + </StackPanel> + </Controlz:GroupBox> + </StackPanel> + </StackPanel> + </TabItem> </TabControl> <Controls:BusyIndicator Name="busyBox" /> </Grid> diff --git a/mkvtool-gui/MainWindow.axaml.cs b/mkvtool-gui/MainWindow.axaml.cs index 807462e..4a17d4e 100644 --- a/mkvtool-gui/MainWindow.axaml.cs +++ b/mkvtool-gui/MainWindow.axaml.cs @@ -1,4 +1,8 @@ using System; +using System.IO; +using System.Runtime.InteropServices; +using System.Security.Cryptography; +using System.Text; using System.Threading; using System.Threading.Tasks; using Avalonia.Controls; @@ -24,7 +28,7 @@ namespace mkvtool private async void CheckFileBtn_OnClick(object? sender, RoutedEventArgs e) { - string[] files = await ShowSelectFileDialog("MKV file", new string[] {"mkv"}, false); + string[] files = await ShowSelectFileDialog("MKV file", new string[] { "mkv" }, false); if (files != null && files.Length > 0) { SetBusy(true); @@ -69,7 +73,11 @@ namespace mkvtool void lcb(string str) { DoUIThread(() => - this.FindControl<TextBox>("logBox").Text += str + Environment.NewLine); + { + TextBox box = this.FindControl<TextBox>("logBox"); + box.Text += str + Environment.NewLine; + box.CaretIndex = box.Text.Length; + }); } private async void TopLevel_OnOpened(object? sender, EventArgs e) @@ -86,8 +94,13 @@ namespace mkvtool } else { - PrintResult("Init", "Init successfully."); - DoUIThread(() => this.FindControl<Grid>("mainBox").IsEnabled = true); + PrintResult("Init", $"Init mkvlib {mkvlib.Version()} successfully."); + Cache(); + DoUIThread(() => + { + SaveSettings(); + this.FindControl<Grid>("mainBox").IsEnabled = true; + }); } } catch @@ -109,14 +122,14 @@ namespace mkvtool private async void SubsetSelectBtns_OnClick(object? sender, RoutedEventArgs e) { - Button btn = (Button) sender; + Button btn = (Button)sender; string dir; switch (btn.Tag.ToString()) { case "asses": SubsetArg.Asses = null; this.FindControl<TextBlock>("sa1").Text = string.Empty; - string[] files = await ShowSelectFileDialog("ASS file(s)", new[] {"ass"}, true); + string[] files = await ShowSelectFileDialog("ASS file(s)", new[] { "ass" }, true); if (files != null && files.Length > 0) { SubsetArg.Asses = files; @@ -163,8 +176,7 @@ namespace mkvtool private async void DoSubsetBtn_OnClick(object? sender, RoutedEventArgs e) { - if (SubsetArg.Asses != null && SubsetArg.Asses.Length > 0 && !string.IsNullOrEmpty(SubsetArg.Fonts) && - !string.IsNullOrEmpty(SubsetArg.Output)) + if (SubsetArg.Asses != null && SubsetArg.Asses.Length > 0) { SetBusy(true); SubsetArg.DirSafe = this.FindControl<ToggleSwitch>("sa4").IsChecked == true; @@ -203,7 +215,7 @@ namespace mkvtool private async void DumpSelectBtns_OnClick(object? sender, RoutedEventArgs e) { - Button btn = (Button) sender; + Button btn = (Button)sender; string dir; switch (btn.Tag.ToString()) { @@ -212,7 +224,7 @@ namespace mkvtool DumpArg.Dir = false; this.FindControl<TextBlock>("da1").Text = string.Empty; string[] files = await ShowSelectFileDialog("MKV file", - new[] {"mkv"}, + new[] { "mkv" }, false); if (files != null && files.Length > 0) { @@ -291,7 +303,7 @@ namespace mkvtool private async void MakeSelectBtns_OnClick(object? sender, RoutedEventArgs e) { - Button btn = (Button) sender; + Button btn = (Button)sender; string dir; switch (btn.Tag.ToString()) { @@ -354,7 +366,7 @@ namespace mkvtool this.FindControl<TextBlock>("ma1").Text = string.Empty; this.FindControl<TextBlock>("ma2").Text = string.Empty; this.FindControl<TextBlock>("ma3").Text = string.Empty; - this.FindControl<TextBox>("ma4").Text = string.Empty; + this.FindControl<TextBox>("ma4").Text = "chi"; this.FindControl<TextBox>("ma5").Text = string.Empty; }); } @@ -379,7 +391,7 @@ namespace mkvtool private async void CreateSelectBtns_OnClick(object? sender, RoutedEventArgs e) { - Button btn = (Button) sender; + Button btn = (Button)sender; string dir; switch (btn.Tag.ToString()) { @@ -432,8 +444,7 @@ namespace mkvtool private async void DoCreateBtn_OnClick(object? sender, RoutedEventArgs e) { - if (!string.IsNullOrEmpty(CreateArg.vDir) && !string.IsNullOrEmpty(CreateArg.sDir) && - !string.IsNullOrEmpty(CreateArg.fDir) && !string.IsNullOrEmpty(CreateArg.oDir)) + if (!string.IsNullOrEmpty(CreateArg.vDir) && !string.IsNullOrEmpty(CreateArg.sDir) && !string.IsNullOrEmpty(CreateArg.oDir)) { CreateArg.slang = this.FindControl<TextBox>("ca5").Text; CreateArg.stitle = this.FindControl<TextBox>("ca6").Text; @@ -456,7 +467,7 @@ namespace mkvtool this.FindControl<TextBlock>("ca2").Text = string.Empty; this.FindControl<TextBlock>("ca3").Text = string.Empty; this.FindControl<TextBlock>("ca4").Text = string.Empty; - this.FindControl<TextBox>("ca5").Text = string.Empty; + this.FindControl<TextBox>("ca5").Text = "chi"; this.FindControl<TextBox>("ca6").Text = string.Empty; this.FindControl<ToggleSwitch>("ca7").IsChecked = false; }); @@ -478,7 +489,7 @@ namespace mkvtool private async void WorkflowSelectBtns_OnClick(object? sender, RoutedEventArgs e) { - Button btn = (Button) sender; + Button btn = (Button)sender; string dir; switch (btn.Tag.ToString()) { @@ -548,12 +559,103 @@ namespace mkvtool } } + private async void SaveBtn_OnClick(object? sender, RoutedEventArgs e) + { + SaveSettings(); + } + + class CacheArg + { + public static string Dir { get; set; } + public static bool Clean { get; set; } + } + + private async void CacheSelectBtns_OnClick(object? sender, RoutedEventArgs e) + { + WorkflowArg.Dir = string.Empty; + this.FindControl<TextBlock>("wa1").Text = string.Empty; + string dir = await new OpenFolderDialog().ShowAsync(this); + if (!string.IsNullOrEmpty(dir)) + { + CacheArg.Dir = dir; + this.FindControl<TextBlock>("cca1").Text = dir; + } + } + private async void CacheBtn_OnClick(object? sender, RoutedEventArgs e) + { + CacheArg.Clean = this.FindControl<ToggleSwitch>("cca2").IsChecked == true; + if (!string.IsNullOrEmpty(CacheArg.Dir)) + { + SetBusy(true); + new Thread(() => + { + if (CacheArg.Clean) + try + { + Directory.Delete(cache, true); + } + catch { } + string output = $"{MD5Str(CacheArg.Dir)}.cache"; + output = Path.Join(cache, output); + string[] el = mkvlib.CreateFontsCache(CacheArg.Dir, output, lcb); + if (el.Length > 0) + { + lcb("Not cache font list:"); + lcb(" ----- Begin ----- "); + lcb(string.Join(Environment.NewLine, el)); + lcb(" ----- End ----- "); + } + else + PrintResult("Create cache", "Create cache successfully."); + CacheArg.Dir = string.Empty; + CacheArg.Clean = false; + Cache(); + DoUIThread(() => + { + this.FindControl<TextBlock>("cca1").Text = string.Empty; + this.FindControl<ToggleSwitch>("cca2").IsChecked = false; + }); + SetBusy(false); + }).Start(); + } + + } + + string cache = Path.Join(Environment.GetEnvironmentVariable(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "USERPROFILE" : "HOME"), ".mkvtool", "caches"); + void Cache() + { + string[] ccs = Directory.GetFiles(cache, "*.cache"); + mkvlib.Cache(ccs); + } + + void SaveSettings() + { + bool a2p = this.FindControl<ToggleSwitch>("ssa1").IsChecked == true; + bool apc = this.FindControl<ToggleSwitch>("ssa2").IsChecked == true; + bool ck = this.FindControl<ToggleSwitch>("ssa3").IsChecked == true; + bool cks = this.FindControl<ToggleSwitch>("ssa4").IsChecked == true; + bool n = this.FindControl<ToggleSwitch>("ssa5").IsChecked == true; + string pr = this.FindControl<TextBox>("ssa6").Text; + string pf = this.FindControl<TextBox>("ssa7").Text; + mkvlib.A2P(a2p, apc, pr, pf); + mkvlib.Check(ck, cks); + mkvlib.NRename(n); + } + void PrintResult(string str1, string str2) { string str = $"##### {str1} result: \"{str2}\""; lcb(str); } + string MD5Str(string str) + { + MD5 md5 = MD5.Create(); + byte[] byteOld = Encoding.UTF8.GetBytes(str); + byte[] byteNew = md5.ComputeHash(byteOld); + return Convert.ToHexString(byteNew).ToLower(); + } + async void DoUIThread(Action action) { await Dispatcher.UIThread.InvokeAsync(action); diff --git a/mkvtool-gui/Properties/PublishProfiles/FolderProfile.pubxml b/mkvtool-gui/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..15fec38 --- /dev/null +++ b/mkvtool-gui/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +https://go.microsoft.com/fwlink/?LinkID=208121. +--> +<Project> + <PropertyGroup> + <Configuration>Release</Configuration> + <Platform>Any CPU</Platform> + <PublishDir>bin\Release\net6.0\publish\win-x64\</PublishDir> + <PublishProtocol>FileSystem</PublishProtocol> + <TargetFramework>net6.0</TargetFramework> + <RuntimeIdentifier>win-x64</RuntimeIdentifier> + <SelfContained>true</SelfContained> + <PublishSingleFile>true</PublishSingleFile> + <PublishReadyToRun>true</PublishReadyToRun> + <PublishTrimmed>false</PublishTrimmed> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/mkvtool-gui/mkvtool.csproj b/mkvtool-gui/mkvtool.csproj index bf95164..02cc9f8 100644 --- a/mkvtool-gui/mkvtool.csproj +++ b/mkvtool-gui/mkvtool.csproj @@ -1,28 +1,28 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>WinExe</OutputType> - <TargetFramework>net5.0</TargetFramework> + <TargetFramework>net6.0</TargetFramework> <Nullable>enable</Nullable> - <IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows> - <IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX> - <IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux> + <PlatformTarget>AnyCPU</PlatformTarget> </PropertyGroup> - <PropertyGroup Condition="'$(IsWindows)'=='true'"> - <DefineConstants>Windows</DefineConstants> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> + <DefineConstants></DefineConstants> </PropertyGroup> - <PropertyGroup Condition="'$(IsOSX)'=='true'"> - <DefineConstants>OSX</DefineConstants> - </PropertyGroup> - <PropertyGroup Condition="'$(IsLinux)'=='true'"> - <DefineConstants>Linux</DefineConstants> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> + <DefineConstants></DefineConstants> </PropertyGroup> <ItemGroup> <None Remove=".gitignore" /> </ItemGroup> <ItemGroup> - <PackageReference Include="Avalonia" Version="0.10.8" /> - <PackageReference Include="Avalonia.Desktop" Version="0.10.8" /> + <PackageReference Include="Avalonia" Version="0.10.13" /> + <PackageReference Include="Avalonia.Desktop" Version="0.10.13" /> <PackageReference Include="mameolan.Avalonia.Controlz" Version="1.0.0-CI-20211017-144151" /> <PackageReference Include="mameolan.Avalonia.ExtendedToolkit" Version="1.0.0-CI-20211017-144151" /> </ItemGroup> + <ItemGroup> + <None Update="mkvlib.so"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + </ItemGroup> </Project> diff --git a/mkvtool-gui/mkvtool.sln b/mkvtool-gui/mkvtool.sln new file mode 100644 index 0000000..5ef8eb1 --- /dev/null +++ b/mkvtool-gui/mkvtool.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32421.90 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mkvtool", "mkvtool.csproj", "{9827A4AC-DBAE-4334-BE0A-D6C802BDF2EC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9827A4AC-DBAE-4334-BE0A-D6C802BDF2EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9827A4AC-DBAE-4334-BE0A-D6C802BDF2EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9827A4AC-DBAE-4334-BE0A-D6C802BDF2EC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9827A4AC-DBAE-4334-BE0A-D6C802BDF2EC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5A38EB08-B793-493C-847E-7324A3F51DA4} + EndGlobalSection +EndGlobal diff --git a/mkvtool-gui/sdk.cs b/mkvtool-gui/sdk.cs index 2be1922..ba183a5 100644 --- a/mkvtool-gui/sdk.cs +++ b/mkvtool-gui/sdk.cs @@ -4,18 +4,14 @@ using System.Text.Json; public static class mkvlib { -#if OSX - const string so = "mkvlib_osx.so"; -#endif -#if Linux - const string so = "mkvlib_linux.so"; -#endif -#if Windows - const string so = "mkvlib_windows.so"; -#endif + + const string so = "mkvlib.so"; #region imports + [DllImport(so, EntryPoint = "Version")] + static extern IntPtr _Version(); + [DllImport(so)] static extern bool InitInstance(logCallback lcb); @@ -29,8 +25,7 @@ public static class mkvlib static extern IntPtr CheckSubset(IntPtr file, logCallback lcb); [DllImport(so)] - static extern bool CreateMKV(IntPtr file, IntPtr tracks, IntPtr attachments, IntPtr output, IntPtr slang, - IntPtr stitle, bool clean); + static extern bool CreateMKV(IntPtr file, IntPtr tracks, IntPtr attachments, IntPtr output, IntPtr slang, IntPtr stitle, bool clean); [DllImport(so)] static extern bool ASSFontSubset(IntPtr files, IntPtr fonts, IntPtr output, bool dirSafe, logCallback lcb); @@ -42,14 +37,51 @@ public static class mkvlib static extern bool DumpMKVs(IntPtr dir, IntPtr output, bool subset, logCallback lcb); [DllImport(so)] - static extern bool CreateMKVs(IntPtr vDir, IntPtr sDir, IntPtr fDir, IntPtr tDir, IntPtr oDir, IntPtr slang, - IntPtr stitle, bool clean, logCallback lcb); + static extern bool CreateMKVs(IntPtr vDir, IntPtr sDir, IntPtr fDir, IntPtr tDir, IntPtr oDir, IntPtr slang, IntPtr stitle, bool clean, logCallback lcb); [DllImport(so)] static extern bool MakeMKVs(IntPtr dir, IntPtr data, IntPtr output, IntPtr slang, IntPtr stitle, logCallback lcb); + [DllImport(so)] + static extern bool CreateBlankOrBurnVideo(long t, IntPtr s, IntPtr enc, IntPtr ass, IntPtr fontdir, IntPtr output); + + [DllImport(so)] + static extern bool CreateTestVideo(IntPtr asses, IntPtr s, IntPtr fontdir, IntPtr enc, bool burn, logCallback lcb); + + [DllImport(so)] + static extern void A2P(bool a2p, bool apc, IntPtr pr, IntPtr pf); + + [DllImport(so)] + static extern IntPtr GetFontsList(IntPtr files, logCallback lcb); + + [DllImport(so)] + static extern void Cache(IntPtr ccs); + + [DllImport(so, EntryPoint = "MKS")] + static extern void _MKS(bool mks); + + [DllImport(so, EntryPoint = "NRename")] + static extern void _NRename(bool n); + + [DllImport(so, EntryPoint = "Check")] + static extern void _Check(bool check, bool strict); + + [DllImport(so)] + static extern IntPtr CreateFontsCache(IntPtr dir, IntPtr output, logCallback lcb); + + [DllImport(so)] + static extern bool CopyFontsFromCache(IntPtr asses, IntPtr dist, logCallback lcb); + + [DllImport(so)] + static extern IntPtr GetFontInfo(IntPtr p); + #endregion + public static string Version() + { + return css(_Version()); + } + public static bool InitInstance(Action<string> lcb) { return InitInstance(_lcb(lcb)); @@ -75,17 +107,16 @@ public static class mkvlib return result; } - public static bool CreateMKV(string file, string[] tracks, string[] attachments, string output, string slang, - string stitle, bool clean) + public static bool CreateMKV(string file, string[] tracks, string[] attachments, string output, string slang, string stitle, bool clean) { - string _tracks = JsonSerializer.Serialize<string[]>(tracks); - string _attachments = JsonSerializer.Serialize<string[]>(attachments); + string _tracks = JsonSerializer.Serialize(tracks); + string _attachments = JsonSerializer.Serialize(attachments); return CreateMKV(cs(file), cs(_tracks), cs(_attachments), cs(output), cs(slang), cs(stitle), clean); } public static bool ASSFontSubset(string[] files, string fonts, string output, bool dirSafe, Action<string> lcb) { - string _files = JsonSerializer.Serialize<string[]>(files); + string _files = JsonSerializer.Serialize(files); return ASSFontSubset(cs(_files), cs(fonts), cs(output), dirSafe, _lcb(lcb)); } @@ -100,8 +131,7 @@ public static class mkvlib return DumpMKVs(cs(dir), cs(output), subset, _lcb(lcb)); } - public static bool CreateMKVs(string vDir, string sDir, string fDir, string tDir, string oDir, string slang, - string stitle, bool clean, Action<string> lcb) + public static bool CreateMKVs(string vDir, string sDir, string fDir, string tDir, string oDir, string slang, string stitle, bool clean, Action<string> lcb) { return CreateMKVs(cs(vDir), cs(sDir), cs(fDir), cs(tDir), cs(oDir), cs(slang), cs(stitle), clean, _lcb(lcb)); } @@ -111,9 +141,68 @@ public static class mkvlib return MakeMKVs(cs(dir), cs(data), cs(output), cs(slang), cs(stitle), _lcb(lcb)); } + public static bool CreateBlankOrBurnVideo(long t, string s, string enc, string ass, string fontdir, string output) + { + return CreateBlankOrBurnVideo(t, cs(s), cs(enc), cs(ass), cs(fontdir), cs(output)); + } - delegate void logCallback(IntPtr ptr); + public static bool CreateTestVideo(string[] asses, string s, string fontdir, string enc, bool burn, Action<string> lcb) + { + string _asses = JsonSerializer.Serialize(asses); + return CreateTestVideo(cs(_asses), cs(s), cs(fontdir), cs(enc), burn, _lcb(lcb)); + } + + public static void A2P(bool a2p, bool apc, string pr, string pf) + { + A2P(a2p, apc, cs(pr), cs(pf)); + } + + public static string[] GetFontsList(string[] files, Action<string> lcb) + { + string _files = JsonSerializer.Serialize(files); + string result = css(GetFontsList(cs(_files), _lcb(lcb))); + return JsonSerializer.Deserialize<string[]>(result); + } + + public static void Cache(string[] ccs) + { + string _ccs = JsonSerializer.Serialize(ccs); + Cache(cs(_ccs)); + } + + public static void MKS(bool mks) + { + _MKS(mks); + } + + public static void NRename(bool n) + { + _NRename(n); + } + public static void Check(bool check, bool strict) + { + _Check(check, strict); + } + + public static string GetFontInfo(string p) + { + return css(GetFontInfo(cs(p))); + } + + public static string[] CreateFontsCache(string dir, string output, Action<string> lcb) + { + string result = css(CreateFontsCache(cs(dir), cs(output), _lcb(lcb))); + return JsonSerializer.Deserialize<string[]>(result); + } + + public static bool CopyFontsFromCache(string[] asses, string dist, Action<string> lcb) + { + string _files = JsonSerializer.Serialize(asses); + return CopyFontsFromCache(cs(_files), cs(dist), _lcb(lcb)); + } + + delegate void logCallback(IntPtr ptr); static logCallback _lcb(Action<string> lcb) { return (ptr) => @@ -132,4 +221,5 @@ public static class mkvlib { return Marshal.PtrToStringUTF8(ptr); } + }
\ No newline at end of file |
