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
34 changes: 34 additions & 0 deletions src/lib_ccx/params_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,27 @@ void print_file_report_json(struct lib_ccx_ctx *ctx)
pid,
demux->PIDs_programs[pid]->program_number);
json_escape(desc[demux->PIDs_programs[pid]->printable_stream_type]);

/* Tag DVB subtitle and Teletext PIDs */
int is_dvb = 0, is_tlt = 0;
for (int k = 0; k < SUB_STREAMS_CNT; k++)
{
if (demux->freport.dvb_sub_pid[k] == (unsigned)pid)
{
is_dvb = 1;
break;
}
if (demux->freport.tlt_sub_pid[k] == (unsigned)pid)
{
is_tlt = 1;
break;
}
}
if (is_dvb)
printf(", \"type\": \"dvb_subtitle\"");
else if (is_tlt)
printf(", \"type\": \"teletext_subtitle\"");

printf(" }");
}
printf("\n ]\n");
Expand Down Expand Up @@ -501,6 +522,19 @@ void print_file_report_json(struct lib_ccx_ctx *ctx)
(program_ci && get_sib_stream_by_type(program_ci, CCX_CODEC_ATSC_CC)) ? "true" : "false");
printf(" },\n");

/* Teletext seen pages */
if (program_ci && get_sib_stream_by_type(program_ci, CCX_CODEC_TELETEXT))
{
struct cap_info *tlt_info = get_sib_stream_by_type(program_ci, CCX_CODEC_TELETEXT);
struct lib_cc_decode *tlt_dec = update_decoder_list_cinfo(ctx, tlt_info);
if (tlt_dec && tlt_dec->codec == CCX_CODEC_TELETEXT)
{
printf(" \"teletext_pages\": ");
tlt_print_seen_pages_json(tlt_dec);
printf(",\n");
}
}

printf(" \"captions\": {\n");
printf(" \"present\": %s,\n", has_any_captions ? "true" : "false");

Expand Down
1 change: 1 addition & 0 deletions src/lib_ccx/teletext.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ struct TeletextCtx
};

int tlt_print_seen_pages(struct lib_cc_decode *dec_ctx);
int tlt_print_seen_pages_json(struct lib_cc_decode *dec_ctx);
void telxcc_dump_prev_page(struct TeletextCtx *ctx, struct cc_subtitle *sub);
void set_tlt_delta(struct lib_cc_decode *dec_ctx, uint64_t pts);
#endif
27 changes: 27 additions & 0 deletions src/lib_ccx/telxcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,33 @@ int tlt_print_seen_pages(struct lib_cc_decode *dec_ctx)
}
return CCX_OK;
}

int tlt_print_seen_pages_json(struct lib_cc_decode *dec_ctx)
{
struct TeletextCtx *ctx = NULL;

if (dec_ctx->codec != CCX_CODEC_TELETEXT)
{
errno = EINVAL;
return -1;
}

ctx = dec_ctx->private_data;

printf("[");
int first = 1;
for (int i = 0; i < MAX_TLT_PAGES; i++)
{
if (ctx->seen_sub_page[i] == 0)
continue;
if (!first)
printf(", ");
first = 0;
printf("%d", i);
}
printf("]");
return CCX_OK;
}
void set_tlt_delta(struct lib_cc_decode *dec_ctx, uint64_t pts)
{
struct TeletextCtx *ctx = dec_ctx->private_data;
Expand Down
Loading