diff options
Diffstat (limited to 'mkvlib/c')
| -rw-r--r-- | mkvlib/c/sdk.cs | 17 | ||||
| -rw-r--r-- | mkvlib/c/sdk.py | 106 |
2 files changed, 82 insertions, 41 deletions
diff --git a/mkvlib/c/sdk.cs b/mkvlib/c/sdk.cs index 7a4f4c0..18aff8c 100644 --- a/mkvlib/c/sdk.cs +++ b/mkvlib/c/sdk.cs @@ -37,6 +37,12 @@ public static class mkvlib [DllImport("mkvlib.so")] static extern bool MakeMKVs(IntPtr dir, IntPtr data, IntPtr output, IntPtr slang, IntPtr stitle, logCallback lcb); + [DllImport("mkvlib.so")] + static extern bool A2P(bool a2p, bool apc, int pr, int pf); + + [DllImport("mkvlib.so")] + static extern bool GetFontsList(IntPtr dir, logCallback lcb); + #endregion public static bool InitInstance(Action<string> lcb) @@ -98,6 +104,17 @@ public static class mkvlib return MakeMKVs(cs(dir), cs(data), cs(output), cs(slang), cs(stitle), _lcb(lcb)); } + public static void A2P(bool a2p, bool apc, int pr, int pf) + { + A2P(a2p, apc, pr, pf); + } + + public string[] GetFontsList(string dir, Action<string> lcb) + { + string result = css(GetFontsList(cs(dir), _lcb(lcb))); + return JsonSerializer.Deserialize<string[]>(result); + } + delegate void logCallback(IntPtr ptr); static logCallback _lcb(Action<string> lcb) diff --git a/mkvlib/c/sdk.py b/mkvlib/c/sdk.py index f9fe435..4568cb7 100644 --- a/mkvlib/c/sdk.py +++ b/mkvlib/c/sdk.py @@ -1,55 +1,79 @@ from ctypes import * from json import * -libpath="./mkvlib.so" -lib=CDLL(libpath) +libpath = "./mkvlib.so" +lib = CDLL(libpath) + @CFUNCTYPE(None, c_char_p) def _lcb(s): print(s.decode()) + def initInstance(lcb): - call=lib.InitInstance + call = lib.InitInstance return call(lcb) + def getMKVInfo(file): - call=lib.GetMKVInfo - call.restype=c_char_p + call = lib.GetMKVInfo + call.restype = c_char_p return loads(call(file.encode()).decode()) -def dumpMKV(file,output,subset,lcb): - call=lib.DumpMKV - return call(file.encode(),output.encode(),subset,lcb) - -def checkSubset(file,lcb): - call=lib.CheckSubset - call.restype=c_char_p - return loads(call(file.encode(),lcb).decode()) - -def createMKV(file,tracks,attachments,output,slang,stitle,clean): - call=lib.CreateMKV - _tracks=dumps(tracks) - _attachments=dumps(attachments) - return call(file.encode(),_tracks.encode(),_attachments.encode(),output.encode(),slang.encode(),stitle.encode(),clean) - -def assFontSubset(files,fonts,output,dirSafe,lcb): - call=lib.ASSFontSubset - _files=dumps(files) - return call(_files.encode(),fonts.encode(),output.encode(),dirSafe,lcb) - -def queryFolder(dir,lcb): - call=lib.QueryFolder - call.restype=c_char_p - return call(dir.encode(),lcb) - -def dumpMKVs(dir,output,subset,lcb): - call=lib.DumpMKVs - return call(dir.encode(),output.encode(),subset,lcb) - -def createMKVs(vDir,sDir,fDir,tDir,oDir,slang,stitle, clean ,lcb): - call=lib.CreateMKVs - return call(vDir.encode(),sDir.encode(),fDir.encode(),tDir.encode(),oDir.encode(),slang.encode(),stitle.encode(),clean,lcb) - -def makeMKVs(dir,data,output,slang,stitle,lcb): - call=lib.MakeMKVs - return call(dir.encode(),data.encode(),output.encode(),slang.encode(),stitle.encode(),lcb) + +def dumpMKV(file, output, subset, lcb): + call = lib.DumpMKV + return call(file.encode(), output.encode(), subset, lcb) + + +def checkSubset(file, lcb): + call = lib.CheckSubset + call.restype = c_char_p + return loads(call(file.encode(), lcb).decode()) + + +def createMKV(file, tracks, attachments, output, slang, stitle, clean): + call = lib.CreateMKV + _tracks = dumps(tracks) + _attachments = dumps(attachments) + return call(file.encode(), _tracks.encode(), _attachments.encode(), output.encode(), slang.encode(), + stitle.encode(), clean) + + +def assFontSubset(files, fonts, output, dirSafe, lcb): + call = lib.ASSFontSubset + _files = dumps(files) + return call(_files.encode(), fonts.encode(), output.encode(), dirSafe, lcb) + + +def queryFolder(dir, lcb): + call = lib.QueryFolder + call.restype = c_char_p + return call(dir.encode(), lcb) + + +def dumpMKVs(dir, output, subset, lcb): + call = lib.DumpMKVs + return call(dir.encode(), output.encode(), subset, lcb) + + +def createMKVs(vDir, sDir, fDir, tDir, oDir, slang, stitle, clean, lcb): + call = lib.CreateMKVs + return call(vDir.encode(), sDir.encode(), fDir.encode(), tDir.encode(), oDir.encode(), slang.encode(), + stitle.encode(), clean, lcb) + + +def makeMKVs(dir, data, output, slang, stitle, lcb): + call = lib.MakeMKVs + return call(dir.encode(), data.encode(), output.encode(), slang.encode(), stitle.encode(), lcb) + + +def a2p(en, apc, pr, pf): + call = lib.A2P + return call(en, apc, pr, pf) + + +def getFontsList(dir, lcb): + call = lib.GetFontsList + call.restype = c_char_p + return loads(call(dir.encode(), lcb).decode()) |
