extratorSRT.h
1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* File: extratorSRT.h
* Author: leonardo
*
* Created on 17 de Fevereiro de 2012, 17:51
*/
#ifndef EXTRATORSRT_H
#define EXTRATORSRT_H
#include <list>
#include <string.h>
#include <stdlib.h>
#include <fstream>
#include <stdio.h>
#include "jthread.h"
#include "dprintf.h"
#include "logger.h"
#include "extrator.h"
#include "subtitle.h"
#include "listenerSRT.h"
#include "extratorException.h"
#define SIZE_CSCAPE 1
#define TARGET_TIME "-->"
#define INPUT_SRT "vlibras_user/inputSRT.srt"
//#define MAX_LINE 1024
using namespace jthread;
using namespace std;
using namespace sndesc;
/** Classe que modela ExtratorSRT.
* Instâncias do tipo ExtratorSRT são modelados
* a partir desta classe, esses objetos são
* responsáveis por extrair o conteudo de arquivos
* com a extensão SubRipText(SRT).
*/
class ExtratorSRT: public Extrator, public Thread {
public:
ExtratorSRT();
~ExtratorSRT();
void addListener(ListenerSRT* listener);
void notifyListeners(unsigned char* subtitle, int64_t pts);
void notifyEndExtraction(int size);
void setFilePath(char* path);
void initialize();
bool isFinished();
Subtitle* next();
bool hasNextSubtitle();
void Run();
private:
list<ListenerSRT*> *listeners;
Subtitle *subtitle;
int64_t seek_pos;
bool hasNextSub;
uint64_t calcula_pts(double msec);
int64_t str_to_time(std::string str_time);
};
#endif /* EXTRATORSRT_H */