快速获取视频文件信息 - GetVideoInfoFromPath
函数简介
快速获取视频文件信息(无需打开整个视频)。
接口名称
GetVideoInfoFromPath
DLL调用
int64_t GetVideoInfoFromPath(int64_t instance, string videoPath)
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| videoPath | 字符串 | 视频文件路径 |
示例
int64_t instance = CreateCOLAPlugInterFace();
int64_t jsonPtr = GetVideoInfoFromPath(instance, "test.mp4");
if (jsonPtr != 0) {
printf("视频信息: %s\n", (char*)jsonPtr);
FreeStringPtr(instance, jsonPtr);
}
DestroyCOLAPlugInterFace(instance);
返回值
返回包含视频信息的JSON字符串指针,需调用FreeStringPtr释放;失败返回0。
注意事项
- 返回的字符串指针必须调用 FreeStringPtr 释放内存
- 此方法无需打开整个视频,速度较快
