X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=libhb%2Fdeccc608sub.c;h=b9033e6d6ea53ce4fdb8f20f5e0709d77286d01c;hb=4f0019f03c2e85e8634150ff0c9a31bee6d35ce5;hp=5cfe238dbb73b789a9f033dfd0bf1b1bf8f0bfda;hpb=ab3f631985a3436179492fc3d4908107c8c63197;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/libhb/deccc608sub.c b/libhb/deccc608sub.c index 5cfe238d..b9033e6d 100644 --- a/libhb/deccc608sub.c +++ b/libhb/deccc608sub.c @@ -16,9 +16,9 @@ static int nofontcolor = 0; static enum encoding_type encoding = ENC_UTF_8; static int cc_channel = 1; static enum output_format write_format = OF_SRT; -static int sentence_cap = 1; +static int sentence_cap = 0; static int subs_delay = 0; -static LLONG screens_to_process = -1; +static int64_t screens_to_process = -1; static int processed_enough = 0; static int gui_mode_reports = 0; static int norollup = 1; @@ -27,7 +27,7 @@ static int direct_rollup = 0; /* * Get the time of the last buffer that we have received. */ -static LLONG get_fts(struct s_write *wb) +static int64_t get_fts(struct s_write *wb) { return wb->last_pts; } @@ -535,6 +535,8 @@ void get_char_in_unicode (unsigned char *buffer, unsigned char c) int get_char_in_utf_8 (unsigned char *buffer, unsigned char c) // Returns number of bytes used { + if (c==0x00) + return 0; if (c<0x80) // Regular line-21 character set, mostly ASCII except these exceptions { switch (c) @@ -679,7 +681,7 @@ int get_char_in_utf_8 (unsigned char *buffer, unsigned char c) // Returns number *buffer=0x27; return 1; case 0x97: // inverted exclamation mark - *buffer=0xc1; + *buffer=0xc2; *(buffer+1)=0xa1; return 2; case 0x98: // asterisk @@ -1412,10 +1414,10 @@ void handle_text_attr (const unsigned char c1, const unsigned char c2, struct s_ } } -void mstotime (LLONG milli, unsigned *hours, unsigned *minutes, +void mstotime (int64_t milli, unsigned *hours, unsigned *minutes, unsigned *seconds, unsigned *ms) { - // LLONG milli = (LLONG) ((ccblock*1000)/29.97); + // int64_t milli = (int64_t) ((ccblock*1000)/29.97); *ms=(unsigned) (milli%1000); // milliseconds milli=(milli-*ms)/1000; // Remainder, in seconds *seconds = (int) (milli%60); @@ -1498,7 +1500,7 @@ void write_cc_line_as_transcript (struct eia608_screen *data, struct s_write *wb buffer->start = wb->data608->current_visible_start_ms; buffer->stop = get_fts(wb); memcpy( buffer->data, wb->subline, length + 1 ); - //hb_log("CC %lld: %s", buffer->stop, wb->subline); + //hb_log("CC %"PRId64": %s", buffer->stop, wb->subline); if (wb->hb_last_buffer) { wb->hb_last_buffer->next = buffer; @@ -1544,7 +1546,7 @@ void write_cc_buffer_to_gui (struct eia608_screen *data, struct s_write *wb) unsigned h2,m2,s2,ms2; int i; - LLONG ms_start= wb->data608->current_visible_start_ms; + int64_t ms_start= wb->data608->current_visible_start_ms; ms_start+=subs_delay; if (ms_start<0) // Drop screens that because of subs_delay start too early @@ -1557,7 +1559,7 @@ void write_cc_buffer_to_gui (struct eia608_screen *data, struct s_write *wb) hb_log ("###SUBTITLE#"); if (!time_reported) { - LLONG ms_end = get_fts(wb)+subs_delay; + int64_t ms_end = get_fts(wb)+subs_delay; mstotime (ms_start,&h1,&m1,&s1,&ms1); mstotime (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. // Note, only MM:SS here as we need to save space in the preview window @@ -1583,14 +1585,14 @@ int write_cc_buffer_as_srt (struct eia608_screen *data, struct s_write *wb) unsigned h1,m1,s1,ms1; unsigned h2,m2,s2,ms2; int wrote_something = 0; - LLONG ms_start= wb->data608->current_visible_start_ms; + int64_t ms_start= wb->data608->current_visible_start_ms; int i; ms_start+=subs_delay; if (ms_start<0) // Drop screens that because of subs_delay start too early return 0; - LLONG ms_end = get_fts(wb)+subs_delay; + int64_t ms_end = get_fts(wb)+subs_delay; mstotime (ms_start,&h1,&m1,&s1,&ms1); mstotime (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. char timeline[128]; @@ -1635,7 +1637,8 @@ int write_cc_buffer_as_srt (struct eia608_screen *data, struct s_write *wb) } else { if (line == 2) { wb->enc_buffer_used += encode_line (wb->enc_buffer+wb->enc_buffer_used, - (unsigned char *) " "); + (unsigned char *) "\n"); + line = 3; } else { wb->enc_buffer_used += encode_line (wb->enc_buffer+wb->enc_buffer_used, (unsigned char *) " "); @@ -1646,7 +1649,7 @@ int write_cc_buffer_as_srt (struct eia608_screen *data, struct s_write *wb) } if (wb->enc_buffer_used) { - hb_buffer_t *buffer = hb_buffer_init( wb->enc_buffer_used + 2 ); + hb_buffer_t *buffer = hb_buffer_init( wb->enc_buffer_used + 1 ); buffer->start = ms_start; buffer->stop = ms_end; memcpy( buffer->data, wb->enc_buffer, wb->enc_buffer_used + 1 ); @@ -1672,16 +1675,16 @@ int write_cc_buffer_as_srt (struct eia608_screen *data, struct s_write *wb) int write_cc_buffer_as_sami (struct eia608_screen *data, struct s_write *wb) { int wrote_something=0; - LLONG startms = wb->data608->current_visible_start_ms; + int64_t startms = wb->data608->current_visible_start_ms; int i; startms+=subs_delay; if (startms<0) // Drop screens that because of subs_delay start too early return 0; - LLONG endms = get_fts(wb)+subs_delay; + int64_t endms = get_fts(wb)+subs_delay; endms--; // To prevent overlapping with next line. - sprintf ((char *) str,"

\r\n",startms); + sprintf ((char *) str,"

\r\n",startms); if (debug_608 && encoding!=ENC_UNICODE) { hb_log ("\r%s\n", str); @@ -1719,7 +1722,7 @@ int write_cc_buffer_as_sami (struct eia608_screen *data, struct s_write *wb) wb->enc_buffer_used=encode_line (wb->enc_buffer,(unsigned char *) str); fwrite (wb->enc_buffer,wb->enc_buffer_used,1,wb->fh); XMLRPC_APPEND(wb->enc_buffer,wb->enc_buffer_used); - sprintf ((char *) str,"

 

\r\n\r\n",endms); + sprintf ((char *) str,"

 

\r\n\r\n",endms); if (debug_608 && encoding!=ENC_UNICODE) { hb_log ("\r%s\n", str);