From 89459a6c2e7fbbd90b91bc2a1bf72757ada34575 Mon Sep 17 00:00:00 2001 From: Anshul Maheshwari Date: Tue, 19 May 2015 10:45:04 +0530 Subject: [PATCH] Indenting sami code Signed-off-by: Anshul Maheshwari --- src/lib_ccx/608_sami.c | 140 ++++++++++++++++++++--------------------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/src/lib_ccx/608_sami.c b/src/lib_ccx/608_sami.c index 2721d9f9..69563876 100644 --- a/src/lib_ccx/608_sami.c +++ b/src/lib_ccx/608_sami.c @@ -10,13 +10,13 @@ void write_stringz_as_sami(char *string, struct encoder_ctx *context, LLONG ms_s { int used; sprintf ((char *) str, - "

\r\n",(unsigned long long)ms_start); - if (context->encoding!=CCX_ENC_UNICODE) + "

\r\n",(unsigned long long)ms_start); + if (context->encoding != CCX_ENC_UNICODE) { dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); } - used = encode_line(context->buffer,(unsigned char *) str); + used = encode_line(context->buffer, (unsigned char *) str); write (context->out->fh, context->buffer, used); int len=strlen (string); unsigned char *unescaped= (unsigned char *) malloc (len+1); @@ -26,27 +26,27 @@ void write_stringz_as_sami(char *string, struct encoder_ctx *context, LLONG ms_s int pos_r=0; int pos_w=0; // Scan for \n in the string and replace it with a 0 - while (pos_rencoding!=CCX_ENC_UNICODE) + if (context->encoding != CCX_ENC_UNICODE) { dbg_print(CCX_DMT_DECODER_608, "\r"); dbg_print(CCX_DMT_DECODER_608, "%s\n",subline); @@ -55,23 +55,23 @@ void write_stringz_as_sami(char *string, struct encoder_ctx *context, LLONG ms_s write(context->out->fh, encoded_br, encoded_br_length); write(context->out->fh, encoded_crlf, encoded_crlf_length); - begin+= strlen ((const char *) begin)+1; + begin += strlen ((const char *) begin) + 1; } - sprintf ((char *) str,"

\r\n"); - if (context->encoding!=CCX_ENC_UNICODE) - { - dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); - } - used=encode_line (context->buffer,(unsigned char *) str); + sprintf ((char *) str, "

\r\n"); + if (context->encoding != CCX_ENC_UNICODE) + { + dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); + } + used = encode_line (context->buffer,(unsigned char *) str); write(context->out->fh, context->buffer, used); - sprintf ((char *) str, - "

 

\r\n\r\n", - (unsigned long long)ms_end); - if (context->encoding!=CCX_ENC_UNICODE) - { - dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); - } + sprintf ((char *) str, + "

 

\r\n\r\n", + (unsigned long long)ms_end); + if (context->encoding != CCX_ENC_UNICODE) + { + dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); + } write(context->out->fh, context->buffer, used); free(el); free(unescaped); @@ -149,56 +149,56 @@ int write_cc_buffer_as_sami(struct eia608_screen *data, struct encoder_ctx *cont { int used; LLONG startms, endms; - int wrote_something=0; - startms = data->start_time; + int wrote_something=0; + startms = data->start_time; - startms+=context->subs_delay; - if (startms<0) // Drop screens that because of subs_delay start too early - return 0; + startms+=context->subs_delay; + if (startms<0) // Drop screens that because of subs_delay start too early + return 0; - endms = data->end_time; - endms--; // To prevent overlapping with next line. - sprintf ((char *) str, - "

\r\n", - (unsigned long long)startms); - if (context->encoding!=CCX_ENC_UNICODE) - { - dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); - } + endms = data->end_time; + endms--; // To prevent overlapping with next line. + sprintf ((char *) str, + "

\r\n", + (unsigned long long)startms); + if (context->encoding != CCX_ENC_UNICODE) + { + dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); + } used = encode_line(context->buffer,(unsigned char *) str); write (context->out->fh, context->buffer, used); - for (int i=0;i<15;i++) - { - if (data->row_used[i]) - { - int length = get_decoder_line_encoded (subline, i, data); - if (context->encoding!=CCX_ENC_UNICODE) - { - dbg_print(CCX_DMT_DECODER_608, "\r"); - dbg_print(CCX_DMT_DECODER_608, "%s\n",subline); - } - write (context->out->fh, subline, length); - wrote_something=1; - if (i!=14) - write (context->out->fh, encoded_br, encoded_br_length); - write (context->out->fh,encoded_crlf, encoded_crlf_length); - } - } - sprintf ((char *) str,"

\r\n"); - if (context->encoding!=CCX_ENC_UNICODE) - { - dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); - } + for (int i=0;i<15;i++) + { + if (data->row_used[i]) + { + int length = get_decoder_line_encoded (subline, i, data); + if (context->encoding != CCX_ENC_UNICODE) + { + dbg_print(CCX_DMT_DECODER_608, "\r"); + dbg_print(CCX_DMT_DECODER_608, "%s\n",subline); + } + write (context->out->fh, subline, length); + wrote_something = 1; + if (i!=14) + write (context->out->fh, encoded_br, encoded_br_length); + write (context->out->fh, encoded_crlf, encoded_crlf_length); + } + } + sprintf ((char *) str,"

\r\n"); + if (context->encoding != CCX_ENC_UNICODE) + { + dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); + } used = encode_line(context->buffer,(unsigned char *) str); write (context->out->fh, context->buffer, used); - sprintf ((char *) str, - "

 

\r\n\r\n", - (unsigned long long)endms); - if (context->encoding!=CCX_ENC_UNICODE) - { - dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); - } + sprintf ((char *) str, + "

 

\r\n\r\n", + (unsigned long long)endms); + if (context->encoding!=CCX_ENC_UNICODE) + { + dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); + } used = encode_line(context->buffer,(unsigned char *) str); write (context->out->fh, context->buffer, used); - return wrote_something; + return wrote_something; }