Commit 83525ccb5ea5841879b6adba71193fd30244681c

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

(VLibras-Box) Serviço de Legendas OK

main.cpp
... ... @@ -95,8 +95,8 @@ int main(int argc, char* argv[]) {
95 95 serviceREC(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8]);
96 96 break;
97 97 case 3:
98   - printf("[INFO] Serviço em manutenção!!!\n");
99   - exit(0);
  98 + //printf("[INFO] Serviço em manutenção!!!\n");
  99 + //exit(0);
100 100 if(argc < 5){
101 101 serviceHelp(3);
102 102 hasInvalid();
... ... @@ -108,8 +108,6 @@ int main(int argc, char* argv[]) {
108 108 serviceText(argv[1], argv[2], argv[3], argv[4], argv[5]);
109 109 break;
110 110 case 4:
111   - printf("[INFO] Serviço em manutenção!!!\n");
112   - exit(0);
113 111 if(argc < 5){
114 112 serviceHelp(4);
115 113 hasInvalid();
... ... @@ -219,7 +217,6 @@ void serviceText(char* service, char* path_text, char* transparency, char* id, c
219 217 }
220 218  
221 219 void serviceOnlySRT(char* service, char* path_file, char* transparency, char* id, char* client_type){
222   -
223 220 ServiceWindowGenerationFromSRT * service_srt;
224 221 service_srt = new ServiceWindowGenerationFromSRT(path_file, (int) atoi(transparency), id, client_type, (int) atoi(service));
225 222 try{
... ...
servico/src/serviceWindowGeneration.cpp
... ... @@ -87,15 +87,17 @@ void ServiceWindowGeneration::setPathLibras() {
87 87 strcpy(final_path, PATH_CONTENTS);
88 88 strcat(final_path, "libras.ts");
89 89 }
90   -
  90 +
91 91 this->path_libras = final_path;
92 92 //DDPRINTF("Path TS File: %s\n", this->path_libras);
93 93 }
94 94  
95 95 void ServiceWindowGeneration::setSizeOfSubtitles(int sub_size) {
96 96 numero_legendas = sub_size;
97   - if (legendas_enviadas >= numero_legendas)
  97 + if (legendas_enviadas >= numero_legendas){
98 98 sincronizador->stop();
  99 + }
  100 +
99 101 }
100 102  
101 103 void ServiceWindowGeneration::adicionaPTS(int64_t pts) {
... ... @@ -150,7 +152,7 @@ void ServiceWindowGeneration::initialize() {
150 152 } else {
151 153 tradutor->addListener(this);
152 154 }
153   -
  155 +
154 156 if(this->transparency == 0) { //pega dicionario com BackGround opaco
155 157 sincronizador = new Synchronizer(BASEDIR, EXTENSAO_DICIONARIO,
156 158 this->path_libras, this->transparency);
... ... @@ -165,13 +167,13 @@ void ServiceWindowGeneration::initialize() {
165 167 uint64_t pcr_base = (uint64_t) 1000; //FIXME: macro
166 168 sincronizador->setPCRBase(pcr_base);
167 169 }
168   -
169 170 sincronizador->addListener(this);
170 171 sincronizador->Start();
171 172 }
172 173  
173 174 /* Método utilizado pelo Tradutor para notificar o texto traduzido. */
174 175 void ServiceWindowGeneration::notifyTranslation(vector<string> * glosas) {
  176 +
175 177 if (serviceType != SERVICE_TYPE_TEXT) {
176 178 for (int i = 0; i < glosas->size(); i++) {
177 179 std::locale loc;
... ... @@ -266,7 +268,6 @@ void ServiceWindowGeneration::createThumbnail(){
266 268 .append(PATH_API).append(getUserId());
267 269 }else{
268 270 try{
269   - cout << "entrei" << endl;
270 271 char* pPath = new char[256];
271 272 pPath = reader->getAttributeValue("STORAGE");
272 273 command.append(pPath).append("/").append(getUserId()).append(".mp4");
... ...
servico/src/serviceWindowGenerationFromSRT.cpp
... ... @@ -5,16 +5,6 @@
5 5 ServiceWindowGenerationFromSRT::ServiceWindowGenerationFromSRT(char* path_video, char* path_srt, int sublanguage,
6 6 int position, int size, int transparency, char* id, char* client_type, int serviceType) {
7 7  
8   - // cout << "video: " << path_video << endl;
9   - // cout << "srt: " << path_srt << endl;
10   - // cout << "language: " << sublanguage << endl;
11   - // cout << "position: " << position << endl;
12   - // cout << "size: " << size << endl;
13   - // cout << "transparency: " << transparency << endl;
14   - // cout << "id: " << id << endl;
15   - // cout << "serviceType: " << serviceType << endl;
16   - //cout << "client_type: " << client_type << endl;
17   -
18 8 extrator_factory = new ExtratorFactory();
19 9 setPathInput(path_video);
20 10 setPathSRT(path_srt);
... ... @@ -30,8 +20,9 @@ ServiceWindowGenerationFromSRT::ServiceWindowGenerationFromSRT(char* path_video,
30 20 }
31 21  
32 22 //Construtor Service 4
33   -ServiceWindowGenerationFromSRT::ServiceWindowGenerationFromSRT(char* path_srt, int transparency, char* id, char* client_type, int _serviceType) {
34   - extrator_factory = new ExtratorFactory();
  23 +ServiceWindowGenerationFromSRT::ServiceWindowGenerationFromSRT(char* path_srt, int transparency, char* id, char* client_type, int serviceType) {
  24 +
  25 + extrator_factory = new ExtratorFactory();
35 26 setPathInput(path_srt);
36 27 setClientType(client_type);
37 28 setTransparency(transparency);
... ...
synchronizer/src/synchronizer.cpp
... ... @@ -480,10 +480,11 @@ void Synchronizer::Run() {
480 480 int bufferSize = 7 * 188;
481 481 char * buff = new char[bufferSize];
482 482  
483   - char * arquivo;
  483 + char * arquivo;
484 484  
485   - while (videos->size() == 0)
  485 + while (videos->size() == 0){
486 486 usleep(50000); //50ms
  487 + }
487 488  
488 489 if(this->transparency == 0)
489 490 arquivo = VIDEO_PADRAO;
... ... @@ -501,7 +502,7 @@ void Synchronizer::Run() {
501 502  
502 503 int videos_processed = 0;
503 504  
504   - int desc_out = -1;
  505 + int desc_out = -1;
505 506  
506 507 while (videos_processed <= count_tasks || service_running) {
507 508 cnt = read(filefd, buff, bufferSize);
... ...
tradutor/src/tradutorPortGlosa.cpp
... ... @@ -72,6 +72,7 @@ namespace Tradutor {
72 72 }
73 73  
74 74 void TradutorPortGlosa::traduz(unsigned char * texto) {
  75 +
75 76 vector<string> * vGlosa = portuguesToGlosaVector((const char *)texto);
76 77 if (vGlosa->size() > 0)
77 78 notifyListeners(vGlosa);
... ... @@ -89,13 +90,10 @@ namespace Tradutor {
89 90 vector<string> * TradutorPortGlosa::portuguesToGlosaVector(const char * input) {
90 91 char * sGlosa;
91 92 vector<string> * vGlosa;
92   -
93 93 // Faz a tradução de portugues para glosa
94 94 sGlosa = pyTradutor->convertStringToGlosa(input);
95   -
96 95 // Cria vetor de string contendo os tokens da glosa já traduzidos
97 96 vGlosa = portuguesToGlosaVectorSplit(sGlosa);
98   -
99 97 return vGlosa;
100 98 }
101 99  
... ...