• Main Page
  • Classes
  • Files
  • File List
  • File Members

libhb/deccc608sub.h

Go to the documentation of this file.
00001 /*
00002  * From ccextractor, leave this file as intact and close to the original as possible so that 
00003  * it is easy to patch in fixes - even though this file contains code that we don't need.
00004  *
00005  * Note that the SRT sub generation from CC could be useful for mkv subs.
00006  */
00007 #ifndef __deccc608sub_H__
00008 #define __deccc608sub_H__
00009 
00010 #include "common.h"
00011 
00012 struct s_write;
00013 
00014 void handle_end_of_data (struct s_write *wb);
00015 void process608 (const unsigned char *data, int length, struct s_write *wb);
00016 void get_char_in_latin_1 (unsigned char *buffer, unsigned char c);
00017 void get_char_in_unicode (unsigned char *buffer, unsigned char c);
00018 int get_char_in_utf_8 (unsigned char *buffer, unsigned char c);
00019 unsigned char cctolower (unsigned char c);
00020 unsigned char cctoupper (unsigned char c);
00021 int general_608_init (struct s_write *wb);
00022 void general_608_close (struct s_write *wb);
00023 
00024 #define CC608_SCREEN_WIDTH  32
00025 
00026 enum cc_modes
00027 {
00028     MODE_POPUP = 0,
00029     MODE_ROLLUP_2 = 1,
00030     MODE_ROLLUP_3 = 2,
00031     MODE_ROLLUP_4 = 3,
00032         MODE_TEXT = 4
00033 };
00034 
00035 enum color_code
00036 {
00037     COL_WHITE = 0,
00038     COL_GREEN = 1,
00039     COL_BLUE = 2,
00040     COL_CYAN = 3,
00041     COL_RED = 4,
00042     COL_YELLOW = 5,
00043     COL_MAGENTA = 6,
00044         COL_USERDEFINED = 7
00045 };
00046 
00047 
00048 enum font_bits
00049 {
00050     FONT_REGULAR = 0,
00051     FONT_ITALICS = 1,
00052     FONT_UNDERLINED = 2,
00053     FONT_UNDERLINED_ITALICS = 3
00054 };
00055 
00056 
00057 struct eia608_screen // A CC buffer
00058 {
00059     unsigned char characters[15][33]; 
00060     unsigned char colors[15][33];
00061     unsigned char fonts[15][33]; // Extra char at the end for a 0
00062     int row_used[15]; // Any data in row?
00063     int empty; // Buffer completely empty?      
00064 };
00065 
00066 struct eia608
00067 {
00068     struct eia608_screen buffer1;
00069     struct eia608_screen buffer2;  
00070     int cursor_row, cursor_column;
00071     int visible_buffer;
00072     int srt_counter; // Number of subs currently written
00073     int screenfuls_counter; // Number of meaningful screenfuls written
00074     int64_t current_visible_start_ms; // At what time did the current visible buffer became so?
00075     // unsigned current_visible_start_cc; // At what time did the current visible buffer became so?
00076     enum cc_modes mode;
00077     unsigned char last_c1, last_c2;
00078     int channel; // Currently selected channel
00079     unsigned char color; // Color we are currently using to write
00080     unsigned char font; // Font we are currently using to write
00081     int rollup_base_row;
00082 };
00083 
00084 struct s_write {
00085     struct eia608 *data608;
00086     FILE *fh;
00087     unsigned char *subline; 
00088     int new_sentence;
00089     int new_channel;
00090     int in_xds_mode;
00091     hb_buffer_t *hb_buffer;
00092     hb_buffer_t *hb_last_buffer;
00093     uint64_t last_pts;
00094     unsigned char *enc_buffer; // Generic general purpose buffer
00095     unsigned enc_buffer_used;
00096     unsigned enc_buffer_capacity;
00097 };
00098 
00099 enum command_code
00100 {
00101     COM_UNKNOWN = 0,
00102     COM_ERASEDISPLAYEDMEMORY = 1,
00103     COM_RESUMECAPTIONLOADING = 2,
00104     COM_ENDOFCAPTION = 3,
00105     COM_TABOFFSET1 = 4,
00106     COM_TABOFFSET2 = 5,
00107     COM_TABOFFSET3 = 6,
00108     COM_ROLLUP2 = 7,
00109     COM_ROLLUP3 = 8,
00110     COM_ROLLUP4 = 9,
00111     COM_CARRIAGERETURN = 10,
00112     COM_ERASENONDISPLAYEDMEMORY = 11,
00113     COM_BACKSPACE = 12,
00114         COM_RESUMETEXTDISPLAY = 13
00115 };
00116 
00117 enum encoding_type
00118 {
00119     ENC_UNICODE = 0,
00120     ENC_LATIN_1 = 1,
00121     ENC_UTF_8 = 2
00122 };
00123 
00124 enum output_format
00125 {
00126     OF_RAW      = 0,
00127     OF_SRT      = 1,
00128     OF_SAMI = 2,
00129     OF_TRANSCRIPT = 3,
00130     OF_RCWT = 4
00131 };
00132 
00133 #endif

Generated on Fri May 17 2013 05:31:50 for HandBrake by  doxygen 1.7.1