1 /*
2  * Copyright (C) Jan Panteltje 2003
3  *
4  * This file is part of transcode, a video stream processing tool
5  *
6  * Transcode is copyright Thomas Oestreich
7  *
8  * transcode is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
20  */
21 
22 #ifndef _SUBTITLER_H_
23 #define _SUBTITLER_H_
24 
25 #define MOD_NAME    "filter_subtitler.so"
26 #define MOD_VERSION "v0.8.1 (2003/10/25)"
27 #define MOD_CAP     "subtitle filter"
28 #define MOD_AUTHOR  "Jan Panteltje"
29 
30 #include "transcode.h"
31 #include "filter.h"
32 #include "libtc/libtc.h"
33 #include "libtc/optstr.h"
34 
35 #include <pwd.h>
36 #include <ctype.h>
37 #include <math.h>
38 #include <limits.h>
39 
40 #include "load_font.h"
41 #include "frame_list.h"
42 #include "object_list.h"
43 
44 
45 /* maximum movie length in frames */
46 #define MAX_FRAMES	300000
47 
48 /* set some limits for this system */
49 #define MAX_H_PIXELS		2048
50 #define MAX_V_PIXELS		2048
51 #define MAX_SCREEN_LINES	200
52 
53 /* temp string sizes */
54 #define READSIZE	65535
55 #define TEMP_SIZE	65535
56 
57 /* for status in frame browser USE 1 2 4 8 */
58 #define NEW_ENTRY		0
59 #define NO_SPACE		1
60 #define TOO_LONG		2
61 #define TXT_HOLD		4
62 
63 /* for object type IDs */
64 #define FORMATTED_TEXT			1
65 #define X_Y_Z_T_TEXT			2
66 #define X_Y_Z_T_PICTURE			3
67 #define X_Y_Z_T_FRAME_COUNTER	4
68 #define X_Y_Z_T_MOVIE			5
69 #define MAIN_MOVIE				6
70 #define SUBTITLE_CONTROL		7
71 
72 /* for formatting subtitles */
73 #define SUBTITLE_H_FACTOR	.02
74 #define SUBTITLE_V_FACTOR	.042
75 
76 /* for this specfic default font */
77 #define EXTRA_CHAR_SPACE	1
78 
79 /*
80 for masking out areas in rotate and shear.
81 These 2 values are related, and I have not figured out the relation yet.
82 YUV_MASK is used to prevent picture areas to be cut out.
83 */
84 #define LUMINANCE_MASK	178
85 #define YUV_MASK		164
86 
87 /* status of operations on an object, use 1, 2, 4, etc. */
88 #define OBJECT_STATUS_NEW			0
89 #define OBJECT_STATUS_INIT			1
90 #define OBJECT_STATUS_GOTO			2
91 #define OBJECT_STATUS_HAVE_X_DEST	4
92 #define OBJECT_STATUS_HAVE_Y_DEST	8
93 #define OBJECT_STATUS_HAVE_Z_DEST	16
94 
95 /* maximum number of movie objects that can be inserted */
96 #define MAX_MOVIES	1024
97 
98 #define SUBTITLER_VERSION "-0.8.4"
99 
100 extern int debug_flag;
101 extern font_desc_t *vo_font;
102 extern font_desc_t *subtitle_current_font_descriptor;
103 extern uint8_t *ImageData;
104 extern int image_width, image_height;
105 // extern int default_font;
106 // extern struct passwd *userinfo;
107 extern char *home_dir;
108 // extern char *user_name;
109 // int sync_mode;
110 // int osd_transp;
111 extern int screen_start[MAX_H_PIXELS];
112 extern char *tptr;
113 // extern int screen_lines;
114 // extern char screen_text[MAX_SCREEN_LINES][MAX_H_PIXELS];
115 // char format_start_str[50];
116 // char format_end_str[50];
117 // int vert_position;
118 // extern int line_height;
119 extern int line_h_start, line_h_end;
120 extern int center_flag;
121 // int wtop, wbottom, hstart, hend;
122 // extern int window_top;
123 extern int window_bottom;
124 // extern char *frame_memory0, *frame_memory1 ;
125 // int file_format;
126 // extern char *subtitle_file;
127 // extern char *default_font_dir;
128 // extern vob_t *vob;
129 // char *selected_data_directory;
130 // char *selected_project;
131 extern int frame_offset;
132 extern double dmax_vector;
133 // extern int use_pre_processing_flag;
134 
135 // extern char *subtitle_font_path;
136 extern char *default_subtitle_font_name;
137 extern int default_subtitle_symbols;
138 extern int default_subtitle_font_size;
139 extern int default_subtitle_iso_extention;
140 extern double default_subtitle_radius;
141 extern double default_subtitle_thickness;
142 
143 /* for x11 stuff */
144 // extern int show_output_flag;
145 // extern int window_open_flag;
146 // extern int window_size;
147 // int buffer_size;
148 // extern unsigned char *ucptrs, *ucptrd;
149 // extern int color_depth;
150 /* end x11 stuff */
151 
152 /* threads for other instances of transcode in insert movie */
153 // extern pthread_t *movie_thread[MAX_MOVIES];
154 // pthread_attr_t *attributes;
155 
156 /* global subtitle parameters */
157 // double ssat, dssat, scol, dscol;
158 // extern double default_font_factor;
159 extern double subtitle_extra_character_space;
160 
161 // int anti_alias_flag;
162 // int subtitle_anti_alias_flag;
163 
164 /* for rotate and shear, the luminance where we cut out the border */
165 extern int border_luminance;
166 extern int default_border_luminance;
167 
168 extern double subtitle_h_factor;
169 extern double subtitle_v_factor;
170 extern double extra_character_space;
171 
172 extern int rgb_palette[16][3]; // rgb
173 extern int rgb_palette_valid_flag;
174 
175 extern int default_subtitle_font_symbols;
176 
177 /* this last, so proto knows about structure definitions etc. */
178 #include "subtitler_proto.h"
179 
180 #endif /* _SUBTITLER_H_ */
181 
182