Repository navigation
[FIX] Preserve combined debug mask flags and sync Rust logger after CLI parsing - #2527
harshalsp07 wants to merge 1 commit into
Conversation
The Rust CLI parser replaced self.debug_mask on every debug flag (--debug, --608, --708, --goppts, --xdsdebug, --vides, --cbraw, --parsedebug, --parsePAT, --parsePMT, --dumpdef, --deblev, --debugdvbsub, --tverbose) instead of setting the requested bit. Passing multiple debug flags wiped out earlier ones, and passing any debug flag cleared the default GENERIC_NOTICE bit. In addition, ccxr_init_basic_logger() initializes CCExtractorLogger before argument parsing, and ccxr_update_logger_target() only updated the output target afterwards. As a result, Rust logger calls never saw parsed debug flags or --gui_mode_reports, and --708 never initialized the [CEA-708] env_logger output that the C parser previously started. Add DebugMessageMask::enable_flag() and use it across all 14 debug flags in OptionsExt::parse_parameters, sync debug_mask and gui_mode in ccxr_update_logger_target(), initialize the CEA-708 logger via try_init() when DECODER_708 is active and output is not quiet, and add Rust unit and C-FFI tests covering combined debug flags and logger syncing.
CCExtractor CI platform finished running the test files on linux. 171/238 tests matched the approved output:
67 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.
Compared with the tip of master — test 10180, commit 2c1c1c6:
Compared with the commit this branch was cut from: the same run as the tip of master (test 10180), so the comparison above already covers it. No test changes behaviour relative to the tip of master: every failure above fails there too, byte for byte. The approved output for those tests is out of date, which is a baseline to review rather than a regression in this branch. |
CCExtractor CI platform finished running the test files on windows. 171/238 tests matched the approved output:
67 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.
Compared with the tip of master — test 10179, commit f56427e:
Compared with the commit this branch was cut from — test 10181, commit 2c1c1c6:
No test changes behaviour relative to the tip of master: every failure above fails there too, byte for byte. The approved output for those tests is out of date, which is a baseline to review rather than a regression in this branch. |
In raising this pull request, I confirm the following (please check boxes):
Reason for this PR:
Sanity check:
Repro instructions:
Pass more than one debug option on a repository sample (for example
tests/samples/scc_23_976.scc):On
master, every debug flag insrc/rust/src/parser.rsreassignsself.debug_mask = DebugMessageMask::new(...)instead of setting its bit like Cparams.cused to. Because of that:--debug --608shows[Debug: No]in the config summary, and--parsedebug --parsePAT --parsePMT --608loses all earlier TS/parser traces).CCX_DMT_GENERIC_NOTICES(DebugMessageFlag::GENERIC_NOTICE) bit.ccxr_init_basic_logger()initializesCCExtractorLoggerbeforeccxr_parse_parameters(), andccxr_update_logger_target()only updatestargetafterwards, so Rust logger calls never see parseddebug_maskflags or--gui-mode-reports.--708no longer initializes the[CEA-708]env_loggeroutput (ccxr_init_logger()), so[CEA-708]log::debug!traces are never printed.Changes
src/rust/lib_ccxr/src/util/log.rs,src/rust/src/parser.rs):DebugMessageMask::enable_flag()to insert a flag into bothmask_on_normalandmask_on_debug.--debug,--608,--708,--goppts,--xdsdebug,--vides,--cbraw,--parsedebug,--parsePAT,--parsePMT,--dumpdef,--deblev,--debugdvbsub,--tverbose) inOptionsExt::parse_parametersto useenable_flag()instead of overwritingself.debug_mask.[CEA-708]init after CLI parsing (src/rust/src/libccxr_exports/mod.rs,src/rust/src/lib.rs):CCExtractorLogger::debug_mask(),set_debug_mask(), andset_gui_mode(), and updatedccxr_update_logger_target()to synctarget,debug_mask, andgui_modefromccx_options.ccxr_update_logger_target()to callccxr_init_logger()whenDECODER_708is active and output is not quiet (--quiet/--out=report), and switchedccxr_init_logger()from.init()to.try_init().src/rust/src/cli_tests.rs,src/rust/src/parser.rs,src/rust/lib_ccxr/src/util/log.rs,src/rust/src/libccxr_exports/mod.rs):enable_flag, logger setters,parse_output_target,parse_debug_masktruncation/fallback,should_init_cea708_logger, and combined debug flags.cli_tests.rscovering all 13 previously untested debug flags andccxr_update_logger_target()syncing.Testing
cargo fmt --manifest-path src/rust/Cargo.toml --all -- --checkandcargo fmt --manifest-path src/rust/lib_ccxr/Cargo.toml --all -- --check: passed.cargo clippy --manifest-path src/rust/lib_ccxr/Cargo.toml -- -D warningsandcargo clippy --manifest-path src/rust/Cargo.toml -- -D warnings: passed.cargo test --manifest-path src/rust/lib_ccxr/Cargo.toml: 59 unit tests + 46 doc-tests passed.cargo test --manifest-path src/rust/Cargo.toml: 454 tests passed.--debug --608ontests/samples/scc_23_976.scc,--parsedebug --parsePAT --parsePMT --608on a synthetic TS stream, and--708 --goppts(with and without--quiet) on a synthetic MPEG-2 ES withGA94CEA-708 user data.