OSDN Git Service

MacGui: Remove Target Size as a rate control option as it doesn't really work correct...
[handbrake-jp/handbrake-jp-git.git] / libhb / deccc608sub.h
1 /*
2  * From ccextractor, leave this file as intact and close to the original as possible so that 
3  * it is easy to patch in fixes - even though this file contains code that we don't need.
4  *
5  * Note that the SRT sub generation from CC could be useful for mkv subs.
6  */
7 #ifndef __deccc608sub_H__
8 #define __deccc608sub_H__
9
10 #include "common.h"
11
12 struct s_write;
13
14 void handle_end_of_data (struct s_write *wb);
15 void process608 (const unsigned char *data, int length, struct s_write *wb);
16 void get_char_in_latin_1 (unsigned char *buffer, unsigned char c);
17 void get_char_in_unicode (unsigned char *buffer, unsigned char c);
18 int get_char_in_utf_8 (unsigned char *buffer, unsigned char c);
19 unsigned char cctolower (unsigned char c);
20 unsigned char cctoupper (unsigned char c);
21 int general_608_init (struct s_write *wb);
22 void general_608_close (struct s_write *wb);
23
24 #define CC608_SCREEN_WIDTH  32
25
26 enum cc_modes
27 {
28     MODE_POPUP = 0,
29     MODE_ROLLUP_2 = 1,
30     MODE_ROLLUP_3 = 2,
31     MODE_ROLLUP_4 = 3,
32         MODE_TEXT = 4
33 };
34
35 enum color_code
36 {
37     COL_WHITE = 0,
38     COL_GREEN = 1,
39     COL_BLUE = 2,
40     COL_CYAN = 3,
41     COL_RED = 4,
42     COL_YELLOW = 5,
43     COL_MAGENTA = 6,
44         COL_USERDEFINED = 7
45 };
46
47
48 enum font_bits
49 {
50     FONT_REGULAR = 0,
51     FONT_ITALICS = 1,
52     FONT_UNDERLINED = 2,
53     FONT_UNDERLINED_ITALICS = 3
54 };
55
56
57 struct eia608_screen // A CC buffer
58 {
59     unsigned char characters[15][33]; 
60     unsigned char colors[15][33];
61     unsigned char fonts[15][33]; // Extra char at the end for a 0
62     int row_used[15]; // Any data in row?
63     int empty; // Buffer completely empty?      
64 };
65
66 struct eia608
67 {
68     struct eia608_screen buffer1;
69     struct eia608_screen buffer2;  
70     int cursor_row, cursor_column;
71     int visible_buffer;
72     int srt_counter; // Number of subs currently written
73     int screenfuls_counter; // Number of meaningful screenfuls written
74     int64_t current_visible_start_ms; // At what time did the current visible buffer became so?
75     // unsigned current_visible_start_cc; // At what time did the current visible buffer became so?
76     enum cc_modes mode;
77     unsigned char last_c1, last_c2;
78     int channel; // Currently selected channel
79     unsigned char color; // Color we are currently using to write
80     unsigned char font; // Font we are currently using to write
81     int rollup_base_row;
82 };
83
84 struct s_write {
85     struct eia608 *data608;
86     FILE *fh;
87     unsigned char *subline; 
88     int new_sentence;
89     int new_channel;
90     int in_xds_mode;
91     hb_buffer_t *hb_buffer;
92     hb_buffer_t *hb_last_buffer;
93     uint64_t last_pts;
94     unsigned char *enc_buffer; // Generic general purpose buffer
95     unsigned enc_buffer_used;
96     unsigned enc_buffer_capacity;
97 };
98
99 enum command_code
100 {
101     COM_UNKNOWN = 0,
102     COM_ERASEDISPLAYEDMEMORY = 1,
103     COM_RESUMECAPTIONLOADING = 2,
104     COM_ENDOFCAPTION = 3,
105     COM_TABOFFSET1 = 4,
106     COM_TABOFFSET2 = 5,
107     COM_TABOFFSET3 = 6,
108     COM_ROLLUP2 = 7,
109     COM_ROLLUP3 = 8,
110     COM_ROLLUP4 = 9,
111     COM_CARRIAGERETURN = 10,
112     COM_ERASENONDISPLAYEDMEMORY = 11,
113     COM_BACKSPACE = 12,
114         COM_RESUMETEXTDISPLAY = 13
115 };
116
117 enum encoding_type
118 {
119     ENC_UNICODE = 0,
120     ENC_LATIN_1 = 1,
121     ENC_UTF_8 = 2
122 };
123
124 enum output_format
125 {
126     OF_RAW      = 0,
127     OF_SRT      = 1,
128     OF_SAMI = 2,
129     OF_TRANSCRIPT = 3,
130     OF_RCWT = 4
131 };
132
133 #endif