Commit 9c8dd613c8e5628a2773d5b87ac0cf049486d1d9

Authored by Wesnydy Ribeiro
1 parent c4935095
Exists in master and in 1 other branch devel

ajustes para rodar o script de renderização

renderer/src/include/renderer.h
@@ -16,11 +16,10 @@ @@ -16,11 +16,10 @@
16 #include <lavidlib/net/UnknownHostException.h> 16 #include <lavidlib/net/UnknownHostException.h>
17 #include <lavidlib/net/SocketException.h> 17 #include <lavidlib/net/SocketException.h>
18 18
  19 +#define PATH_RENDERER "vlibras_user/unityVideo/"
19 #define END_FLAG "FINALIZE" 20 #define END_FLAG "FINALIZE"
20 -// #define HOST "150.165.205.127"  
21 -// #define PORTNO 5555  
22 #define HOST "127.0.0.1" 21 #define HOST "127.0.0.1"
23 -#define PORTNO 12345 22 +#define PORTNO 5555
24 23
25 using namespace lavidlib; 24 using namespace lavidlib;
26 using namespace jthread; 25 using namespace jthread;
@@ -28,13 +27,12 @@ using namespace std; @@ -28,13 +27,12 @@ using namespace std;
28 27
29 class Renderer : public Thread { 28 class Renderer : public Thread {
30 public: 29 public:
31 - Renderer(); 30 + Renderer(char* filename);
32 ~Renderer(); 31 ~Renderer();
33 32
34 bool isSending(); 33 bool isSending();
35 void receiveGlosa(std::string glosa, int64_t pts); 34 void receiveGlosa(std::string glosa, int64_t pts);
36 void addListener(ListenerRenderer* listener); 35 void addListener(ListenerRenderer* listener);
37 -  
38 void finalize(); 36 void finalize();
39 void Run(); 37 void Run();
40 38
@@ -46,12 +44,14 @@ private: @@ -46,12 +44,14 @@ private:
46 int count_task; 44 int count_task;
47 int glosa_processed; 45 int glosa_processed;
48 46
  47 + char* output;
49 string glosa_copy; 48 string glosa_copy;
50 49
51 void notifyListeners(); 50 void notifyListeners();
52 void sendGlosa(); 51 void sendGlosa();
53 void connectToUnity(); 52 void connectToUnity();
54 void waitScreenShots(); 53 void waitScreenShots();
  54 + void serverInitialize();
55 }; 55 };
56 56
57 #endif /* RENDERER_H */ 57 #endif /* RENDERER_H */
renderer/src/renderer.cpp
1 #include "renderer.h" 1 #include "renderer.h"
2 2
3 -Renderer::Renderer() {  
4 - core_socket = new StreamSocket();  
5 - listeners = new list<ListenerRenderer*>();  
6 - running = true; 3 +Renderer::Renderer(char* filename) {
  4 + this->output = filename;
  5 + // serverInitialize();
  6 + running = true;
7 count_task = 0; 7 count_task = 0;
8 glosa_processed = 0; 8 glosa_processed = 0;
  9 + core_socket = new StreamSocket();
  10 + listeners = new list<ListenerRenderer*>();
9 DPRINTF("Done!\n"); 11 DPRINTF("Done!\n");
10 } 12 }
11 13
@@ -16,6 +18,24 @@ Renderer::~Renderer() { @@ -16,6 +18,24 @@ Renderer::~Renderer() {
16 DDDPRINTF("Renderer finalized!\n"); 18 DDDPRINTF("Renderer finalized!\n");
17 } 19 }
18 20
  21 +void Renderer::serverInitialize(){
  22 + string render = "./render.sh ";
  23 + render.append(output).append(" \"VLIBRAS\"").append(" 1920 1080").append(" 1").append(" 30");
  24 +
  25 + string command = "cd ";
  26 + char* shPath;
  27 + shPath = getenv("RENDERER");
  28 + if(shPath != NULL)
  29 + command.append(shPath);
  30 + else
  31 + command.append(PATH_RENDERER);
  32 +
  33 + command.append(" && ").append(render);
  34 + cout << command << endl;
  35 + system(command.c_str());
  36 + // sleep(1);
  37 +}
  38 +
