Commit 5f361ee28b9658b2cb77f0c22cfe2db8507f00df
1 parent
9913eafb
Exists in
master
and in
1 other branch
Remoção do componente MonitorPCR
Showing
13 changed files
with
15 additions
and
115 deletions
Show diff stats
Makefile
... | ... | @@ -10,7 +10,7 @@ LIBS= `pkg-config --cflags jlibcpp` \ |
10 | 10 | `pkg-config --libs jlibcpp` -lpython2.7 -llavid_base -llavid_io |
11 | 11 | |
12 | 12 | INCLUDES=-I /usr/include/python2.7 -I util/src/include -I tradutor/src/include -I extratorSRT/src/include \ |
13 | --I monitorPCR/src/include -I input/src/include -I servico/src/include -I synchronizer/src/include \ | |
13 | +-I input/src/include -I servico/src/include -I synchronizer/src/include \ | |
14 | 14 | -I mixer/src/include -I recognize/src/include -I extratorTXT/src/include |
15 | 15 | #-I libs/jthread/include -I libs/jcommon/include -I libs/jsocket/include -Wall |
16 | 16 | |
... | ... | @@ -20,7 +20,6 @@ logger.o |
20 | 20 | tradutorObjs = \ |
21 | 21 | pyTradutor.o \ |
22 | 22 | tradutorPortGlosa.o \ |
23 | -#ouvinteTradutor.o | |
24 | 23 | |
25 | 24 | extratorSRTObjs = \ |
26 | 25 | extratorSRT.o \ |
... | ... | @@ -31,9 +30,6 @@ extratorTXTObjs = \ |
31 | 30 | extratorTXT.o \ |
32 | 31 | extratorTXT_exception.o |
33 | 32 | |
34 | -monitorPCRObjs = \ | |
35 | -monitor_pcr.o | |
36 | - | |
37 | 33 | inputObjs = \ |
38 | 34 | inputFile.o \ |
39 | 35 | inputException.o \ |
... | ... | @@ -62,11 +58,10 @@ servicoObjsPre = $(addprefix servico/src/,$(servicoObjs) ) |
62 | 58 | synchronizerObjsPre = $(addprefix synchronizer/src/,$(synchronizerObjs) ) |
63 | 59 | mixerObjsPre = $(addprefix mixer/src/,$(mixerObjs) ) |
64 | 60 | extratorSRTObjsPre = $(addprefix extratorSRT/src/,$(extratorSRTObjs) ) |
65 | -monitorPCRObjsPre = $(addprefix monitorPCR/src/,$(monitorPCRObjs) ) | |
66 | 61 | recognizeObjsPre = $(addprefix recognize/src/,$(recognizeObjs) ) |
67 | 62 | extratorTXTObjsPre = $(addprefix extratorTXT/src/,$(extratorTXTObjs) ) |
68 | 63 | |
69 | -OBJECTS=$(utilObjsPre) $(tradutorObjsPre) $(extratorTXTObjsPre) $(inputObjsPre) $(servicoObjsPre) $(synchronizerObjsPre) $(mixerObjsPre) $(extratorSRTObjsPre) $(monitorPCRObjsPre) $(recognizeObjsPre) main.o | |
64 | +OBJECTS=$(utilObjsPre) $(tradutorObjsPre) $(extratorTXTObjsPre) $(inputObjsPre) $(servicoObjsPre) $(synchronizerObjsPre) $(mixerObjsPre) $(extratorSRTObjsPre) $(recognizeObjsPre) main.o | |
70 | 65 | |
71 | 66 | all: user_config libras |
72 | 67 | ... | ... |
extratorSRT/src/extratorSRT.cpp
... | ... | @@ -4,9 +4,7 @@ |
4 | 4 | |
5 | 5 | ExtratorSRT::ExtratorSRT(){ |
6 | 6 | listeners = new list<ListenerSRT*>(); |
7 | - pcr_base = 0; | |
8 | 7 | finish = false; |
9 | - hasPCRBase = false; | |
10 | 8 | seek_pos = 0; |
11 | 9 | hasNextSub = true; |
12 | 10 | DPRINTF("Done!\n"); |
... | ... | @@ -170,13 +168,6 @@ int64_t ExtratorSRT::str_to_time(std::string str_time) { |
170 | 168 | |
171 | 169 | } |
172 | 170 | |
173 | - | |
174 | -void ExtratorSRT::notifyPCRBase(uint64_t pcrbase){ | |
175 | - //DDPRINTF("PCRBase = %ld\n", pcrbase); | |
176 | - this->pcr_base = pcrbase; | |
177 | - this->hasPCRBase = true; | |
178 | -} | |
179 | - | |
180 | 171 | uint64_t ExtratorSRT::calcula_pts(double msec) { |
181 | - return (uint64_t)(pcr_base + ((msec/1000) * 90000.0)); | |
172 | + return (uint64_t)(1000 /*pcr_base*/ + ((msec/1000) * 90000.0)); | |
182 | 173 | } |
183 | 174 | \ No newline at end of file | ... | ... |
extratorSRT/src/include/extratorSRT.h
... | ... | @@ -23,7 +23,6 @@ |
23 | 23 | #include "logger.h" |
24 | 24 | #include "subtitle.h" |
25 | 25 | #include "listenerSRT.h" |
26 | -#include "listenerMonitorPCRBase.h" | |
27 | 26 | #include "extratorSRT_exception.h" |
28 | 27 | |
29 | 28 | #define SIZE_CSCAPE 1 |
... | ... | @@ -34,7 +33,7 @@ using namespace jthread; |
34 | 33 | using namespace std; |
35 | 34 | using namespace sndesc; |
36 | 35 | |
37 | -class ExtratorSRT: public Thread, public ListenerMonitorPCRBase { | |
36 | +class ExtratorSRT: public Thread { | |
38 | 37 | |
39 | 38 | public: |
40 | 39 | |
... | ... | @@ -53,8 +52,6 @@ public: |
53 | 52 | |
54 | 53 | Subtitle* next(); |
55 | 54 | |
56 | - void notifyPCRBase(uint64_t pcrbase); | |
57 | - | |
58 | 55 | private: |
59 | 56 | |
60 | 57 | list<ListenerSRT*> *listeners; |
... | ... | @@ -65,9 +62,7 @@ private: |
65 | 62 | BufferedReader *bff_reader; |
66 | 63 | Subtitle *subtitle; |
67 | 64 | |
68 | - uint64_t pcr_base; | |
69 | 65 | int64_t seek_pos; |
70 | - bool hasPCRBase; | |
71 | 66 | bool hasNextSub; |
72 | 67 | |
73 | 68 | uint64_t calcula_pts(double msec); | ... | ... |
recognize/src/include/recognize.h
... | ... | @@ -14,7 +14,6 @@ |
14 | 14 | #include <lavidlib/io/FileIO.h> |
15 | 15 | #include "dprintf.h" |
16 | 16 | #include "logger.h" |
17 | -#include "listenerMonitorPCRBase.h" | |
18 | 17 | #include "recognizeListener.h" |
19 | 18 | #include "recognizeException.h" |
20 | 19 | |
... | ... | @@ -44,7 +43,7 @@ |
44 | 43 | using namespace jthread; |
45 | 44 | using namespace std; |
46 | 45 | |
47 | -class Recognize: public Thread, public ListenerMonitorPCRBase { | |
46 | +class Recognize: public Thread { | |
48 | 47 | |
49 | 48 | public: |
50 | 49 | |
... | ... | @@ -70,8 +69,6 @@ public: |
70 | 69 | |
71 | 70 | void addListener(RecognizeListener* listener); |
72 | 71 | |
73 | - void notifyPCRBase(uint64_t pcrbase); | |
74 | - | |
75 | 72 | bool isFinished(); |
76 | 73 | |
77 | 74 | void Run(); |
... | ... | @@ -79,8 +76,6 @@ public: |
79 | 76 | |
80 | 77 | private: |
81 | 78 | |
82 | - int64_t pcr_base; | |
83 | - bool hasPCRBase; | |
84 | 79 | char* pathVideo; |
85 | 80 | string id; |
86 | 81 | float confidenceRate; | ... | ... |
recognize/src/recognize.cpp
... | ... | @@ -11,8 +11,6 @@ Recognize::Recognize(char* _pathVideo, char* _id) { |
11 | 11 | ss << _id; |
12 | 12 | ss >> id; |
13 | 13 | confidenceRate=CONFIDENCE_RATE; |
14 | - pcr_base = 0; | |
15 | - hasPCRBase = false; | |
16 | 14 | DPRINTF("Done!\n"); |
17 | 15 | } |
18 | 16 | |
... | ... | @@ -23,8 +21,6 @@ Recognize::Recognize(char* _pathVideo, char* _id, char* rate) { |
23 | 21 | inputType = INPUT_PATTERN; |
24 | 22 | frequency = FREQUENCY_PATTERN; |
25 | 23 | sizeBlocs = BLOCS_PATTERN; |
26 | - pcr_base = 0; | |
27 | - hasPCRBase = false; | |
28 | 24 | stringstream ss; |
29 | 25 | ss << _id; |
30 | 26 | ss >> id; |
... | ... | @@ -42,8 +38,6 @@ Recognize::Recognize(char* _pathVideo, int _inputType, char* _id) { |
42 | 38 | frequency = FREQUENCY_PATTERN; |
43 | 39 | sizeBlocs = BLOCS_PATTERN; |
44 | 40 | id = _id; |
45 | - pcr_base = 0; | |
46 | - hasPCRBase = false; | |
47 | 41 | DPRINTF("Done!\n"); |
48 | 42 | } |
49 | 43 | |
... | ... | @@ -365,14 +359,8 @@ void Recognize::notifyEndExtraction(int sentences_size) { |
365 | 359 | } |
366 | 360 | } |
367 | 361 | |
368 | -void Recognize::notifyPCRBase(uint64_t pcrbase){ | |
369 | - //DDPRINTF("PCRBase = %ld\n", pcrbase); | |
370 | - this->pcr_base = pcrbase; | |
371 | - this->hasPCRBase = true; | |
372 | -} | |
373 | - | |
374 | 362 | int64_t Recognize::calcula_pts(double msec) { |
375 | - return (int64_t)(pcr_base + ((msec/1000) * 90000.0)); | |
363 | + return (int64_t)(1000 /*pcr_base*/ + ((msec/1000) * 90000.0)); | |
376 | 364 | } |
377 | 365 | |
378 | 366 | int64_t Recognize::convert_pts(string pts){ | ... | ... |
servico/src/include/serviceWindowGeneration.h
... | ... | @@ -14,8 +14,6 @@ |
14 | 14 | #include "inputFile.h" |
15 | 15 | #include "listenerTradutor.h" |
16 | 16 | #include "tradutorPortGlosa.h" |
17 | -#include "monitor_pcr.h" | |
18 | -#include "listenerMonitorPCRBase.h" | |
19 | 17 | //#include "httpstreamer.h" |
20 | 18 | #include "synchronizer.h" |
21 | 19 | #include "listenerSynchronizer.h" |
... | ... | @@ -47,7 +45,6 @@ protected: |
47 | 45 | TradutorPortGlosa * tradutor; |
48 | 46 | //HttpStreamer *sincronizador; |
49 | 47 | Synchronizer * sincronizador; |
50 | - MonitorPCR * monitor_pcr_base; | |
51 | 48 | InputFile * inputfile; |
52 | 49 | Mixer * mixer; |
53 | 50 | |
... | ... | @@ -83,7 +80,6 @@ public: |
83 | 80 | |
84 | 81 | virtual void notifyTranslation(vector<string>* glosas); |
85 | 82 | virtual void notifyEndOfSynchronization(); |
86 | - //virtual void notifyPCRBase(uint64_t pcr_base); | |
87 | 83 | |
88 | 84 | void initialize(); |
89 | 85 | bool isRunning(); | ... | ... |
servico/src/include/serviceWindowGenerationFromREC.h
servico/src/include/serviceWindowGenerationFromSRT.h
servico/src/serviceWindowGeneration.cpp
... | ... | @@ -13,10 +13,8 @@ ServiceWindowGeneration::ServiceWindowGeneration() { |
13 | 13 | |
14 | 14 | ServiceWindowGeneration::~ServiceWindowGeneration() { |
15 | 15 | free(vetor_pts); |
16 | - //free(path_input); | |
17 | 16 | free(path_libras); |
18 | 17 | if (inputfile) delete inputfile; |
19 | - if (monitor_pcr_base) delete monitor_pcr_base; | |
20 | 18 | if (mixer) delete mixer; |
21 | 19 | if (tradutor) delete tradutor; |
22 | 20 | if (sincronizador) delete sincronizador; |
... | ... | @@ -153,21 +151,10 @@ void ServiceWindowGeneration::initialize() { |
153 | 151 | this->path_libras,this->transparency); |
154 | 152 | } |
155 | 153 | } |
156 | - | |
157 | - /* Se for SERVICE_TYPE_REC (Recognized) não é necessário usar o monitor_pcr_base */ | |
158 | - if (serviceType == SERVICE_TYPE_SRT) { | |
159 | - | |
160 | - char* extensao = (char*) tokens[1].c_str(); | |
161 | - this->monitor_pcr_base->extvideo = new char[strlen(extensao)]; | |
162 | - strcpy(this->monitor_pcr_base->extvideo, extensao); | |
163 | - monitor_pcr_base->addListenerPCRBase(sincronizador); | |
164 | - | |
165 | - } else { | |
154 | + | |
155 | + if (serviceType != SERVICE_TYPE_SRT) { | |
166 | 156 | uint64_t pcr_base = (uint64_t) 1000; //FIXME: macro |
167 | - sincronizador->setPCRBase(pcr_base); | |
168 | - if (serviceType == SERVICE_TYPE_SRT_ONLY) { | |
169 | - monitor_pcr_base->addListenerPCRBase(sincronizador); | |
170 | - } | |
157 | + sincronizador->setPCRBase(pcr_base); | |
171 | 158 | } |
172 | 159 | |
173 | 160 | sincronizador->addListener(this); | ... | ... |
servico/src/serviceWindowGenerationFromREC.cpp
... | ... | @@ -57,26 +57,6 @@ void ServiceWindowGenerationFromREC::initialize() { |
57 | 57 | |
58 | 58 | rec->addListener(this); |
59 | 59 | |
60 | - if (serviceType != SERVICE_TYPE_REC_ONLY_AUDIO){ | |
61 | - | |
62 | - inputfile = new InputFile(this->path_input); | |
63 | - monitor_pcr_base = new MonitorPCR(); | |
64 | - | |
65 | - if (strstr(this->path_input, "ts") != NULL) { | |
66 | - char* format_video = new char[3]; | |
67 | - strcpy(format_video, "ts"); | |
68 | - monitor_pcr_base->setFormatVideo(format_video); | |
69 | - } | |
70 | - | |
71 | - monitor_pcr_base->addListenerPCRBase(rec); | |
72 | - inputfile->addListener(monitor_pcr_base); | |
73 | - try{ | |
74 | - inputfile->initialize(); | |
75 | - } catch(InputException ex){ | |
76 | - throw ServiceException(ex.getMessage()); | |
77 | - } | |
78 | - } | |
79 | - | |
80 | 60 | ServiceWindowGeneration::initialize(); |
81 | 61 | |
82 | 62 | try{ | ... | ... |
servico/src/serviceWindowGenerationFromSRT.cpp
... | ... | @@ -63,32 +63,17 @@ void ServiceWindowGenerationFromSRT::initialize() { |
63 | 63 | |
64 | 64 | DDPRINTF("Service SRT Initialize.\n"); |
65 | 65 | |
66 | - if(serviceType == 2){ | |
67 | - /*Este serviço utiliza o arquivo de vídeo (em formato TS) do usuário para | |
68 | - capturar as informações referente ao relógio (PCR) para calcular as | |
69 | - etiquetas de apresentação (PTS) dos sinais em Libras.*/ | |
66 | + //codigo abaixo sera arrumado apos a aplicação do factory pattern | |
70 | 67 | |
71 | - inputfile = new InputFile(this->path_input); | |
68 | + if(serviceType == 2){ | |
69 | + | |
72 | 70 | extratorSRT = new ExtratorSRT(); |
73 | - monitor_pcr_base = new MonitorPCR(); | |
74 | - | |
75 | - /* [Temporário]: como o monitor do PCR não estava encontrando a extensão do | |
76 | - vídeo, este está sendo analisado e infomado no trecho de código a seguir.*/ | |
77 | - if (strstr(path_input, "ts") != NULL) { | |
78 | - char* format_video = new char[3]; | |
79 | - strcpy(format_video, "ts"); | |
80 | - monitor_pcr_base->setFormatVideo(format_video); | |
81 | - } | |
82 | - | |
83 | - monitor_pcr_base->addListenerPCRBase(extratorSRT); | |
84 | - inputfile->addListener(monitor_pcr_base); | |
85 | 71 | extratorSRT->addListener(this); |
86 | 72 | extratorSRT->setFilePath((char*) path_srt); |
87 | 73 | |
88 | 74 | ServiceWindowGeneration::initialize(); |
89 | 75 | |
90 | - try{ | |
91 | - inputfile->initialize(); | |
76 | + try{ | |
92 | 77 | extratorSRT->initialize(); |
93 | 78 | }catch(ExtratorSrtException ex){ |
94 | 79 | throw ServiceException(ex.getMessage()); |
... | ... | @@ -101,15 +86,12 @@ void ServiceWindowGenerationFromSRT::initialize() { |
101 | 86 | /*Este serviço utiliza apenas o arquivo de legendas (SRT) como entrada, |
102 | 87 | portanto, não é preciso monitorar as informações do PCR a partir do |
103 | 88 | objeto InputFile().*/ |
104 | - extratorSRT = new ExtratorSRT(); | |
105 | - monitor_pcr_base = new MonitorPCR(); | |
106 | - monitor_pcr_base->addListenerPCRBase(extratorSRT); | |
89 | + extratorSRT = new ExtratorSRT(); | |
107 | 90 | extratorSRT->addListener(this); |
108 | 91 | extratorSRT->setFilePath((char*) path_input); |
109 | 92 | |
110 | 93 | ServiceWindowGeneration::initialize(); |
111 | 94 | |
112 | - extratorSRT->notifyPCRBase((uint64_t) 1000); | |
113 | 95 | try{ |
114 | 96 | extratorSRT->initialize(); |
115 | 97 | }catch(ExtratorSrtException ex){ | ... | ... |
synchronizer/src/include/synchronizer.h
... | ... | @@ -20,7 +20,6 @@ |
20 | 20 | #include "jmutex.h" |
21 | 21 | #include "jthread.h" |
22 | 22 | #include "listenerSynchronizer.h" |
23 | -#include "listenerMonitorPCRBase.h" | |
24 | 23 | //#include "httpstreamer.h" |
25 | 24 | |
26 | 25 | #define VIDEO_PADRAO "vlibras_user/dicionario_libras/poseneutra.ts" |
... | ... | @@ -37,7 +36,7 @@ |
37 | 36 | using namespace jthread; |
38 | 37 | using namespace std; |
39 | 38 | |
40 | -class Synchronizer : public jthread::Thread, public ListenerMonitorPCRBase { | |
39 | +class Synchronizer : public jthread::Thread { | |
41 | 40 | |
42 | 41 | private: |
43 | 42 | bool hastext; |
... | ... | @@ -77,7 +76,6 @@ public: |
77 | 76 | Synchronizer(/*int64_t pcr_inicial, */char*baseDir, char* extensao, char* path_libras, int transparency); |
78 | 77 | virtual ~Synchronizer(); |
79 | 78 | |
80 | - virtual void notifyPCRBase(uint64_t pcr_base); | |
81 | 79 | void setPCRBase(uint64_t pcr_base); |
82 | 80 | |
83 | 81 | void Run(); | ... | ... |
synchronizer/src/synchronizer.cpp
... | ... | @@ -25,7 +25,6 @@ Synchronizer::Synchronizer(/*int64_t pcr_inicial, */char* baseDir, char* extensa |
25 | 25 | count_tasks = 0; // Usado no teste de Eduardo! |
26 | 26 | service_running = true; |
27 | 27 | |
28 | - this->pcr_inicial = pcr_inicial; | |
29 | 28 | this->pcr_inicial = -1; |
30 | 29 | this->tempo_poseneutra = 120000; |
31 | 30 | |
... | ... | @@ -68,10 +67,6 @@ Synchronizer::~Synchronizer() { |
68 | 67 | |
69 | 68 | } |
70 | 69 | |
71 | -void Synchronizer::notifyPCRBase(uint64_t pcr_base){ | |
72 | - this->pcr_inicial = pcr_base; | |
73 | -} | |
74 | - | |
75 | 70 | string toLower(string strr) { |
76 | 71 | char str[100]; |
77 | 72 | string ret; | ... | ... |