Refactor: Move demuxer-related options from global ccx_options to ccx_demuxer struct

Đang mở
#2,101 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@ansh27singh đang làm issue này rồi.

Từ ngày 21/2/2026.

  • #2102 của @AhmedAlian7 — đã đóng, không merge

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
c
Lĩnh vực
audio-video-rtc

Hướng nghiên cứu

Bắt đầu với struct ccx_demuxer trong src/lib_ccx/ccx_demuxer.h và phần khởi tạo của nó trong src/lib_ccx/ccx_demuxer.c. Theo dõi init_demuxer() và các hàm bị ảnh hưởng trong src/lib_ccx/file_functions.c, sau đó xác minh rằng bốn tùy chọn được khởi tạo trên demuxer và không còn được đọc từ ccx_options toàn cục ở đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem

Several functions in src/lib_ccx/file_functions.c rely on the global ccx_options struct for configuration values, specifically:

  • ccx_options.live_stream
  • ccx_options.buffer_input
  • ccx_options.input_source
  • ccx_options.binary_concat

This creates tight coupling between the demuxer logic and global application state.

Current Behavior

Functions such as:

  • buffered_read_opt()
  • switch_to_next_file()
  • ccx_demuxer_open()
  • ccx_demuxer_close()

directly access the global ccx_options struct instead of receiving configuration through the demuxer context.

Why This Is Problematic

  • Testability — Functions relying on globals are difficult to unit test in isolation.
  • Encapsulation — The demuxer's behavior depends on external state it does not own.
  • Thread safety — Global state increases the risk of race conditions in multi-threaded scenarios.
  • Library reuse — Tight coupling makes lib_ccx harder to use as a standalone library.

Proposed Solution

  • Add live_stream, buffer_input, input_source, and binary_concat fields to struct ccx_demuxer.
  • Initialize these fields from ccx_options during demuxer initialization (e.g., in init_demuxer()).
  • Update affected functions to read configuration from the demuxer context (ctx->) instead of the global ccx_options.

Affected Files

  • src/lib_ccx/ccx_demuxer.h
  • src/lib_ccx/ccx_demuxer.c
  • src/lib_ccx/file_functions.c
Ngôn ngữ chính
C
Star
913
Fork
603
Merge trung bình
1 ngày 10 giờ
Pull request đã merge (30 ngày)
24

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của CCExtractor/ccextractor

Tất cả issue của CCExtractor/ccextractor

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.