extratorSRT.h
1.44 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
68
69
70
71
72
73
74
/*
* File: extratorSRT.h
* Author: leonardo
*
* Created on 17 de Fevereiro de 2012, 17:51
*/
#ifndef EXTRATORSRT_H
#define EXTRATORSRT_H
#include <string.h>
#include <stdlib.h>
#include <fstream>
#include <stdio.h>
#include <list>
#include <lavidlib/io/File.h>
#include <lavidlib/io/FileIO.h>
#include <lavidlib/io/BufferedReader.h>
#include <lavidlib/io/IOException.h>
#include <lavidlib/io/EOFException.h>
#include "jthread.h"
#include "dprintf.h"
#include "logger.h"
#include "subtitle.h"
#include "listenerSRT.h"
#include "extratorSRT_exception.h"
#define SIZE_CSCAPE 1
#define TARGET_TIME "-->"
//#define MAX_LINE 1024
using namespace jthread;
using namespace std;
using namespace sndesc;
class ExtratorSRT: public Thread {
public:
ExtratorSRT();
~ExtratorSRT();
void addListener(ListenerSRT* listener);
void notifyListeners(unsigned char* subtitle, int64_t pts);
void notifyEndExtraction(int sub_size);
bool hasNextSubtitle();
void setFilePath(char* path);
bool isFinished();
void initialize();
void Run();
Subtitle* next();
private:
list<ListenerSRT*> *listeners;
char *filepath;
bool finish;
File *file;
FileIO *file_io;
BufferedReader *bff_reader;
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 */