modified: makefile
[GalaxyCodeBases.git] / tools / Bilibili / danmaku2ass_native / danmaku2ass.hpp
blobb88edb189b7d0573f509ce266a49f52dce3ae5e4
1 //
2 // danmaku2ass.hpp
3 // bilibili
4 //
5 // Created by TYPCN on 2015/6/7.
6 // Copyright (c) 2016 TYPCN. All rights reserved.
7 //
9 #ifndef bilibili_danmaku2ass_h
10 #define bilibili_danmaku2ass_h
12 #include <string>
13 #include <vector>
15 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);
17 #endif
19 #ifndef bilibili_danmaku2ass_hpp
20 #define bilibili_danmaku2ass_hpp
21 int GetCommentType(std::string headline);
23 class CommentParser{
24 private:
25 std::vector<const char *> blockWords;
26 std::vector<int> disallowModes;
27 const char *in;
28 const char *out;
29 int width = 1280;
30 int height = 720;
31 const char *font = "Heiti";
32 float fontsize = 20;
33 float alpha = 0.8;
34 float duration_marquee = 5;
35 float duration_still = 5;
37 bool _convertBilibili();
38 public:
39 void SetFile(const char *infile,const char *outfile){ in = infile; out = outfile; };
40 void SetRes(int w,int h){ width = w; height = h; };
41 void SetFont(const char *name,float size){ font = name; fontsize = size; };
42 void SetAlpha(float a){ alpha = a; };
43 void SetDuration(float scroll,float still){ duration_marquee = scroll; duration_still = still; };
44 void SetBlockWord(const char *word){ blockWords.push_back(word); };
45 void AddDisallowMode(int mode){ disallowModes.push_back(mode); }; // 1 scroll 2 top 3 bottom
46 bool Convert(int type);
49 #endif