Skip to content

Commit 00a717a

Browse files
committed
fix: skip non-DVB encoders in lookup
1 parent 4dd2c83 commit 00a717a

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

src/lib_ccx/lib_ccx.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,11 @@ struct encoder_ctx *update_encoder_list_cinfo(struct lib_ccx_ctx *ctx, struct ca
453453
{
454454
if (ctx->multiprogram == CCX_FALSE)
455455
{
456-
/* For DVB subtitles with multiple PIDs, match by language */
457-
if (cinfo && cinfo->codec == CCX_CODEC_DVB && cinfo->lang[0] && enc_ctx->dvb_lang[0])
456+
/* For DVB subtitles, match by language — skip non-DVB encoders */
457+
if (cinfo && cinfo->codec == CCX_CODEC_DVB && cinfo->lang[0])
458458
{
459-
if (enc_ctx->program_number == pn &&
459+
if (enc_ctx->dvb_lang[0] &&
460+
enc_ctx->program_number == pn &&
460461
strcmp(enc_ctx->dvb_lang, cinfo->lang) == 0)
461462
return enc_ctx;
462463
continue;
@@ -575,10 +576,16 @@ struct encoder_ctx *update_encoder_list_cinfo(struct lib_ccx_ctx *ctx, struct ca
575576
}
576577
// DVB related
577578
enc_ctx->prev = NULL;
578-
memset(enc_ctx->dvb_lang, 0, sizeof(enc_ctx->dvb_lang));
579-
if (cinfo)
580-
if (cinfo->codec == CCX_CODEC_DVB)
581-
enc_ctx->write_previous = 0;
579+
if (cinfo && cinfo->codec == CCX_CODEC_DVB && cinfo->lang[0])
580+
{
581+
strncpy(enc_ctx->dvb_lang, cinfo->lang, 3);
582+
enc_ctx->dvb_lang[3] = '\0';
583+
enc_ctx->write_previous = 0;
584+
}
585+
else
586+
{
587+
memset(enc_ctx->dvb_lang, 0, sizeof(enc_ctx->dvb_lang));
588+
}
582589
return enc_ctx;
583590
}
584591

0 commit comments

Comments
 (0)