diff options
| author | MkvAutoSubset <[email protected]> | 2021-10-17 20:17:58 +0800 |
|---|---|---|
| committer | Kurenai <[email protected]> | 2021-10-17 20:17:58 +0800 |
| commit | c0f88cb080950879bc8af5cf498ac3aa8a8c68fb (patch) | |
| tree | caa193ee7f100a1b22d5fa7fa8dfe1120f7ae757 /c/sdk.py | |
| parent | 70a7c4edba281122c05ef46e9efffe5309ef8448 (diff) | |
Bump to 3.1.3
- 增加C函数导出
- 增加python调用的demo
Diffstat (limited to 'c/sdk.py')
| -rw-r--r-- | c/sdk.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/c/sdk.py b/c/sdk.py new file mode 100644 index 0000000..a48a55e --- /dev/null +++ b/c/sdk.py @@ -0,0 +1,35 @@ +from ctypes import * +from json import * + +libpath="./mkvlib.so" +lib=CDLL(libpath) + +def checkInstance(): + call=lib.CheckInstance + return call() + +def getMKVInfo(file): + call=lib.GetMKVInfo + call.restype=c_char_p + return call(file.encode()) + +def dumpMKV(file,output,subset,dirSafe): + call=lib.DumpMKV + return call(file.encode(),output.encode(),subset,dirSafe) + +def checkSubset(file): + call=lib.CheckSubset + call.restype=c_char_p + return call(file.encode()) + +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): + call=lib.ASSFontSubset + _files=dumps(files) + return call(_files.encode(),fonts.encode(),output.encode(),dirSafe) + |
