diff options
Diffstat (limited to 'mkvlib/c')
| -rw-r--r-- | mkvlib/c/README.md | 8 | ||||
| -rw-r--r-- | mkvlib/c/exports.go | 10 | ||||
| -rw-r--r-- | mkvlib/c/sdk.cs | 8 | ||||
| -rw-r--r-- | mkvlib/c/sdk.py | 5 |
4 files changed, 30 insertions, 1 deletions
diff --git a/mkvlib/c/README.md b/mkvlib/c/README.md index 873a992..dc652f8 100644 --- a/mkvlib/c/README.md +++ b/mkvlib/c/README.md @@ -67,10 +67,16 @@ ### 查询相关 - ```c + char* GetFontInfo(char* p); + //查询一个字体的信息 + //p: 字体文件路径 + //return: json格式的文件信息,如果出错会返回"null". + ``` +- ```c char* GetMKVInfo(char* file); //查询一个mkv文件内封的字幕和字体信息 //file: 文件路径 - //return: json格式的文件信息,如果出错会返回"null". + //return: json格式的字体信息,如果出错会返回"null". ``` - ```c char* CheckSubset(char* file, logCallbac lcb); diff --git a/mkvlib/c/exports.go b/mkvlib/c/exports.go index c728b69..5cb8c0f 100644 --- a/mkvlib/c/exports.go +++ b/mkvlib/c/exports.go @@ -195,6 +195,16 @@ func Check(check, strict bool) { getter.GetProcessorInstance().Check(check, strict) } +//export GetFontInfo +func GetFontInfo(p *C.char) *C.char { + if !checkInstance() { + return cs("") + } + info := getter.GetProcessorInstance().GetFontInfo(gs(p)) + data, _ := json.Marshal(info) + return cs(string(data)) +} + func cs(gs string) *C.char { return C.CString(gs) } diff --git a/mkvlib/c/sdk.cs b/mkvlib/c/sdk.cs index 1958ae1..9b5c165 100644 --- a/mkvlib/c/sdk.cs +++ b/mkvlib/c/sdk.cs @@ -61,6 +61,9 @@ public static class mkvlib [DllImport("mkvlib.so")] static extern bool CopyFontsFromCache(IntPtr subs, IntPtr dist, logCallback lcb); + [DllImport("mkvlib.so")] + static extern IntPtr GetFontInfo(IntPtr p); + #endregion public static bool InitInstance(Action<string> lcb) @@ -154,6 +157,11 @@ public static class mkvlib 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))); diff --git a/mkvlib/c/sdk.py b/mkvlib/c/sdk.py index f9da485..613b115 100644 --- a/mkvlib/c/sdk.py +++ b/mkvlib/c/sdk.py @@ -84,6 +84,11 @@ def cache(ccs): _ccs = dumps(ccs) call(_ccs.encode()) +def getFontInfo(p): + call = lib.GetFontInfo + call.restype = c_char_p + return loads(call(p.encode()).decode()) + def createFontsCache(dir, output, lcb): call = lib.CreateFontsCache |
