mvpt.cpp
2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "mvpt.h"
#include "MutliSourceVideoProcess.h"
int mvpt_init(void **handle, mvpt_param param)
{
*handle = new CMutliSourceVideoProcess();
CMutliSourceVideoProcess* tools = (CMutliSourceVideoProcess*)*handle;
return tools->InitAlgorthim(param, param.task_obj_info_callback_func);
}
//int AddTask(void *handle, char* videoFileName)
//{
// CMutliSourceVideoProcess* tools = (CMutliSourceVideoProcess*)handle;
// int res = tools->AddOperator(videoFileName);
// tools->SetChangeTaskFlag(true);
// return res;
//}
int get_task_progress(void *handle, int taskid, double &progress)
{
CMutliSourceVideoProcess* tools = (CMutliSourceVideoProcess*)handle;
return tools->get_task_progress(taskid, progress);
}
int add_task(void *handle, task_param param)
//int add_task(void *handle, const char* video_filename, const char* result_folder_little, const char* result_folder)
//int add_task(void *handle, const char* videoFileName, VIDEO_OBJECT_SNAPSHOT_CALLBACK objCallbackFunc, VIDEO_REALTIME_CALLBACK realTimeCallbackFunc, const char* resultFolderLittle, const char* resultFolder)
{
//for (int i = 0; i < 100; ++i)
//{
// void *frame = NULL;
// cudaError_t cudaStatus = cudaMalloc((void**)&frame, 3 * 2048 * 1080 * sizeof(float));
//}
//printf("finish 1000 cudamalloc ~~~~~~~~~~~~~~~~~~~~~~~\n");
//std::this_thread::sleep_for(std::chrono::milliseconds(1000000));
CMutliSourceVideoProcess* tools = (CMutliSourceVideoProcess*)handle;
int res = tools->AddOperator(param);
//tools->SetChangeTaskFlag(true);
return res;
}
void finish_task(void *handle, int task_id)
{
CMutliSourceVideoProcess* tools = (CMutliSourceVideoProcess*)handle;
std::unique_lock<std::mutex> l(tools->taskMutex);
tools->AddOperator(task_id, 3);
}
void pause_task(void *handle, int task_id)
{
CMutliSourceVideoProcess* tools = (CMutliSourceVideoProcess*)handle;
std::unique_lock<std::mutex> l(tools->taskMutex);
tools->AddOperator(task_id, 1);
}
void restart_task(void *handle, int task_id)
{
CMutliSourceVideoProcess* tools = (CMutliSourceVideoProcess*)handle;
std::unique_lock<std::mutex> l(tools->taskMutex);
tools->AddOperator(task_id, 2);
//tools->SetChangeTaskFlag(true);
}
void rt_view_task(void *handle, int task_id)
{
CMutliSourceVideoProcess* tools = (CMutliSourceVideoProcess*)handle;
tools->ViewTask(task_id);
}
void finish_view_task(void *handle)
{
CMutliSourceVideoProcess* tools = (CMutliSourceVideoProcess*)handle;
tools->FinishViewTask();
}
int get_running_task_number(void *handle)
{
CMutliSourceVideoProcess* tools = (CMutliSourceVideoProcess*)handle;
return tools->GetRuningNb();
}
void mvpt_release(void **handle)
{
if (*handle)
{
CMutliSourceVideoProcess* tools = (CMutliSourceVideoProcess*)*handle;
tools->FinishProcessThread();
delete tools;
tools = NULL;
}
}
const char* get_mvpt_sdk_version()
{
return "sy_multi_vpt_version:1.2.24.210517.gpu.x64.04D30475A03645C98D275C582B1AFD43";
}