mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-11-16 09:11:12 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -121,19 +121,25 @@ impl FromCType<ccx_decoder_dtvcc_settings> for DecoderDtvccSettings {
|
||||
{
|
||||
services_enabled[i] = flag != 0;
|
||||
}
|
||||
// Handle timing - use default if pointer is null to avoid losing other settings
|
||||
let timing = if settings.timing.is_null() {
|
||||
CommonTimingCtx::default()
|
||||
} else {
|
||||
CommonTimingCtx::from_ctype(settings.timing).unwrap_or_default()
|
||||
};
|
||||
|
||||
Some(DecoderDtvccSettings {
|
||||
enabled: settings.enabled != 0,
|
||||
print_file_reports: settings.print_file_reports != 0,
|
||||
no_rollup: settings.no_rollup != 0,
|
||||
report: if !settings.report.is_null() {
|
||||
Some(DecoderDtvccReport::from_ctype(settings.report)?)
|
||||
DecoderDtvccReport::from_ctype(settings.report)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
active_services_count: settings.active_services_count,
|
||||
services_enabled,
|
||||
timing: CommonTimingCtx::from_ctype(settings.timing)?,
|
||||
timing,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user