handling end of data correctly

This commit is contained in:
Anshul Maheshwari 2014-07-16 16:06:29 +05:30
parent 855ca48220
commit 69c0b2e223
4 changed files with 20 additions and 13 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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);

View File

@ -12,6 +12,7 @@ For now, integration with ccextractor is a quick hack. It could get better with
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include "cc_encoders_common.h"
static unsigned int header_state;
static unsigned char psm_es_type[256];