-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvm_output.cpp
47 lines (40 loc) · 1.77 KB
/
vm_output.cpp
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
#include "vm_output.h"
#include "vm_log.h"
#include "vm_option_cv.h"
#include "vm_option_ff.h"
#include "vm_match_cv.h"
#include "vm_match_ff.h"
#include <fstream>
namespace vm_output
{
void vm_output(codec_type codec){
if(codec == codec_type::ffmpeg){
if(vm_option_ff::output_type == vm_option_ff::output_type_enum::framenum)
for(fnum i = 0; i < vm_option_ff::frame_count_1; ++i)
vm_log::output(std::format(R"({0}->{1})", i, vm_match_ff::match_frame_list[i]==-1 ? static_cast<int64_t>(-1) : static_cast<int64_t>(vm_match_ff::match_frame_list[i])));
if(!vm_option_ff::log_path.empty()){
std::ofstream log_file(vm_option_ff::log_path, std::ios::out);
if(log_file.is_open()){
for(fnum i = 0; i < vm_option_ff::frame_count_1; ++i)
log_file << i << "->" << (vm_match_ff::match_frame_list[i]==-1 ? static_cast<int64_t>(-1) : static_cast<int64_t>(vm_match_ff::match_frame_list[i])) << '\n';
log_file.close();
}
else vm_log::error("unable to open log file");
}
}
else if(codec == codec_type::opencv){
if(vm_option_cv::output_type == vm_option_cv::output_type_enum::framenum)
for(fnum i = 0; i < vm_option_cv::frame_count_1; ++i)
vm_log::output(std::format(R"({0}->{1})", i, vm_match_cv::match_frame_list[i]==-1 ? static_cast<int64_t>(-1) : static_cast<int64_t>(vm_match_cv::match_frame_list[i])));
if(!vm_option_cv::log_path.empty()){
std::ofstream log_file(vm_option_cv::log_path, std::ios::out);
if(log_file.is_open()){
for(fnum i = 0; i < vm_option_cv::frame_count_1; ++i)
log_file << i << "->" << (vm_match_cv::match_frame_list[i]==-1 ? static_cast<int64_t>(-1) : static_cast<int64_t>(vm_match_cv::match_frame_list[i])) << '\n';
log_file.close();
}
else vm_log::error("unable to open log file");
}
}
}
}