extratorVTT.h
1.01 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
#ifndef EXTRATORVTT_H
#define EXTRATORVTT_H
#include <list>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "jthread.h"
#include "extrator.h"
#include "subtitle.h"
#include "listenerSub.h"
#include <iostream>
#define SIGNATURE "WEBVTT"
#define TARGET_TIME "-->"
#define LESS_THAN "<"
#define MORE_THAN ">"
#define SIZE_SCAPE 1
#define TEMP_SRT "/tmp/tempsrt.srt"
using namespace std;
using namespace sndesc;
using namespace jthread;
class ExtratorVTT: public Extrator, public Thread {
public:
ExtratorVTT();
~ExtratorVTT();
void setFilePath(char* path);
void addListener(ListenerSub* listener);
void initialize();
bool isFinished();
void Run();
private:
Subtitle* subtitle;
list<ListenerSub*> *listeners;
int64_t seekPos;
bool hasNextCue;
void notifyEndExtraction(int size);
void notifyListeners(unsigned char* subtitle, uint64_t pts);
Subtitle* nextCue();
void encodingfiletoUTF8();
string formatText(string line);
int64_t str_to_time(string str_time);
};
#endif /* EXTRATORVTT_H */