Skip to content

Commit 8f78a8b

Browse files
cfsmp3claude
andcommitted
fix(708): Handle null timing pointer in CEA-708 settings conversion
When converting CEA-708 decoder settings from C to Rust via from_ctype(), a null timing pointer would cause the entire conversion to fail and return None. This triggered the unwrap_or(default()) fallback, resetting critical settings like `enabled` and `services_enabled` to false/0. This caused CEA-708 captions to not be extracted (exit code 10) even when --service was specified, because the decoder's is_active flag was reset to 0 during demuxer initialization. The fix handles null timing pointer gracefully by using a default CommonTimingCtx instead of propagating None, preserving the other decoder settings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 87c8984 commit 8f78a8b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/rust/src/ctorust.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,25 @@ impl FromCType<ccx_decoder_dtvcc_settings> for DecoderDtvccSettings {
121121
{
122122
services_enabled[i] = flag != 0;
123123
}
124+
// Handle timing - use default if pointer is null to avoid losing other settings
125+
let timing = if settings.timing.is_null() {
126+
CommonTimingCtx::default()
127+
} else {
128+
CommonTimingCtx::from_ctype(settings.timing).unwrap_or_default()
129+
};
124130

125131
Some(DecoderDtvccSettings {
126132
enabled: settings.enabled != 0,
127133
print_file_reports: settings.print_file_reports != 0,
128134
no_rollup: settings.no_rollup != 0,
129135
report: if !settings.report.is_null() {
130-
Some(DecoderDtvccReport::from_ctype(settings.report)?)
136+
DecoderDtvccReport::from_ctype(settings.report)
131137
} else {
132138
None
133139
},
134140
active_services_count: settings.active_services_count,
135141
services_enabled,
136-
timing: CommonTimingCtx::from_ctype(settings.timing)?,
142+
timing,
137143
})
138144
}
139145
}

0 commit comments

Comments
 (0)