19 void Renderer::addListener(ListenerRenderer* listener) { 39 void Renderer::addListener(ListenerRenderer* listener) {
20 listeners->push_back(listener); 40 listeners->push_back(listener);
21 } 41 }
servico/src/serviceWindowGenerationFromRec.cpp
@@ -15,7 +15,7 @@ ServiceWindowGenerationFromRec::ServiceWindowGenerationFromRec( @@ -15,7 +15,7 @@ ServiceWindowGenerationFromRec::ServiceWindowGenerationFromRec(
15 vetor_pts = new vector<int64_t >(); 15 vetor_pts = new vector<int64_t >();
16 rec = new Recognize(pathVideo, id, rate); 16 rec = new Recognize(pathVideo, id, rate);
17 tradutor = new TradutorPortGlosa(); 17 tradutor = new TradutorPortGlosa();
18 - renderer = new Renderer(); 18 + renderer = new Renderer(this->user_id);
19 running = true; 19 running = true;
20 finish = false; 20 finish = false;
21 DPRINTF("Done!\n"); 21 DPRINTF("Done!\n");
@@ -37,7 +37,7 @@ ServiceWindowGenerationFromRec::ServiceWindowGenerationFromRec( @@ -37,7 +37,7 @@ ServiceWindowGenerationFromRec::ServiceWindowGenerationFromRec(
37 vetor_pts = new vector<int64_t >(); 37 vetor_pts = new vector<int64_t >();
38 rec = new Recognize(path_input, id); 38 rec = new Recognize(path_input, id);
39 tradutor = new TradutorPortGlosa(); 39 tradutor = new TradutorPortGlosa();
40 - renderer = new Renderer(); 40 + renderer = new Renderer(this->user_id);
41 try{ 41 try{
42 setPathContents(); 42 setPathContents();
43 }catch(RuntimeException ex){ 43 }catch(RuntimeException ex){
servico/src/serviceWindowGenerationFromSRT.cpp
@@ -16,7 +16,7 @@ ServiceWindowGenerationFromSRT::ServiceWindowGenerationFromSRT(char* pathVideo, @@ -16,7 +16,7 @@ ServiceWindowGenerationFromSRT::ServiceWindowGenerationFromSRT(char* pathVideo,
16 legendas_enviadas = 0; 16 legendas_enviadas = 0;
17 vetor_pts = new vector<int64_t >(); 17 vetor_pts = new vector<int64_t >();
18 tradutor = new TradutorPortGlosa(); 18 tradutor = new TradutorPortGlosa();
19 - renderer = new Renderer(); 19 + renderer = new Renderer(this->user_id);
20 extrator_factory = new ExtratorFactory(); 20 extrator_factory = new ExtratorFactory();
21 try{ 21 try{
22 setPathContents(); 22 setPathContents();
@@ -39,7 +39,7 @@ ServiceWindowGenerationFromSRT::ServiceWindowGenerationFromSRT(char* pathSRT, in @@ -39,7 +39,7 @@ ServiceWindowGenerationFromSRT::ServiceWindowGenerationFromSRT(char* pathSRT, in
39 legendas_enviadas = 0; 39 legendas_enviadas = 0;
40 vetor_pts = new vector<int64_t >(); 40 vetor_pts = new vector<int64_t >();
41 tradutor = new TradutorPortGlosa(); 41 tradutor = new TradutorPortGlosa();
42 - renderer = new Renderer(); 42 + renderer = new Renderer(this->user_id);
43 extrator_factory = new ExtratorFactory(); 43 extrator_factory = new ExtratorFactory();
44 try{ 44 try{
45 setPathContents(); 45 setPathContents();
servico/src/serviceWindowGenerationFromText.cpp
@@ -11,7 +11,7 @@ ServiceWindowGenerationFromText::ServiceWindowGenerationFromText(char* pathFile, @@ -11,7 +11,7 @@ ServiceWindowGenerationFromText::ServiceWindowGenerationFromText(char* pathFile,
11 legendas_enviadas = 0; 11 legendas_enviadas = 0;
12 vetor_pts = new vector<int64_t >(); 12 vetor_pts = new vector<int64_t >();
13 tradutor = new TradutorPortGlosa(); 13 tradutor = new TradutorPortGlosa();
14 - renderer = new Renderer(); 14 + renderer = new Renderer(this->user_id);
15 extrator_factory = new ExtratorFactory(); 15 extrator_factory = new ExtratorFactory();
16 try{ 16 try{
17 setPathContents(); 17 setPathContents();