Refactor/move demuxer options to struct #2102
Open
+57
−43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[IMPROVEMENT]
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
closes #2101
Summary
Resolves the TODO in
file_functions.c:311by encapsulating demuxer-related options within the ccx_demuxer struct instead of accessing the globalccx_options.Problem
Multiple functions directly accessed global
ccx_optionsfor 4 options that logically belong to the demuxer context:live_stream- Live stream mode and timeoutbuffer_input- Whether to buffer input datainput_source- Source type (file, stdin, network, tcp)binary_concat- Whether to concatenate binary filesThis caused issues with testability, encapsulation, thread safety, and library reusability.
Changes
src/lib_ccx/ccx_demuxer.h
Added 4 new fields to
struct ccx_demuxer:src/lib_ccx/ccx_demuxer.c
init_demuxer() - Initialize new fields from global options:
ccx_demuxer_close() - Updated to use
ctx->input_source.ccx_demuxer_open() - Updated all input source checks to use
ctx->input_source.src/lib_ccx/file_functions.c
sleepandchecktimeout() - Added
ctxparameter.buffered_read_opt() - Updated all 4 options to use
ctx->.get_total_file_size() - Updated to use
ctx->demux_ctx->live_stream.switch_to_next_file() - Updated all options to use
ctx->demux_ctx->.Testing
makein linux directory)ccextractor --version)Impact
ccx_optionsat demuxer creation