diff options
| author | b5f0d6c3 <[email protected]> | 2021-10-21 11:46:20 +0800 |
|---|---|---|
| committer | b5f0d6c3 <[email protected]> | 2021-10-21 11:46:20 +0800 |
| commit | 2ad3253d26bfadb8452c82e515eedc60b308cbe9 (patch) | |
| tree | 960c460babef805e0f3476573f6daa81cbd9e580 /mkvlib/c/exports.go | |
| parent | 3f3a3cdaecbe6f212c1d405e38525752cc3132a4 (diff) | |
update mkvlib:new c-exports and sdk.py
Diffstat (limited to 'mkvlib/c/exports.go')
| -rw-r--r-- | mkvlib/c/exports.go | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/mkvlib/c/exports.go b/mkvlib/c/exports.go index 6a04665..bf277a4 100644 --- a/mkvlib/c/exports.go +++ b/mkvlib/c/exports.go @@ -9,6 +9,10 @@ import ( var getter = mkvlib.GetProcessorGetterInstance() +func checkInstance() bool { + return getter.GetProcessorInstance() != nil +} + func _lcb(lcb C.logCallback) func(string) { return func(str string) { C.makeLogCallback(cs(str), lcb) @@ -20,14 +24,9 @@ func InitInstance(lcb C.logCallback) bool { return getter.InitProcessorInstance(_lcb(lcb)) } -//export CheckInstance -func CheckInstance() bool { - return getter.GetProcessorInstance() != nil -} - //export GetMKVInfo func GetMKVInfo(file *C.char) *C.char { - if !CheckInstance() { + if !checkInstance() { return cs("") } obj := getter.GetProcessorInstance().GetMKVInfo(gs(file)) @@ -37,7 +36,7 @@ func GetMKVInfo(file *C.char) *C.char { //export DumpMKV func DumpMKV(file, output *C.char, subset bool, lcb C.logCallback) bool { - if !CheckInstance() { + if !checkInstance() { return false } return getter.GetProcessorInstance().DumpMKV(gs(file), gs(output), subset, _lcb(lcb)) @@ -50,7 +49,7 @@ type checkSubset_R struct { //export CheckSubset func CheckSubset(file *C.char, lcb C.logCallback) *C.char { - if !CheckInstance() { + if !checkInstance() { return cs("") } a, b := getter.GetProcessorInstance().CheckSubset(gs(file), _lcb(lcb)) @@ -60,7 +59,7 @@ func CheckSubset(file *C.char, lcb C.logCallback) *C.char { //export CreateMKV func CreateMKV(file, tracks, attachments, output, slang, stitle *C.char, clean bool) bool { - if !CheckInstance() { + if !checkInstance() { return false } a := make([]string, 0) @@ -79,7 +78,7 @@ func CreateMKV(file, tracks, attachments, output, slang, stitle *C.char, clean b //export ASSFontSubset func ASSFontSubset(files, fonts, output *C.char, dirSafe bool, lcb C.logCallback) bool { - if !CheckInstance() { + if !checkInstance() { return false } obj := make([]string, 0) @@ -90,6 +89,40 @@ func ASSFontSubset(files, fonts, output *C.char, dirSafe bool, lcb C.logCallback return false } +//export QueryFolder +func QueryFolder(dir *C.char, lcb C.logCallback) *C.char { + if !checkInstance() { + return cs("") + } + list := getter.GetProcessorInstance().QueryFolder(gs(dir), _lcb(lcb)) + data, _ := json.Marshal(list) + return cs(string(data)) +} + +//export DumpMKVs +func DumpMKVs(dir, output *C.char, subset bool, lcb C.logCallback) bool { + if !checkInstance() { + return false + } + return getter.GetProcessorInstance().DumpMKVs(gs(dir), gs(output), subset, _lcb(lcb)) +} + +//export CreateMKVs +func CreateMKVs(vDir, sDir, fDir, tDir, oDir, slang, stitle *C.char, clean bool, lcb C.logCallback) bool { + if !checkInstance() { + return false + } + return getter.GetProcessorInstance().CreateMKVs(gs(vDir), gs(sDir), gs(fDir), gs(tDir), gs(oDir), gs(slang), gs(stitle), clean, _lcb(lcb)) +} + +//export MakeMKVs +func MakeMKVs(dir, data, output, slang, stitle *C.char, lcb C.logCallback) bool { + if !checkInstance() { + return false + } + return getter.GetProcessorInstance().MakeMKVs(gs(dir), gs(data), gs(output), gs(slang), gs(stitle), _lcb(lcb)) +} + func cs(gs string) *C.char { return C.CString(gs) } |
