1 #ifndef CCX_COMMON_OPTION_H
2 #define CCX_COMMON_OPTION_H
3 
4 #include "ccx_common_timing.h"
5 #include "ccx_decoders_608.h"
6 #include "ccx_encoders_structs.h"
7 #include "list.h"
8 
9 struct demuxer_cfg
10 {
11 	int m2ts; // Regular TS or M2TS
12 	enum ccx_stream_mode_enum auto_stream;
13 	char *out_elementarystream_filename;
14 
15 	/* subtitle codec type */
16 	enum ccx_code_type codec;
17 	enum ccx_code_type nocodec;
18 
19 	unsigned ts_autoprogram;       // Try to find a stream with captions automatically (no -pn needed)
20 	unsigned ts_allprogram;
21 	unsigned ts_cappids[128];      // PID for stream that holds caption information
22 	int nb_ts_cappid;
23 	unsigned ts_forced_cappid ;    // If 1, never mess with the selected PID
24 	int ts_forced_program;         // Specific program to process in TS files, if ts_forced_program_selected==1
25 	unsigned ts_forced_program_selected;
26 	int ts_datastreamtype ;        // User WANTED stream type (i.e. use the stream that has this type)
27 	unsigned ts_forced_streamtype; // User selected (forced) stream type
28 };
29 
30 struct encoder_cfg
31 {
32 	int extract;                         // Extract 1st, 2nd or both fields
33 	int dtvcc_extract;                   // 1 or 0
34 	int gui_mode_reports;                // If 1, output in stderr progress updates so the GUI can grab them
35 	char *output_filename;
36 	enum ccx_output_format write_format; // 0=Raw, 1=srt, 2=SMI
37 	int keep_output_closed;
38 	int force_flush;                     // Force flush on content write
39 	int append_mode;                     // Append mode for output files
40 	int ucla;                            // 1 if -UCLA used, 0 if not
41 
42 	enum ccx_encoding_type encoding;
43 	enum ccx_output_date_format date_format;
44 	char millis_separator;
45 	int autodash;        // Add dashes (-) before each speaker automatically?
46 	int trim_subs;       // "    Remove spaces at sides?    "
47 	int sentence_cap ;   // FIX CASE? = Fix case?
48 	int splitbysentence; // Split text into complete sentences and prorate time?
49 #ifdef WITH_LIBCURL
50 	char *curlposturl;   // If out=curl, where do we send the data to?
51 #endif
52 
53 	int with_semaphore; // Write a .sem file on file open and delete it on close?
54 	/* Credit stuff */
55 	char *start_credits_text;
56 	char *end_credits_text;
57 	struct ccx_boundary_time startcreditsnotbefore, startcreditsnotafter;   // Where to insert start credits, if possible
58 	struct ccx_boundary_time startcreditsforatleast, startcreditsforatmost; // How long to display them?
59 	struct ccx_boundary_time endcreditsforatleast, endcreditsforatmost;
60 
61 	ccx_encoders_transcript_format transcript_settings; // Keeps the settings for generating transcript output files.
62 	unsigned int send_to_srv;
63 	int no_bom;                                         // Set to 1 when no BOM (Byte Order Mark) should be used for files. Note, this might make files unreadable in windows!
64 	char *first_input_file;
65 	int multiple_files;
66 	int no_font_color;
67 	int no_type_setting;
68 	int cc_to_stdout;                                   // If this is set to 1, the stdout will be flushed when data was written to the screen during a process_608 call.
69 	int line_terminator_lf;                             // 0 = CRLF, 1=LF
70 	LLONG subs_delay;                                   // ms to delay (or advance) subs
71 	int program_number;
72 	unsigned char in_format;
73 
74 	//CEA-708
75 	int services_enabled[CCX_DTVCC_MAX_SERVICES];
76 	char** services_charsets;
77 	char* all_services_charset;
78 };
79 struct ccx_s_options // Options from user parameters
80 {
81 	int extract;                                               // Extract 1st, 2nd or both fields
82 	int no_rollup;
83 	int noscte20;
84 	int webvtt_create_css;
85 	int cc_channel;                                            // Channel we want to dump in srt mode
86 	int buffer_input;
87 	int nofontcolor;
88 	int nohtmlescape;
89 	int notypesetting;
90 	struct ccx_boundary_time extraction_start, extraction_end; // Segment we actually process
91 	int print_file_reports;
92 
93 	ccx_decoder_608_settings settings_608;                     // Contains the settings for the 608 decoder.
94 	ccx_decoder_dtvcc_settings settings_dtvcc;                 // Same for 708 decoder
95 
96 	char millis_separator;
97 	int binary_concat;                // Disabled by -ve or --videoedited
98 	int use_gop_as_pts;               // Use GOP instead of PTS timing (0=do as needed, 1=always, -1=never)
99 	int fix_padding;                  // Replace 0000 with 8080 in HDTV (needed for some cards)
100 	int gui_mode_reports;             // If 1, output in stderr progress updates so the GUI can grab them
101 	int no_progress_bar;              // If 1, suppress the output of the progress to stdout
102 	char *sentence_cap_file;          // Extra words file?
103 	int live_stream;                  /* -1 -> Not a complete file but a live stream, without timeout
104                                           0 -> A regular file
105                                          >0 -> Live stream with a timeout of this value in seconds */
106 	int messages_target;              // 0 = nowhere (quiet), 1=stdout, 2=stderr
107 	/* Levenshtein's parameters, for string comparison */
108 	int levdistmincnt, levdistmaxpct; // Means 2 fails or less is "the same", 10% or less is also "the same"
109 	int investigate_packets;          // Look for captions in all packets when everything else fails
110 	int fullbin;                      // Disable pruning of padding cc blocks
111 	int nosync;                       // Disable syncing
112 	unsigned int hauppauge_mode;      // If 1, use PID=1003, process specially and so on
113 	int wtvconvertfix;                // Fix broken Windows 7 conversion
114 	int wtvmpeg2;
115 	int auto_myth;                    // Use myth-tv mpeg code? 0=no, 1=yes, 2=auto
116 	/* MP4 related stuff */
117 	unsigned mp4vidtrack;             // Process the video track even if a CC dedicated track exists.
118 	/* General settings */
119 	int usepicorder;                  // Force the use of pic_order_cnt_lsb in AVC/H.264 data streams
120 	int xmltv;                        // 1 = full output. 2 = live output. 3 = both
121 	int xmltvliveinterval;            // interval in seconds between writing xmltv output files in live mode
122 	int xmltvoutputinterval;          // interval in seconds between writing xmltv full file output
123 	int xmltvonlycurrent;             // 0 off 1 on
124 	int keep_output_closed;
125 	int force_flush;                  // Force flush on content write
126 	int append_mode;                  // Append mode for output files
127 	int ucla;                         // 1 if UCLA used, 0 if not
128 	int hardsubx;                     // 1 if burned-in subtitles to be extracted
129 	int dvbcolor;                     // 1 if Color to be detected for DVB
130 	char *dvblang;                    // The name of the language stream for DVB
131 	char *ocrlang;                    // The name of the .traineddata file to be loaded with tesseract
132 	int ocr_oem;                      // The Tesseract OEM mode, could be 0 (default), 1 or 2
133 
134 	/*HardsubX related stuff*/
135 	int hardsubx_ocr_mode;
136 	int hardsubx_subcolor;
137 	float hardsubx_min_sub_duration;
138 	int hardsubx_detect_italics;
139 	float hardsubx_conf_thresh;
140 	float hardsubx_hue;
141 	float hardsubx_lum_thresh;
142 
143 	ccx_encoders_transcript_format transcript_settings; // Keeps the settings for generating transcript output files.
144 	enum ccx_output_date_format date_format;
145 	unsigned send_to_srv;
146 	enum ccx_output_format write_format;                // 0=Raw, 1=srt, 2=SMI
147 	int use_ass_instead_of_ssa;
148 	int use_webvtt_styling;
149 	LLONG debug_mask;                                   // dbg_print will use this mask to print or ignore different types
150 	LLONG debug_mask_on_debug;                          // If we're using temp_debug to enable/disable debug "live", this is the mask when temp_debug=1
151 	/* Networking */
152 	char *udpaddr;
153 	unsigned udpport;                                   // Non-zero => Listen for UDP packets on this port, no files.
154 	char *tcpport;
155 	char *tcp_password;
156 	char *tcp_desc;
157 	char *srv_addr;
158 	char *srv_port;
159 	int noautotimeref;                                  // Do NOT set time automatically?
160 	enum ccx_datasource input_source;                   // Files, stdin or network
161 
162 	char *output_filename;
163 
164 	char **inputfile;                                   // List of files to process
165 	int num_input_files;                                // How many?
166 	struct demuxer_cfg demux_cfg;
167 	struct encoder_cfg enc_cfg;
168 	LLONG subs_delay;                                   // ms to delay (or advance) subs
169 	int cc_to_stdout;                                   // If this is set to 1, the stdout will be flushed when data was written to the screen during a process_608 call.
170 	int pes_header_to_stdout;                           // If this is set to 1, the PES Header will be printed to console (debugging purposes)
171 	int dvb_debug_traces_to_stdout;                     // If 1, DVB subtitle debug traces will be outputted to console
172 	int ignore_pts_jumps;                               // If 1, the program will ignore PTS jumps. Sometimes this parameter is required for DVB subs with > 30s pause time
173 	int multiprogram;
174 	int out_interval;
175 #ifdef WITH_LIBCURL
176 	char *curlposturl;
177 #endif
178 
179 
180 #ifdef ENABLE_SHARING
181 	//CC sharing
182 	int sharing_enabled;
183 	char *sharing_url;
184 	//Translating
185 	int translate_enabled;
186 	char *translate_langs;
187 	char *translate_key;
188 #endif
189 };
190 
191 extern struct ccx_s_options ccx_options;
192 void init_options (struct ccx_s_options *options);
193 #endif
194