allocating-cc_subtitle-for-mp4

This commit is contained in:
Anshul Maheshwari 2014-07-12 12:50:20 +05:30
parent adaa436f6b
commit 3afcfa79e1
2 changed files with 14 additions and 13 deletions

View File

@ -479,7 +479,6 @@ struct eia608_screen *get_current_visible_buffer(struct s_context_cc608 *context
int write_cc_buffer(struct s_context_cc608 *context, struct cc_subtitle *sub)
{
struct eia608_screen *data;
struct cc_subtitle *sub = NULL;
int wrote_something=0;
LLONG start_time;
LLONG end_time;

View File

@ -6,7 +6,7 @@
#include "../ccextractor.h"
#include "../utility.h"
void do_NAL (unsigned char *NALstart, LLONG NAL_length); // From avc_functions.c
void do_NAL (unsigned char *NALstart, LLONG NAL_length, struct cc_subtitle *sub); // From avc_functions.c
void set_fts(void); // From timing.c
static short bswap16(short v)
@ -25,7 +25,7 @@ static struct {
unsigned type[32];
}s_nalu_stats;
static int process_avc_sample(u32 timescale, GF_AVCConfig* c, GF_ISOSample* s)
static int process_avc_sample(u32 timescale, GF_AVCConfig* c, GF_ISOSample* s, struct cc_subtitle *sub)
{
int status = 0;
u32 i;
@ -60,14 +60,14 @@ static int process_avc_sample(u32 timescale, GF_AVCConfig* c, GF_ISOSample* s)
temp_debug=0;
if (nal_length>0)
do_NAL ((unsigned char *) &(s->data[i]) ,nal_length);
do_NAL ((unsigned char *) &(s->data[i]) ,nal_length, sub);
i += nal_length;
} // outer for
assert(i == s->dataLength);
return status;
}
static int process_xdvb_track(const char* basename, GF_ISOFile* f, u32 track)
static int process_xdvb_track(const char* basename, GF_ISOFile* f, u32 track, struct cc_subtitle *sub)
{
u32 timescale, i, sample_count;
@ -94,7 +94,7 @@ static int process_xdvb_track(const char* basename, GF_ISOFile* f, u32 track)
pts_set=1;
set_fts();
process_m2v ((unsigned char *) s->data,s->dataLength);
process_m2v ((unsigned char *) s->data,s->dataLength, sub);
gf_isom_sample_del(&s);
}
@ -112,7 +112,7 @@ static int process_xdvb_track(const char* basename, GF_ISOFile* f, u32 track)
return status;
}
static int process_avc_track(const char* basename, GF_ISOFile* f, u32 track)
static int process_avc_track(const char* basename, GF_ISOFile* f, u32 track, struct cc_subtitle *sub)
{
u32 timescale, i, sample_count, last_sdi = 0;
int status;
@ -153,7 +153,7 @@ static int process_avc_track(const char* basename, GF_ISOFile* f, u32 track)
last_sdi = sdi;
}
status = process_avc_sample(timescale, c, s);
status = process_avc_sample(timescale, c, s, sub);
gf_isom_sample_del(&s);
@ -196,11 +196,13 @@ static int process_avc_track(const char* basename, GF_ISOFile* f, u32 track)
}
*/
int processmp4 (char *file)
int processmp4 (char *file,void *enc_ctx)
{
GF_ISOFile* f;
u32 i, j, track_count, avc_track_count, cc_track_count;
struct cc_subtitle dec_sub;
memset(&dec_sub,0,sizeof(dec_sub));
mprint("opening \'%s\': ", file);
#ifdef MP4_DEBUG
gf_log_set_tool_level(GF_LOG_CONTAINER,GF_LOG_DEBUG);
@ -242,7 +244,7 @@ int processmp4 (char *file)
{
if (cc_track_count && !ccx_options.mp4vidtrack)
continue;
if(process_xdvb_track(file, f, i + 1) != 0)
if(process_xdvb_track(file, f, i + 1, &dec_sub) != 0)
{
mprint("error\n");
return -3;
@ -259,11 +261,11 @@ int processmp4 (char *file)
for (j=0; j<gf_list_count(cnf->sequenceParameterSets);j++)
{
GF_AVCConfigSlot* seqcnf=(GF_AVCConfigSlot* )gf_list_get(cnf->sequenceParameterSets,j);
do_NAL ((unsigned char *) seqcnf->data,seqcnf->size);
do_NAL ((unsigned char *) seqcnf->data, seqcnf->size, &dec_sub);
}
}
if(process_avc_track(file, f, i + 1) != 0)
if(process_avc_track(file, f, i + 1, &dec_sub) != 0)
{
mprint("error\n");
return -3;
@ -332,7 +334,7 @@ int processmp4 (char *file)
#ifdef MP4_DEBUG
dump(256, (unsigned char *)data, atomLength - 8, 0, 1);
#endif
process608((unsigned char*)data, atomLength - 8, &context_cc608_field_1);
process608((unsigned char*)data, atomLength - 8, &context_cc608_field_1, &dec_sub);
}
atomStart += atomLength;