From 2910b10f994f29e2a6d625b0138c1361d4a82c5f Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Thu, 1 Dec 2016 18:14:35 -0800 Subject: [PATCH 1/6] Rename mstotime to millis_to_time. --- src/lib_ccx/ccx_common_common.c | 4 ++-- src/lib_ccx/ccx_common_common.h | 2 +- src/lib_ccx/ccx_encoders_common.c | 8 ++++---- src/lib_ccx/ccx_encoders_g608.c | 4 ++-- src/lib_ccx/ccx_encoders_smptett.c | 12 ++++++------ src/lib_ccx/ccx_encoders_srt.c | 12 ++++++------ src/lib_ccx/ccx_encoders_webvtt.c | 18 +++++++++--------- src/lib_ccx/ccx_encoders_xds.c | 9 ++++----- 8 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/lib_ccx/ccx_common_common.c b/src/lib_ccx/ccx_common_common.c index fb704861..151ccff4 100644 --- a/src/lib_ccx/ccx_common_common.c +++ b/src/lib_ccx/ccx_common_common.c @@ -38,14 +38,14 @@ void fdprintf(int fd, const char *fmt, ...) free(p); return; } - else + else { p = np; } } } /* Converts the given milli to separate hours,minutes,seconds and ms variables */ -void mstotime(LLONG milli, unsigned *hours, unsigned *minutes, +void millis_to_time(LLONG milli, unsigned *hours, unsigned *minutes, unsigned *seconds, unsigned *ms) { // LLONG milli = (LLONG) ((ccblock*1000)/29.97); diff --git a/src/lib_ccx/ccx_common_common.h b/src/lib_ccx/ccx_common_common.h index 20743376..92ae9871 100644 --- a/src/lib_ccx/ccx_common_common.h +++ b/src/lib_ccx/ccx_common_common.h @@ -40,7 +40,7 @@ // Declarations void fdprintf(int fd, const char *fmt, ...); -void mstotime(LLONG milli, unsigned *hours, unsigned *minutes,unsigned *seconds, unsigned *ms); +void millis_to_time(LLONG milli, unsigned *hours, unsigned *minutes,unsigned *seconds, unsigned *ms); void freep(void *arg); void dbg_print(LLONG mask, const char *fmt, ...); unsigned char *debug_608toASC(unsigned char *ccdata, int channel); diff --git a/src/lib_ccx/ccx_encoders_common.c b/src/lib_ccx/ccx_encoders_common.c index 4c32e210..c9fb0d7b 100644 --- a/src/lib_ccx/ccx_encoders_common.c +++ b/src/lib_ccx/ccx_encoders_common.c @@ -385,7 +385,7 @@ static int write_bom(struct encoder_ctx *ctx, struct ccx_s_write *out) mprint("WARNING: Unable tp write UTF BOM\n"); return -1; } - + } if (ctx->encoding == CCX_ENC_UNICODE){ // Write BOM ret = write(out->fh, LITTLE_ENDIAN_BOM, sizeof(LITTLE_ENDIAN_BOM)); @@ -946,7 +946,7 @@ struct encoder_ctx *init_encoder(struct encoder_cfg *opt) ctx->transcript_settings = &opt->transcript_settings; ctx->no_bom = opt->no_bom; - ctx->sentence_cap = opt->sentence_cap; + ctx->sentence_cap = opt->sentence_cap; ctx->trim_subs = opt->trim_subs; ctx->autodash = opt->autodash; ctx->no_font_color = opt->no_font_color; @@ -1278,8 +1278,8 @@ void write_cc_buffer_to_gui(struct eia608_screen *data, struct encoder_ctx *cont if (!time_reported) { LLONG ms_end = data->end_time; - mstotime(ms_start, &h1, &m1, &s1, &ms1); - mstotime(ms_end - 1, &h2, &m2, &s2, &ms2); // -1 To prevent overlapping with next line. + millis_to_time(ms_start, &h1, &m1, &s1, &ms1); + millis_to_time(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 fprintf(stderr, "%02u:%02u#%02u:%02u#", h1 * 60 + m1, s1, h2 * 60 + m2, s2); diff --git a/src/lib_ccx/ccx_encoders_g608.c b/src/lib_ccx/ccx_encoders_g608.c index 24c47ca8..3f84571e 100644 --- a/src/lib_ccx/ccx_encoders_g608.c +++ b/src/lib_ccx/ccx_encoders_g608.c @@ -76,8 +76,8 @@ int write_cc_buffer_as_g608(struct eia608_screen *data, struct encoder_ctx *cont ms_end = data->end_time; - mstotime (ms_start,&h1,&m1,&s1,&ms1); - mstotime (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. + millis_to_time (ms_start,&h1,&m1,&s1,&ms1); + millis_to_time (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. char timeline[128]; context->srt_counter++; sprintf(timeline, "%u%s", context->srt_counter, context->encoded_crlf); diff --git a/src/lib_ccx/ccx_encoders_smptett.c b/src/lib_ccx/ccx_encoders_smptett.c index ab3fc36a..0c7bce32 100644 --- a/src/lib_ccx/ccx_encoders_smptett.c +++ b/src/lib_ccx/ccx_encoders_smptett.c @@ -46,8 +46,8 @@ void write_stringz_as_smptett(char *string, struct encoder_ctx *context, LLONG m if (el == NULL || unescaped == NULL) fatal (EXIT_NOT_ENOUGH_MEMORY, "In write_stringz_as_sami() - not enough memory.\n"); - mstotime (ms_start, &h1, &m1, &s1, &ms1); - mstotime (ms_end-1, &h2, &m2, &s2, &ms2); + millis_to_time (ms_start, &h1, &m1, &s1, &ms1); + millis_to_time (ms_end-1, &h2, &m2, &s2, &ms2); sprintf ((char *) str, "

\r\n", h1, m1, s1, ms1, h2, m2, s2, ms2); if (context->encoding!=CCX_ENC_UNICODE) @@ -149,8 +149,8 @@ int write_cc_bitmap_as_smptett(struct cc_subtitle *sub, struct encoder_ctx *cont char *buf = (char *) context->buffer; unsigned h1, m1, s1, ms1; unsigned h2, m2, s2, ms2; - mstotime (ms_start,&h1,&m1,&s1,&ms1); - mstotime (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. + millis_to_time (ms_start,&h1,&m1,&s1,&ms1); + millis_to_time (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. sprintf ((char *) context->buffer,"

\n",h1,m1,s1,ms1, h2,m2,s2,ms2); write (context->out->fh, buf,strlen(buf) ); len = strlen(rect[0].ocr_text); @@ -212,8 +212,8 @@ int write_cc_buffer_as_smptett(struct eia608_screen *data, struct encoder_ctx *c endms = data->end_time; endms--; // To prevent overlapping with next line. - mstotime (startms,&h1,&m1,&s1,&ms1); - mstotime (endms-1,&h2,&m2,&s2,&ms2); + millis_to_time (startms,&h1,&m1,&s1,&ms1); + millis_to_time (endms-1,&h2,&m2,&s2,&ms2); sprintf ((char *) str,"

\n",h1,m1,s1,ms1, h2,m2,s2,ms2); diff --git a/src/lib_ccx/ccx_encoders_srt.c b/src/lib_ccx/ccx_encoders_srt.c index f4a732e1..6afbf405 100644 --- a/src/lib_ccx/ccx_encoders_srt.c +++ b/src/lib_ccx/ccx_encoders_srt.c @@ -17,8 +17,8 @@ int write_stringz_as_srt(char *string, struct encoder_ctx *context, LLONG ms_sta if(!string || !string[0]) return 0; - mstotime (ms_start,&h1,&m1,&s1,&ms1); - mstotime (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. + millis_to_time (ms_start,&h1,&m1,&s1,&ms1); + millis_to_time (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. context->srt_counter++; sprintf(timeline, "%u%s", context->srt_counter, context->encoded_crlf); used = encode_line(context, context->buffer,(unsigned char *) timeline); @@ -118,8 +118,8 @@ int write_cc_bitmap_as_srt(struct cc_subtitle *sub, struct encoder_ctx *context) { if (context->prev_start != -1 || !(sub->flags & SUB_EOD_MARKER)) { - mstotime (ms_start,&h1,&m1,&s1,&ms1); - mstotime (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. + millis_to_time (ms_start,&h1,&m1,&s1,&ms1); + millis_to_time (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. context->srt_counter++; sprintf(timeline, "%u\r\n", context->srt_counter); used = encode_line(context, context->buffer,(unsigned char *) timeline); @@ -202,8 +202,8 @@ int write_cc_buffer_as_srt(struct eia608_screen *data, struct encoder_ctx *conte ms_end = data->end_time; - mstotime (ms_start,&h1,&m1,&s1,&ms1); - mstotime (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. + millis_to_time (ms_start,&h1,&m1,&s1,&ms1); + millis_to_time (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. char timeline[128]; context->srt_counter++; sprintf(timeline, "%u%s", context->srt_counter, context->encoded_crlf); diff --git a/src/lib_ccx/ccx_encoders_webvtt.c b/src/lib_ccx/ccx_encoders_webvtt.c index 3ad3f159..79d732c3 100644 --- a/src/lib_ccx/ccx_encoders_webvtt.c +++ b/src/lib_ccx/ccx_encoders_webvtt.c @@ -16,8 +16,8 @@ int write_stringz_as_webvtt(char *string, struct encoder_ctx *context, LLONG ms_ int written; char timeline[128]; - mstotime(ms_start, &h1, &m1, &s1, &ms1); - mstotime(ms_end - 1, &h2, &m2, &s2, &ms2); // -1 To prevent overlapping with next line. + millis_to_time(ms_start, &h1, &m1, &s1, &ms1); + millis_to_time(ms_end - 1, &h2, &m2, &s2, &ms2); // -1 To prevent overlapping with next line. sprintf(timeline, "%02u:%02u:%02u.%03u --> %02u:%02u:%02u.%03u%s", h1, m1, s1, ms1, h2, m2, s2, ms2, context->encoded_crlf); @@ -98,9 +98,9 @@ int write_xtimestamp_header(struct encoder_ctx *context) char header_string[200]; int used; unsigned h1, m1, s1, ms1; - mstotime(context->timing->sync_pts2fts_fts, &h1, &m1, &s1, &ms1); + millis_to_time(context->timing->sync_pts2fts_fts, &h1, &m1, &s1, &ms1); sprintf(header_string, "X-TIMESTAMP-MAP=MPEGTS:%ld, LOCAL %02u:%02u:%02u.%03u\r\n", - context->timing->sync_pts2fts_pts, + context->timing->sync_pts2fts_pts, h1, m1, s1, ms1); used = encode_line(context, context->buffer, (unsigned char *)header_string); write(context->out->fh, context->buffer, used); @@ -155,8 +155,8 @@ int write_cc_bitmap_as_webvtt(struct cc_subtitle *sub, struct encoder_ctx *conte { if (context->prev_start != -1 || !(sub->flags & SUB_EOD_MARKER)) { - mstotime(ms_start, &h1, &m1, &s1, &ms1); - mstotime(ms_end - 1, &h2, &m2, &s2, &ms2); // -1 To prevent overlapping with next line. + millis_to_time(ms_start, &h1, &m1, &s1, &ms1); + millis_to_time(ms_end - 1, &h2, &m2, &s2, &ms2); // -1 To prevent overlapping with next line. context->srt_counter++; // Not needed for WebVTT but let's keep it around for now sprintf(timeline, "%02u:%02u:%02u.%03u --> %02u:%02u:%02u.%03u%s", h1, m1, s1, ms1, h2, m2, s2, ms2, context->encoded_crlf); @@ -239,8 +239,8 @@ int write_cc_buffer_as_webvtt(struct eia608_screen *data, struct encoder_ctx *co ms_end = data->end_time; - mstotime(ms_start, &h1, &m1, &s1, &ms1); - mstotime(ms_end - 1, &h2, &m2, &s2, &ms2); // -1 To prevent overlapping with next line. + millis_to_time(ms_start, &h1, &m1, &s1, &ms1); + millis_to_time(ms_end - 1, &h2, &m2, &s2, &ms2); // -1 To prevent overlapping with next line. sprintf(timeline, "%02u:%02u:%02u.%03u --> %02u:%02u:%02u.%03u%s", h1, m1, s1, ms1, h2, m2, s2, ms2, context->encoded_crlf); @@ -332,7 +332,7 @@ int write_cc_buffer_as_webvtt(struct eia608_screen *data, struct encoder_ctx *co written = write(context->out->fh, context->subline, length); if (written != length) return -1; - written = write(context->out->fh, + written = write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); if (written != context->encoded_crlf_length) return -1; diff --git a/src/lib_ccx/ccx_encoders_xds.c b/src/lib_ccx/ccx_encoders_xds.c index 5465a07b..18c3b6d6 100644 --- a/src/lib_ccx/ccx_encoders_xds.c +++ b/src/lib_ccx/ccx_encoders_xds.c @@ -35,7 +35,7 @@ void xds_write_transcript_line_prefix (struct encoder_ctx *context, struct ccx_s { if (utc_refvalue == UINT64_MAX) { - mstotime(start_time + context->subs_delay, &h1, &m1, &s1, &ms1); + millis_to_time(start_time + context->subs_delay, &h1, &m1, &s1, &ms1); fdprintf(wb->fh, "%02u:%02u:%02u%c%03u|", h1, m1, s1, context->millis_separator, ms1); } else @@ -46,7 +46,7 @@ void xds_write_transcript_line_prefix (struct encoder_ctx *context, struct ccx_s } else { - mstotime(start_time + context->subs_delay, &h1, &m1, &s1, &ms1); + millis_to_time(start_time + context->subs_delay, &h1, &m1, &s1, &ms1); time_t start_time_int = (start_time + context->subs_delay) / 1000; int start_time_dec = (start_time + context->subs_delay) % 1000; struct tm *start_time_struct = gmtime(&start_time_int); @@ -62,7 +62,7 @@ void xds_write_transcript_line_prefix (struct encoder_ctx *context, struct ccx_s { if (utc_refvalue == UINT64_MAX) { - mstotime(end_time, &h2, &m2, &s2, &ms2); + millis_to_time(end_time, &h2, &m2, &s2, &ms2); fdprintf(wb->fh, "%02u:%02u:%02u%c%03u|", h2, m2, s2, context->millis_separator, ms2); } else @@ -72,7 +72,7 @@ void xds_write_transcript_line_prefix (struct encoder_ctx *context, struct ccx_s } else { - mstotime(end_time, &h2, &m2, &s2, &ms2); + millis_to_time(end_time, &h2, &m2, &s2, &ms2); time_t end_time_int = end_time / 1000; int end_time_dec = end_time % 1000; struct tm *end_time_struct = gmtime(&end_time_int); @@ -92,4 +92,3 @@ void xds_write_transcript_line_prefix (struct encoder_ctx *context, struct ccx_s fdprintf(wb->fh, "%s|", XDSclasses_short[cur_xds_packet_class]); } } - From ea980a41504b7cdbb7d6cb89ec38d42b266b3f75 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Thu, 1 Dec 2016 19:03:08 -0800 Subject: [PATCH 2/6] Add underscores to debug_608toASC. --- src/lib_ccx/ccx_common_common.h | 2 +- src/lib_ccx/ccx_decoders_608.c | 2 +- src/lib_ccx/ccx_decoders_common.c | 6 +++--- src/lib_ccx/es_userdata.c | 22 +++++++++++----------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/lib_ccx/ccx_common_common.h b/src/lib_ccx/ccx_common_common.h index 92ae9871..fd9efee4 100644 --- a/src/lib_ccx/ccx_common_common.h +++ b/src/lib_ccx/ccx_common_common.h @@ -43,7 +43,7 @@ void fdprintf(int fd, const char *fmt, ...); void millis_to_time(LLONG milli, unsigned *hours, unsigned *minutes,unsigned *seconds, unsigned *ms); void freep(void *arg); void dbg_print(LLONG mask, const char *fmt, ...); -unsigned char *debug_608toASC(unsigned char *ccdata, int channel); +unsigned char *debug_608_to_ASC(unsigned char *ccdata, int channel); int add_cc_sub_text(struct cc_subtitle *sub, char *str, LLONG start_time, LLONG end_time, char *info, char *mode, enum ccx_encoding_type); diff --git a/src/lib_ccx/ccx_decoders_608.c b/src/lib_ccx/ccx_decoders_608.c index b009ad86..676e9fdf 100644 --- a/src/lib_ccx/ccx_decoders_608.c +++ b/src/lib_ccx/ccx_decoders_608.c @@ -1234,7 +1234,7 @@ int process608(const unsigned char *data, int length, void *private_data, struct /* Return a pointer to a string that holds the printable characters * of the caption data block. FOR DEBUG PURPOSES ONLY! */ -unsigned char *debug_608toASC (unsigned char *cc_data, int channel) +unsigned char *debug_608_to_ASC (unsigned char *cc_data, int channel) { static unsigned char output[3]; diff --git a/src/lib_ccx/ccx_decoders_common.c b/src/lib_ccx/ccx_decoders_common.c index 6d96174e..07146c75 100644 --- a/src/lib_ccx/ccx_decoders_common.c +++ b/src/lib_ccx/ccx_decoders_common.c @@ -118,7 +118,7 @@ int do_cb (struct lib_cc_decode *ctx, unsigned char *cc_block, struct cc_subtitl switch (cc_type) { case 0: - dbg_print(CCX_DMT_CBRAW, " %s .. ..\n", debug_608toASC( cc_block, 0)); + dbg_print(CCX_DMT_CBRAW, " %s .. ..\n", debug_608_to_ASC( cc_block, 0)); ctx->current_field = 1; ctx->saw_caption_block = 1; @@ -142,7 +142,7 @@ int do_cb (struct lib_cc_decode *ctx, unsigned char *cc_block, struct cc_subtitl cb_field1++; break; case 1: - dbg_print(CCX_DMT_CBRAW, " .. %s ..\n", debug_608toASC( cc_block, 1)); + dbg_print(CCX_DMT_CBRAW, " .. %s ..\n", debug_608_to_ASC( cc_block, 1)); ctx->current_field = 2; ctx->saw_caption_block = 1; @@ -350,7 +350,7 @@ struct lib_cc_decode* init_cc_decode (struct ccx_decoders_common_settings_t *set ctx->pulldownfields = 0; //es parser related variable ends here - memset(ctx->cc_stats, 0, 4 * sizeof(int)); + memset(ctx->cc_stats, 0, 4 * sizeof(int)); ctx->anchor_seq_number = -1; // Init XDS buffers diff --git a/src/lib_ccx/es_userdata.c b/src/lib_ccx/es_userdata.c index fd33f2df..f69b4ab8 100644 --- a/src/lib_ccx/es_userdata.c +++ b/src/lib_ccx/es_userdata.c @@ -154,7 +154,7 @@ int user_data(struct lib_cc_decode *ctx, struct bitstream *ustream, int udtype, unsigned field_number; unsigned cc_data1; unsigned cc_data2; - + for (unsigned j=0;jtiming->current_tref, ctx->timing->fts_now, sub); @@ -406,7 +406,7 @@ int user_data(struct lib_cc_decode *ctx, struct bitstream *ustream, int udtype, type=dcd[0]; // repeater (0x02 or 0x04) dcd++; // Skip the repeater byte. - dbg_print(CCX_DMT_PARSE, " - R:%02X :%s", type, debug_608toASC( dishdata, 0) ); + dbg_print(CCX_DMT_PARSE, " - R:%02X :%s", type, debug_608_to_ASC( dishdata, 0) ); hi = dishdata[1] & 0x7f; // Get only the 7 low bits if (type==0x04 && hi<32) @@ -415,7 +415,7 @@ int user_data(struct lib_cc_decode *ctx, struct bitstream *ustream, int udtype, dishdata[3]=0x04; // Field 1 dishdata[4]=dishdata[1]; dishdata[5]=dishdata[2]; - dbg_print(CCX_DMT_PARSE, "%s:\n", debug_608toASC( dishdata+3, 0) ); + dbg_print(CCX_DMT_PARSE, "%s:\n", debug_608_to_ASC( dishdata+3, 0) ); } else { @@ -433,8 +433,8 @@ int user_data(struct lib_cc_decode *ctx, struct bitstream *ustream, int udtype, dishdata[5]=dcd[1]; dishdata[6] = 0xFF; // Set end marker - dbg_print(CCX_DMT_PARSE, ":%s", debug_608toASC( dishdata, 0) ); - dbg_print(CCX_DMT_PARSE, "%s:\n", debug_608toASC( dishdata+3, 0) ); + dbg_print(CCX_DMT_PARSE, ":%s", debug_608_to_ASC( dishdata, 0) ); + dbg_print(CCX_DMT_PARSE, "%s:\n", debug_608_to_ASC( dishdata+3, 0) ); } store_hdcc(ctx, dishdata, cc_count, ctx->timing->current_tref, ctx->timing->fts_now, sub); @@ -474,7 +474,7 @@ int user_data(struct lib_cc_decode *ctx, struct bitstream *ustream, int udtype, uint8_t line_type; uint8_t field = 1; read_bytes(ustream, 4); //skip header code - read_bytes(ustream, 2); //skip data length + read_bytes(ustream, 2); //skip data length line_nb = read_bits(ustream, 16); line_type = read_u8(ustream); field = (line_type & 0x03); @@ -488,7 +488,7 @@ int user_data(struct lib_cc_decode *ctx, struct bitstream *ustream, int udtype, if (udatalen < 720) mprint("MPEG:VBI: Minimum 720 bytes in luma line required\n"); - decode_vbi(ctx, field, ustream->pos, 720, sub); + decode_vbi(ctx, field, ustream->pos, 720, sub); dbg_print(CCX_DMT_VERBOSE, "GXF (vbi line %d) user data:\n", line_nb); } else From 2959d2a2ae55ffe5ee9490fca287923b6452306c Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Thu, 1 Dec 2016 20:44:00 -0800 Subject: [PATCH 3/6] Rename function to new name. --- src/lib_ccx/ccx_encoders_curl.c | 4 ++-- src/lib_ccx/ccx_encoders_transcript.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib_ccx/ccx_encoders_curl.c b/src/lib_ccx/ccx_encoders_curl.c index 58e9e4d9..80deaf66 100644 --- a/src/lib_ccx/ccx_encoders_curl.c +++ b/src/lib_ccx/ccx_encoders_curl.c @@ -56,8 +56,8 @@ int write_cc_bitmap_as_libcurl(struct cc_subtitle *sub, struct encoder_ctx *cont { if (context->prev_start != -1 || !(sub->flags & SUB_EOD_MARKER)) { - mstotime(ms_start, &h1, &m1, &s1, &ms1); - mstotime(ms_end - 1, &h2, &m2, &s2, &ms2); // -1 To prevent overlapping with next line. + millis_to_time(ms_start, &h1, &m1, &s1, &ms1); + millis_to_time(ms_end - 1, &h2, &m2, &s2, &ms2); // -1 To prevent overlapping with next line. context->srt_counter++; sprintf(timeline, "group_id=ccextractordev&start_time=%" PRIu64 "&end_time=%" PRIu64 "&lang=en", ms_start, ms_end); char *curlline = NULL; diff --git a/src/lib_ccx/ccx_encoders_transcript.c b/src/lib_ccx/ccx_encoders_transcript.c index 8a37d8f2..ca7aaa9a 100644 --- a/src/lib_ccx/ccx_encoders_transcript.c +++ b/src/lib_ccx/ccx_encoders_transcript.c @@ -59,7 +59,7 @@ int write_cc_bitmap_as_transcript(struct cc_subtitle *sub, struct encoder_ctx *c } else { - mstotime(start_time + context->subs_delay, &h1, &m1, &s1, &ms1); + millis_to_time(start_time + context->subs_delay, &h1, &m1, &s1, &ms1); time_t start_time_int = (start_time + context->subs_delay) / 1000; int start_time_dec = (start_time + context->subs_delay) % 1000; struct tm *start_time_struct = gmtime(&start_time_int); @@ -375,4 +375,3 @@ int write_cc_buffer_as_transcript2(struct eia608_screen *data, struct encoder_ct dbg_print(CCX_DMT_DECODER_608, "- - - - - - - - - - - -\r\n"); return wrote_something; } - From 27417cda70df3c3a22535f2861c74f0901500020 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Sun, 4 Dec 2016 17:31:26 -0800 Subject: [PATCH 4/6] Rename more mstotime's to millis_to_time. --- src/lib_ccx/ccx_encoders_ssa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib_ccx/ccx_encoders_ssa.c b/src/lib_ccx/ccx_encoders_ssa.c index e27b0d47..26fac78d 100644 --- a/src/lib_ccx/ccx_encoders_ssa.c +++ b/src/lib_ccx/ccx_encoders_ssa.c @@ -73,8 +73,8 @@ int write_cc_buffer_as_ssa(struct eia608_screen *data, struct encoder_ctx *conte ms_end = data->end_time; - mstotime (ms_start,&h1,&m1,&s1,&ms1); - mstotime (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. + millis_to_time (ms_start,&h1,&m1,&s1,&ms1); + millis_to_time (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. char timeline[128]; sprintf (timeline, "Dialogue: 0,%02u:%02u:%02u.%01u,%02u:%02u:%02u.%02u,Default,,0000,0000,0000,,", h1, m1, s1, ms1 / 10, h2, m2, s2, ms2 / 10); From 08e9c3d5967f3f85d0c01c8a43059afc78324842 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Sun, 4 Dec 2016 14:38:57 -0800 Subject: [PATCH 5/6] Rename previously not renamed function. --- src/lib_ccx/sequencing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib_ccx/sequencing.c b/src/lib_ccx/sequencing.c index 7f77f8bc..27f72199 100644 --- a/src/lib_ccx/sequencing.c +++ b/src/lib_ccx/sequencing.c @@ -68,7 +68,7 @@ void store_hdcc(struct lib_cc_decode *ctx, unsigned char *cc_data, int cc_count, printf("\nCC blocks, channel 0:\n"); for ( int i=0; i < cc_count*3; i+=3) { - printf("%s", debug_608toASC( cc_data+i, 0) ); + printf("%s", debug_608_to_ASC( cc_data+i, 0) ); } printf("\n"); */ From c6c8de735782ae0cb5362557d791188ad6dc544d Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Wed, 14 Dec 2016 17:43:59 -0800 Subject: [PATCH 6/6] Rename mstotime to millis_to_time in ccx_encoders_ssa. --- src/lib_ccx/ccx_encoders_ssa.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib_ccx/ccx_encoders_ssa.c b/src/lib_ccx/ccx_encoders_ssa.c index f97a1b36..8a37ab5f 100644 --- a/src/lib_ccx/ccx_encoders_ssa.c +++ b/src/lib_ccx/ccx_encoders_ssa.c @@ -15,8 +15,8 @@ int write_stringz_as_ssa(char *string, struct encoder_ctx *context, LLONG ms_sta if(!string || !string[0]) return 0; - mstotime (ms_start,&h1,&m1,&s1,&ms1); - mstotime (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. + millis_to_time (ms_start,&h1,&m1,&s1,&ms1); + millis_to_time (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. sprintf (timeline, "Dialogue: 0,%02u:%02u:%02u.%01u,%02u:%02u:%02u.%02u,Default,,0000,0000,0000,,", h1, m1, s1, ms1 / 10, h2, m2, s2, ms2 / 10); @@ -113,8 +113,8 @@ int write_cc_bitmap_as_ssa(struct cc_subtitle *sub, struct encoder_ctx *context) { if (context->prev_start != -1 || !(sub->flags & SUB_EOD_MARKER)) { - mstotime (ms_start,&h1,&m1,&s1,&ms1); - mstotime (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. + millis_to_time (ms_start,&h1,&m1,&s1,&ms1); + millis_to_time (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. sprintf (timeline, "Dialogue: 0,%02u:%02u:%02u.%01u,%02u:%02u:%02u.%02u,Default,,0000,0000,0000,,", h1,m1,s1,ms1/10, h2,m2,s2,ms2/10); @@ -291,4 +291,3 @@ int write_cc_buffer_as_ssa(struct eia608_screen *data, struct encoder_ctx *conte write (context->out->fh, context->encoded_crlf, context->encoded_crlf_length); return wrote_something; } -