diff --git a/src/cc_decoders_common.h b/src/cc_decoders_common.h index 308b7a27..bef28c2b 100644 --- a/src/cc_decoders_common.h +++ b/src/cc_decoders_common.h @@ -10,4 +10,5 @@ struct cc_subtitle }; int process608(const unsigned char *data, int length, struct s_context_cc608 *context, struct cc_subtitle *sub); +void handle_end_of_data(struct s_context_cc608 *context, struct cc_subtitle *sub); #endif diff --git a/src/ccextractor.c b/src/ccextractor.c index 8d77e21a..1d64de72 100644 --- a/src/ccextractor.c +++ b/src/ccextractor.c @@ -246,6 +246,7 @@ int main(int argc, char *argv[]) { char *c; struct encoder_ctx enc_ctx[2]; + struct cc_subtitle dec_sub; // Initialize some constants init_ts(); @@ -280,6 +281,7 @@ int main(int argc, char *argv[]) int show_myth_banner = 0; memset (&cea708services[0],0,63*sizeof (int)); + memset (&dec_sub, 0,sizeof(dec_sub)); parse_configuration(&ccx_options); parse_parameters (argc,argv); @@ -840,14 +842,16 @@ int main(int argc, char *argv[]) if (wbout1.fh!=-1) { - if (ccx_options.write_format==CCX_OF_SPUPNG) - { - //handle_end_of_data(&context_cc608_field_1); - } if (ccx_options.write_format==CCX_OF_SMPTETT || ccx_options.write_format==CCX_OF_SAMI || - ccx_options.write_format==CCX_OF_SRT || ccx_options.write_format==CCX_OF_TRANSCRIPT) + ccx_options.write_format==CCX_OF_SRT || ccx_options.write_format==CCX_OF_TRANSCRIPT + || ccx_options.write_format==CCX_OF_SPUPNG ) { - //handle_end_of_data(&context_cc608_field_1); + handle_end_of_data(&context_cc608_field_1, &dec_sub); + if (dec_sub.got_output) + { + encode_sub(enc_ctx,&dec_sub); + dec_sub.got_output = 0; + } } else if(ccx_options.write_format==CCX_OF_RCWT) { @@ -858,14 +862,16 @@ int main(int argc, char *argv[]) } if (wbout2.fh!=-1) { - if (ccx_options.write_format==CCX_OF_SPUPNG) - { - //handle_end_of_data(&context_cc608_field_2); - } if (ccx_options.write_format==CCX_OF_SMPTETT || ccx_options.write_format==CCX_OF_SAMI || - ccx_options.write_format==CCX_OF_SRT || ccx_options.write_format==CCX_OF_TRANSCRIPT) + ccx_options.write_format==CCX_OF_SRT || ccx_options.write_format==CCX_OF_TRANSCRIPT + || ccx_options.write_format==CCX_OF_SPUPNG ) { - //handle_end_of_data(&context_cc608_field_2); + handle_end_of_data(&context_cc608_field_2, &dec_sub); + if (dec_sub.got_output) + { + encode_sub(enc_ctx,&dec_sub); + dec_sub.got_output = 0; + } } dinit_encoder(enc_ctx+1); } diff --git a/src/file_functions.c b/src/file_functions.c index afb0f501..0144dea5 100644 --- a/src/file_functions.c +++ b/src/file_functions.c @@ -1,5 +1,4 @@ #include "ccextractor.h" - long FILEBUFFERSIZE = 1024*1024*16; // 16 Mbytes no less. Minimize number of real read calls() LLONG buffered_read_opt_file (unsigned char *buffer, unsigned int bytes); diff --git a/src/myth.c b/src/myth.c index 44c938ea..f7384ec1 100644 --- a/src/myth.c +++ b/src/myth.c @@ -12,6 +12,7 @@ For now, integration with ccextractor is a quick hack. It could get better with #include #include #include +#include "cc_encoders_common.h" static unsigned int header_state; static unsigned char psm_es_type[256];