-
Notifications
You must be signed in to change notification settings - Fork 5
/
danmaku2ass.hpp
49 lines (41 loc) · 1.43 KB
/
danmaku2ass.hpp
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
//
// danmaku2ass.hpp
// bilibili
//
// Created by TYPCN on 2015/6/7.
// Copyright (c) 2016 TYPCN. All rights reserved.
//
#ifndef bilibili_danmaku2ass_h
#define bilibili_danmaku2ass_h
#include <string>
#include <vector>
void danmaku2ass(const char *infile,const char *outfile,int width,int height,const char *font,float fontsize,float alpha,float duration_marquee,float duration_still);
#endif
#ifndef bilibili_danmaku2ass_hpp
#define bilibili_danmaku2ass_hpp
int GetCommentType(std::string headline);
class CommentParser{
private:
std::vector<const char *> blockWords;
std::vector<int> disallowModes;
const char *in;
const char *out;
int width = 1280;
int height = 720;
const char *font = "Heiti";
float fontsize = 20;
float alpha = 0.8;
float duration_marquee = 5;
float duration_still = 5;
bool _convertBilibili();
public:
void SetFile(const char *infile,const char *outfile){ in = infile; out = outfile; };
void SetRes(int w,int h){ width = w; height = h; };
void SetFont(const char *name,float size){ font = name; fontsize = size; };
void SetAlpha(float a){ alpha = a; };
void SetDuration(float scroll,float still){ duration_marquee = scroll; duration_still = still; };
void SetBlockWord(const char *word){ blockWords.push_back(word); };
void AddDisallowMode(int mode){ disallowModes.push_back(mode); }; // 1 scroll 2 top 3 bottom
bool Convert(int type);
};
#endif