Commit fc440c2c4a777daf73a79e91c9ff4e1fa50907a5

Authored by Erickson Silva
1 parent 2c424ca5
Exists in master and in 2 other branches api, devel

Correção de bug no transcoder FLV.

main.cpp
... ... @@ -38,15 +38,11 @@ void updateRequestStatus(const char* filename, char* id, char* status);
38 38 string createFileToRespWeb(char* id);
39 39 void updateRequestStatusWeb(const char* filename, char* id, char* status);
40 40  
41   -//função temporária para a logisitica dos videos gerados
42   -void sendFileToPath(char* source, char* dest);
43   -
44 41 string filename;
45 42 bool isFailed;
46 43  
47 44 int main(int argc, char* argv[]) {
48 45  
49   - cout << argc << endl;
50 46 struct timeval tv1, tv2;
51 47 double t1, t2;
52 48  
... ... @@ -269,18 +265,6 @@ void serviceOnlySRT(char* path_file, char* transparency, char* id){
269 265 }
270 266 delete service_srt;
271 267  
272   - string source = "vlibras_user/vlibras-api/videos/";
273   -
274   - string command = "ffmpeg -i ";
275   - command.append(source)
276   - .append(id).append(".ts")
277   - .append(" -vcodec copy -f flv ")
278   - .append(source).append(id).append(".flv")
279   - .append(" && rm ")
280   - .append(source).append(id).append(".ts");
281   -
282   - system(command.c_str());
283   -
284 268 }
285 269  
286 270 void serviceREC2(){
... ... @@ -311,17 +295,6 @@ void serviceREC2(){
311 295 **/
312 296 }
313 297  
314   -void sendFileToPath(char* source, char* dest){
315   - char* command = (char*) malloc(strlen(source) + strlen(dest)+1);
316   - strcpy(command, "cp ");
317   - strcat(command, source);
318   - strcat(command, " ");
319   - strcat(command, dest);
320   - system(command);
321   - free(command);
322   -}
323   -
324   -
325 298 void fail(string msg){
326 299 printf("\n");
327 300 DDDDPRINTF("Ops... Tivemos um problema! :(\n");
... ...
mixer/src/Mixer.cpp
... ... @@ -135,12 +135,13 @@ void Mixer::mixVideos () {
135 135  
136 136 void Mixer::setPathFinal(string path){
137 137 pathFinal = path+"_Libras.flv";
  138 +
138 139 }
139 140  
140   -char* Mixer::getPathFinal(){
141   - char* path = new char[pathFinal.size()+1];
142   - strcpy(path, (char*) pathFinal.c_str());
143   - return path;
  141 +string Mixer::getPathFinal(){
  142 + //char* path = new char[pathFinal.size()+1];
  143 + //strcpy(path, (char*) pathFinal.c_str());
  144 + return pathFinal;
144 145 }
145 146  
146 147 /*Ajusta o FPS do vídeo principal para 45 se preciso...*/
... ...
mixer/src/include/Mixer.h
... ... @@ -67,7 +67,7 @@ public:
67 67 string getNumThreads();
68 68 void initialize(string mainVideo, string slVideo, int, int, int);
69 69 void setPathFinal(string path);
70   - char* getPathFinal();
  70 + string getPathFinal();
71 71  
72 72  
73 73  
... ...
servico/src/include/serviceWindowGeneration.h
... ... @@ -68,7 +68,9 @@ protected:
68 68 void setUserId(char* _userId);
69 69  
70 70 //TEMP
71   - void sendFileToPath();
  71 + void sendFileToPath(string source);
  72 +
  73 + void transcodeVideoToFlv();
72 74  
73 75 public:
74 76  
... ...
servico/src/serviceWindowGeneration.cpp
... ... @@ -47,9 +47,9 @@ void ServiceWindowGeneration::finalizouSincronizacao() {
47 47 if (getRunningOption() != '2' && serviceType != SERVICE_TYPE_TEXT && serviceType != SERVICE_TYPE_SRT_ONLY) {
48 48 mixer = new Mixer();
49 49 mixer->initialize(this->path_input, this->path_libras,this->position,this->size,this->transparency);
50   - setPathLibras(mixer->getPathFinal());
51   - sendFileToPath();
  50 + sendFileToPath(mixer->getPathFinal());
52 51 }
  52 +
53 53 this->running = false;
54 54  
55 55 }
... ... @@ -207,15 +207,26 @@ void ServiceWindowGeneration::codifica(vector&lt;string&gt; * glosas) {
207 207 legendas_enviadas++;
208 208 }
209 209  
210   -void ServiceWindowGeneration::sendFileToPath(){
211   - char* command = (char*) malloc(strlen(getPathLibras()) + strlen(FINAL_DESTINATION_API)+10);
212   - strcpy(command, "cp ");
213   - strcat(command, getPathLibras());
214   - strcat(command, " ");
215   - strcat(command, FINAL_DESTINATION_API);
216   - strcat(command, getUserId());
217   - strcat(command, ".flv");
218   - system(command);
219   - free(command);
  210 +void ServiceWindowGeneration::sendFileToPath(string source){
  211 +
  212 + string command = "cp ";
  213 + command.append(source)
  214 + .append(" ").append(FINAL_DESTINATION_API).append(getUserId()).append(".flv")
  215 + .append(" && rm ").append(path_libras);
  216 + system(command.c_str());
  217 +
  218 +}
  219 +
  220 +void ServiceWindowGeneration::transcodeVideoToFlv(){
  221 +
  222 + string command = "ffmpeg -i ";
  223 + command.append(getPathLibras())
  224 + .append(" -vcodec copy -f flv ")
  225 + .append(FINAL_DESTINATION_API).append(user_id).append(".flv")
  226 + .append(" && rm ")
  227 + .append(getPathLibras());
  228 +
  229 + system(command.c_str());
  230 +
220 231 }
221 232  
... ...
servico/src/serviceWindowGenerationFromSRT.cpp
... ... @@ -157,4 +157,7 @@ void ServiceWindowGenerationFromSRT::Run() {
157 157 usleep(200000); //200ms
158 158 }
159 159 finish_srt = true;
  160 +
  161 + if (serviceType == 5)
  162 + transcodeVideoToFlv();
160 163 }
... ...
servico/src/serviceWindowGenerationFromText.cpp
... ... @@ -68,6 +68,9 @@ void ServiceWindowGenerationFromText::Run() {
68 68 printf("[INFO]: A transcodificação para .webm está ativada!\n");
69 69 transcodeVideoToWebm();
70 70 }
  71 + else
  72 + transcodeVideoToFlv();
  73 +
71 74 alive = false;
72 75 }
73 76  
... ... @@ -81,6 +84,6 @@ void ServiceWindowGenerationFromText::transcodeVideoToWebm() {
81 84 .append(".webm")
82 85 .append(" && rm ")
83 86 .append(getPathLibras());
84   - printf("[INFO]: Transcodification command -> %s\n", command.c_str());
  87 + //printf("[INFO]: Transcodification command -> %s\n", command.c_str());
85 88 system(command.c_str());
86 89 }
87 90 \ No newline at end of file
... ...
tradutor/src/py/Simplificador.py
... ... @@ -33,9 +33,7 @@ class Simplificador(object):
33 33 w = self.auxConvert(self.it.getAtualW())
34 34 t = self.it.getAtualT()
35 35 self.__b = False
36   - if (w.upper() == "E") and (countWords == 0):
37   - self.__ts.append([self.__dicSin[w.upper()],t])
38   - if self.__dicWords.has_key(t) == False and w.upper() != "E" and w.upper() != ".": # verifica se nao eh artigo/preposicao
  36 + if self.__dicWords.has_key(t) == False: # verifica se nao eh artigo/preposicao
39 37 wu = w.upper() # deixa o token maiusculo
40 38 #if t[:2] == "VB":
41 39 if t == "VB-P" or t == "VB-D" or t == "VB-R":
... ...