Skip to content

Commit 0a0c375

Browse files
committed
Fix bugs in --split-dvb-subs implementation
- Fix buffer offset: skip 2-byte header in multi-stream DVB path - Fix Rust build: use ts_cappids.is_empty() instead of nb_ts_cappid - Fix dangling pointer: set cfg to NULL after values are copied
1 parent f62c3e7 commit 0a0c375

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/lib_ccx/dvb_subtitle_decoder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ struct ccx_decoders_dvb_context *dvb_init_decoder(struct dvb_config *cfg, int in
582582
}
583583

584584
dvb_ctx->private_data = ctx;
585-
dvb_ctx->cfg = cfg;
585+
dvb_ctx->cfg = NULL; // Config values are copied into DVBSubContext, don't store pointer
586586
dvb_ctx->initialized_ocr = initialized_ocr;
587587

588588
return dvb_ctx;

src/lib_ccx/lib_ccx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,8 @@ int process_dvb_multi_stream(struct lib_ccx_ctx *ctx, struct demuxer_data *data,
561561
return -1;
562562
}
563563

564-
return route_dvb_stream_to_decoder(ctx, target_stream, data->buffer, data->len, sub);
564+
// Skip first 2 bytes (same as original dvbsub_decode path in general_loop.c)
565+
return route_dvb_stream_to_decoder(ctx, target_stream, data->buffer + 2, data->len - 2, sub);
565566
}
566567

567568
int route_dvb_stream_to_decoder(struct lib_ccx_ctx *ctx, struct ccx_stream_metadata *stream,

src/rust/src/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ impl OptionsExt for Options {
15671567
);
15681568
}
15691569

1570-
if self.demux_cfg.nb_ts_cappid > 0 {
1570+
if !self.demux_cfg.ts_cappids.is_empty() {
15711571
fatal!(
15721572
cause = ExitCause::IncompatibleParameters;
15731573
"Error: --split-dvb-subs cannot be used with manual PID selection (-pn).\n"

0 commit comments

Comments
 (0)