Repository navigation
Expand file tree
/
Copy pathcomputerMain.cpp
More file actions
76 lines (66 loc) · 2.38 KB
/
Copy pathcomputerMain.cpp
File metadata and controls
76 lines (66 loc) · 2.38 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
// Including Boost
#include <boost/lambda/lambda.hpp>
#include <boost/thread.hpp>
#include <boost/date_time.hpp>
#include <boost/interprocess/containers/vector.hpp>
//Including C++ Libs
#include <iostream>
#include <iterator>
#include <queue>
#include <cstdio>
//Open CV
#include "opencv/cv.h"
#include "opencv/highgui.h"
#include "opencv/cvaux.h"
//Our Libs
#include "paolMat.h"
#include "buffer.h"
#include "module.h"
#include "genericProcess.h"
#include "computerDistribute.h"
#include "computerProcess.h"
void computerPipeline(char* outDir, char* dir, char* first, int start)
{
char out[1024];
char vout[1024];
char Cdir[1024];
char firstSlide[1024];
char Cname[1024];
std::strcpy(out, outDir);
std::strcpy(vout, outDir);
std::strcat(out, "screen/");
std::strcat(vout, "computerVideoFrames/");
std::strcpy(Cdir, dir);
std::strcpy(firstSlide, first);
std::strcat(Cname, "screen");
std::cout<<outDir<<" "<<dir<<" "<<first<<std::endl;
Buffer* readBuffer;
readBuffer = new Buffer;
Buffer* tempWriterBuffer;
tempWriterBuffer = new Buffer;
Buffer* compSlidesProcBuffer;
compSlidesProcBuffer = new Buffer;
Buffer* compMovieWriterBuffer;
compMovieWriterBuffer = new Buffer;
Buffer* compSlidesWriterBuffer;
compSlidesWriterBuffer = new Buffer;
WriteMod compMovieWriter(compMovieWriterBuffer);
Module compTemp(tempWriterBuffer, NULL, 15);
WriteMod compSlidesWriter(compSlidesWriterBuffer);
ComputerProcess compSlidesProc(compSlidesProcBuffer, compSlidesWriterBuffer);
ComputerDistribute compDistribute(readBuffer, compSlidesProcBuffer, compMovieWriterBuffer, tempWriterBuffer);
ReadMod compReader(readBuffer);
boost::thread_group compPipeline;
compPipeline.create_thread(boost::bind(&WriteMod::WriteCompVideo, &compMovieWriter, vout, start));
compPipeline.create_thread(boost::bind(&Module::nullRun, &compTemp));
compPipeline.create_thread(boost::bind(&WriteMod::WriteSlides, &compSlidesWriter, out, Cname, start));
compPipeline.create_thread(boost::bind(&ComputerProcess::run, &compSlidesProc));
compPipeline.create_thread(boost::bind(&ComputerDistribute::run, &compDistribute));
compPipeline.create_thread(boost::bind(&ReadMod::ReadFromPatternComp, &compReader, Cdir, firstSlide));
compPipeline.join_all();
delete readBuffer;
delete tempWriterBuffer;
delete compSlidesProcBuffer;
delete compMovieWriterBuffer;
delete compSlidesWriterBuffer;
}