Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/lib_ccx/ccx_common_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ int add_cc_sub_text(struct cc_subtitle *sub, char *str, LLONG start_time,
sub->type = CC_TEXT;
sub->enc_type = e_type;
sub->data = strdup(str);
if (str && !sub->data)
{
return -1;
}
sub->datatype = CC_DATATYPE_GENERIC;
sub->nb_data = str ? strlen(str) : 0;
sub->start_time = start_time;
Expand Down
14 changes: 12 additions & 2 deletions src/lib_ccx/ccx_encoders_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,15 +607,25 @@ static int init_output_ctx(struct encoder_ctx *ctx, struct encoder_cfg *cfg)
char *basefilename = get_basename(cfg->output_filename);
extension = get_file_extension(cfg->write_format);

ret = init_write(&ctx->out[0], strdup(cfg->output_filename), cfg->with_semaphore);
char *dup_filename = strdup(cfg->output_filename);
if (!dup_filename)
{
fatal(EXIT_NOT_ENOUGH_MEMORY, "In init_encoder: Out of memory duplicating output_filename.");
}
ret = init_write(&ctx->out[0], dup_filename, cfg->with_semaphore);
check_ret(cfg->output_filename);
ret = init_write(&ctx->out[1], create_outfilename(basefilename, "_2", extension), cfg->with_semaphore);
check_ret(ctx->out[1].filename);
free(basefilename);
}
else
{
ret = init_write(ctx->out, strdup(cfg->output_filename), cfg->with_semaphore);
char *dup_filename = strdup(cfg->output_filename);
if (!dup_filename)
{
fatal(EXIT_NOT_ENOUGH_MEMORY, "In init_encoder: Out of memory duplicating output_filename.");
}
ret = init_write(ctx->out, dup_filename, cfg->with_semaphore);
check_ret(cfg->output_filename);
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/lib_ccx/ccx_encoders_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ void call_function_if_match(unsigned char *line, struct word_list *list, void (*
'{', '|', '}', '~', '\0'};

unsigned char *line_token = strdup(line);
if (!line_token)
{
return;
}
unsigned char *c = strtok(line_token, delim);

if (c != NULL)
Expand Down Expand Up @@ -127,6 +131,10 @@ void telx_correct_case(char *sub_line)
'{', '|', '}', '~', '\0'};

char *line = strdup(((char *)sub_line));
if (!line)
{
return;
}
char *oline = (char *)sub_line;
char *c = strtok(line, delim);
if (c == NULL)
Expand Down
11 changes: 11 additions & 0 deletions src/lib_ccx/general_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,21 @@ void process_hex(struct lib_ccx_ctx *ctx, char *filename)
}
/* const char *mpeg_header="00 00 01 b2 43 43 01 f8 "; // Always present */
FILE *fr = fopen(filename, "rt");
if (!fr)
{
free(line);
fatal(EXIT_FAILURE, "In process_hex: Cannot open %s.", filename);
}
unsigned char *bytes = NULL;
unsigned byte_count = 0;
int warning_shown = 0;
struct demuxer_data *data = alloc_demuxer_data();
if (!data)
{
fclose(fr);
free(line);
fatal(EXIT_NOT_ENOUGH_MEMORY, "In process_hex: Out of memory allocating demuxer data.");
}
while (fgets(line, max - 1, fr) != NULL)
{
char *c1, *c2 = NULL; // Positions for first and second colons
Expand Down
4 changes: 4 additions & 0 deletions src/lib_ccx/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ int init_write(struct ccx_s_write *wb, char *filename, int with_semaphore)
wb->temporarily_closed = 0;
wb->filename = filename;
wb->original_filename = strdup(filename);
if (!wb->original_filename)
{
fatal(EXIT_NOT_ENOUGH_MEMORY, "In init_write: Out of memory duplicating filename.");
}

wb->with_semaphore = with_semaphore;
wb->append_mode = ccx_options.enc_cfg.append_mode;
Expand Down
18 changes: 9 additions & 9 deletions src/lib_ccx/ts_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,39 @@ uint64_t last_pts = 0; // PTS of last PES packet (debug purposes)
// Descriptions for ts ccx_stream_type
const char *desc[256];

char *get_buffer_type_str(struct cap_info *cinfo)
const char *get_buffer_type_str(struct cap_info *cinfo)
{
if (cinfo->stream == CCX_STREAM_TYPE_VIDEO_MPEG2)
{
return strdup("MPG");
return "MPG";
}
else if (cinfo->stream == CCX_STREAM_TYPE_VIDEO_H264)
{
return strdup("H.264");
return "H.264";
}
else if (cinfo->stream == CCX_STREAM_TYPE_VIDEO_HEVC)
{
return strdup("HEVC");
return "HEVC";
}
else if (cinfo->stream == CCX_STREAM_TYPE_PRIVATE_MPEG2 && cinfo->codec == CCX_CODEC_ISDB_CC)
{
return strdup("ISDB CC subtitle");
return "ISDB CC subtitle";
}
else if (cinfo->stream == CCX_STREAM_TYPE_PRIVATE_MPEG2 && cinfo->codec == CCX_CODEC_DVB)
{
return strdup("DVB subtitle");
return "DVB subtitle";
}
else if (cinfo->stream == CCX_STREAM_TYPE_UNKNOWNSTREAM && ccx_options.hauppauge_mode)
{
return strdup("Hauppage");
return "Hauppage";
}
else if (cinfo->stream == CCX_STREAM_TYPE_PRIVATE_MPEG2 && cinfo->codec == CCX_CODEC_TELETEXT)
{
return strdup("Teletext");
return "Teletext";
}
else if (cinfo->stream == CCX_STREAM_TYPE_PRIVATE_MPEG2 && cinfo->codec == CCX_CODEC_ATSC_CC)
{
return strdup("CC in private MPEG packet");
return "CC in private MPEG packet";
}
else
{
Expand Down
Loading