获取视频基本信息 - GetVideoInfo
函数简介
获取视频基本信息(JSON格式)。
接口名称
GetVideoInfo
DLL调用
int64_t GetVideoInfo(int64_t instance, int64_t videoHandle)
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| videoHandle | 长整数型 | 视频句柄 |
示例
int64_t instance = CreateCOLAPlugInterFace();
int64_t videoHandle = OpenVideo(instance, "test.mp4");
int64_t jsonPtr = GetVideoInfo(instance, videoHandle);
if (jsonPtr != 0) {
printf("视频信息: %s\n", (char*)jsonPtr);
// JSON包含:width, height, fps, totalFrames, duration, codecName, fileSize
FreeStringPtr(instance, jsonPtr);
}
CloseVideo(instance, videoHandle);
DestroyCOLAPlugInterFace(instance);
返回值
返回包含视频信息的JSON字符串指针,需调用FreeStringPtr释放;失败返回0。
JSON包含:width, height, fps, totalFrames, duration, codecName, fileSize
注意事项
- 返回的字符串指针必须调用 FreeStringPtr 释放内存
