Commit 96c7c6e5c22390aab79908e47e6b57acfe107ea5

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

Remoção do componente MonitorPCR(Ajuste)

monitorPCR/src/include/listenerMonitorPCRBase.h
@@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
1 -/*  
2 - * File: listenerMonitorPCRBase.h  
3 - * Author: leonardo  
4 - *  
5 - * Created on 18 de Fevereiro de 2012, 20:46  
6 - */  
7 -  
8 -#ifndef LISTENERMONITORPCRBASE_H  
9 -#define LISTENERMONITORPCRBASE_H  
10 -  
11 -#include <stdint.h>  
12 -  
13 -class ListenerMonitorPCRBase {  
14 -  
15 -public:  
16 - virtual void notifyPCRBase(uint64_t pcrbase) = 0;  
17 -  
18 -};  
19 -  
20 -#endif /* LISTENERMONITORPCRBASE_H */  
21 -  
monitorPCR/src/include/monitor_pcr.h
@@ -1,56 +0,0 @@ @@ -1,56 +0,0 @@
1 -/*  
2 - * File: monitor_pcr.h  
3 - * Author: leonardo  
4 - *  
5 - * Created on 17 de Fevereiro de 2012, 17:36  
6 - */  
7 -  
8 -#ifndef MONITOR_PCR_H  
9 -#define MONITOR_PCR_H  
10 -  
11 -#include <stdio.h>  
12 -#include <string.h>  
13 -#include <locale>  
14 -#include <stdint.h>  
15 -#include <list>  
16 -#include "listenerInput.h"  
17 -#include "listenerMonitorPCRBase.h"  
18 -#include "dprintf.h"  
19 -  
20 -#define PCRBASE_PADRAO 1000000  
21 -  
22 -using namespace std;  
23 -  
24 -class MonitorPCR: public ListenerInput {  
25 -  
26 - public:  
27 -  
28 - char* extvideo;  
29 -  
30 - MonitorPCR();  
31 - ~MonitorPCR();  
32 -  
33 - void addListenerPCRBase(ListenerMonitorPCRBase * listener);  
34 - void notifyListenersWithPCRBase(uint64_t pcrbase);  
35 - uint64_t getPCRBase();  
36 - void notifyInput(unsigned char* packet);  
37 -  
38 - /**  
39 - * Informa para o monitor o formato do vídeo que está sendo manipulado.  
40 - * Caso seja qualquer outro diferente de Transport Stream (TS), os componentes  
41 - * observadores devem receber a notificação de um valor de PCR padrão.  
42 - */  
43 - void setFormatVideo(char* format);  
44 -  
45 - private:  
46 -  
47 - void readPCRBase(unsigned char* packet);  
48 -  
49 - list<ListenerMonitorPCRBase*> *listeners;  
50 - uint64_t pcr_base;  
51 - bool find;  
52 -  
53 -};  
54 -  
55 -#endif /* MONITOR_PCR_H */  
56 -  
monitorPCR/src/monitor_pcr.cpp
@@ -1,71 +0,0 @@ @@ -1,71 +0,0 @@
1 -#include "monitor_pcr.h"  
2 -  
3 -MonitorPCR::MonitorPCR(){  
4 - pcr_base = 0;  
5 - find = false;  
6 - extvideo = (char*) "";  
7 - listeners = new list<ListenerMonitorPCRBase*>();  
8 - DPRINTF("Done!\n");  
9 -}  
10 -  
11 -  
12 -MonitorPCR::~MonitorPCR(){  
13 - DDDPRINTF("Monitor PCR finalized!\n");  
14 -}  
15 -  
16 -  
17 -uint64_t MonitorPCR::getPCRBase(){  
18 - return pcr_base;  
19 -}  
20 -  
21 -  
22 -void MonitorPCR::setFormatVideo(char* format) {  
23 - extvideo = format;  
24 -}  
25 -  
26 -  
27 -void MonitorPCR::notifyInput(unsigned char* packet) {  
28 -  
29 - if (!find) { // verifica se o PCRBase já foi encontrado  
30 - *extvideo = tolower(*extvideo);  
31 - if (strcmp(extvideo, (char*) "ts") == 0) { // se for TS procura nos pacotes  
32 - readPCRBase(packet);  
33 - } else { // outros formatos de vídeo, define o PCR padrão = 1000000  
34 - notifyListenersWithPCRBase((uint64_t) PCRBASE_PADRAO);  
35 - find = true;  
36 - }  
37 - }  
38 -  
39 -}  
40 -  
41 -  
42 -void MonitorPCR::readPCRBase(unsigned char* packet){  
43 -  
44 - if (packet[0] == 0x47 && !find){  
45 - if((((packet[1] & 0x1F) << 8) | packet[2]) != 0xFF) {  
46 - int adaptation_field_control = ((packet[3] & 0x30) >> 4);  
47 - if (adaptation_field_control == 2 || adaptation_field_control == 3) {  
48 - int adaptation_field_length = packet[4];  
49 - if (adaptation_field_length > 0) {  
50 - if (((packet[5] & 0x10) >> 4) == 1) {  
51 - uint64_t program_clock_reference_base = (uint64_t) packet[6] << 25 | packet[7] << 17 | packet[8] << 9  
52 - | packet[9] << 1 | (packet[10] & 0x80) >> 7;  
53 - notifyListenersWithPCRBase(program_clock_reference_base);  
54 - find = true;  
55 - }  
56 - }  
57 - }  
58 - }  
59 - }  
60 -  
61 -}  
62 -  
63 -void MonitorPCR::addListenerPCRBase(ListenerMonitorPCRBase * listener){  
64 - this->listeners->push_back(listener);  
65 -}  
66 -  
67 -void MonitorPCR::notifyListenersWithPCRBase(uint64_t pcrbase){  
68 - for(list<ListenerMonitorPCRBase*>::iterator it = this->listeners->begin(); it != this->listeners->end(); it++){  
69 - (*it)->notifyPCRBase(pcrbase);  
70 - }  
71 -}