Skip to content

[FIX] Accept --stream with one input file and without a timeout value - #2415

Open
Deepak-negi11 wants to merge 1 commit into
CCExtractor:masterfrom
Deepak-negi11:fix/stream-option
Open

Deepak-negi11 wants to merge 1 commit into
CCExtractor:masterfrom
Deepak-negi11:fix/stream-option

Conversation

@Deepak-negi11

Copy link
Copy Markdown
Contributor

In raising this pull request, I confirm the following (please check boxes):

Reason for this PR:

  • This PR adds new functionality.
  • This PR fixes a bug that I have personally experienced or that a real user has reported and for which a sample exists.
  • This PR is porting code from C to Rust.

Sanity check:

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • If the PR adds new functionality, I've added it to the changelog. If it's just a bug fix, I have NOT added it to the changelog.
  • I am NOT adding new C code unless it's to fix an existing, reproducible bug.

Repro instructions:

Sample: Closed Caption EIA.ts

./ccextractor --stream 2 "Closed Caption EIA.ts"
./ccextractor --stream "Closed Caption EIA.ts"

I found this while writing tests for #2408. --stream can't be used at all in the Rust parser:

  1. Any input file is refused. The check runs when the input list is not empty, so --stream 5 file.ts exits with "Live stream mode only supports one input file" (exit 3). The C parser only refuses more than one file.
  2. The timeout is required. In C the timeout is optional: the next argument is only the timeout if it is a number, and with no number there is no timeout (-1). Rust always takes the next argument, so --stream file.ts reads the file name as the timeout and exits with "Malformed parameter" (exit 7).
Command Before After
--stream 2 file.ts exit 3 exit 0, same 19 captions as a normal run
-s 2 file.ts exit 3 exit 0, same output
--stream file.ts exit 7 accepted, no timeout (waits for more data, as in C)
--stream 5 file.ts file.ts exit 3 exit 3 (unchanged, correct)

Changes:

  • normalize_legacy_args (lib.rs): if the argument after -s/--stream is not a number, use --stream=-1, which is the same rule as the C parser.
  • parse_parameters (parser.rs): a negative value means no timeout (live_stream = None, copied to C as -1), and the check now refuses only more than one input file.

Tests: 3 new tests. Each one fails if its half of the fix is removed.

Copilot AI balanced review requested due to automatic review settings October 20, 2026 20:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Deepak-negi11

Copy link
Copy Markdown
Contributor Author

Note: #2410 adds a test that checks every option has a test, and stream is on its list of options without one. Once both PRs are merged, that test fails until stream is removed from the list. Whichever PR is merged second, I'll update it to remove that entry.

@ccextractor-bot

Copy link
Copy Markdown
Collaborator
CCExtractor CI platform finished running the test files on linux. 11/237 tests matched the approved output:
Report Name Tests Passed
Broken 0/13
CEA-708 1/14
DVB 0/7
DVD 0/3
DVR-MS 0/2
General 0/27
Hardsubx 0/1
Hauppage 0/3
MP4 0/3
NoCC 10/10
Options 0/86
Teletext 0/21
WTV 0/13
XDS 0/34

226 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 9744, commit 0bf2a94:

  • 97 pass there and fail here
  • 0 fail there and pass here
  • 13 fail on both, with different output
  • 116 fail on both, byte for byte the same

Pass there, fail here:

Fail on both but produce different output — behaviour moved even though the verdict did not:

  • ccextractor --autoprogram --out=srt --latin1 --ucla d037c7509e...
  • ccextractor --out=spupng c83f765c66...
  • ccextractor --dru c83f765c66...
  • ccextractor --startat 4 --endat 7 c83f765c66...
  • ccextractor --codec dvbsub --out=spupng 85271be4d2...
  • ccextractor --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --startcreditsnotbefore 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --startcreditsnotafter 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --startcreditsforatleast 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --startcreditsforatmost 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9...
  • ccextractor --tpage 801 4e56e88ba4...
  • ccextractor --tverbose 4e56e88ba4...
  • ccextractor --teletext 4e56e88ba4...

Compared with the commit this branch was cut from — test 9750, commit d7eb132:

  • 115 pass there and fail here
  • 0 fail there and pass here
  • 15 fail on both, with different output
  • 96 fail on both, byte for byte the same

Pass there, fail here:

Fail on both but produce different output — behaviour moved even though the verdict did not:


This branch changes the behaviour of 110 test(s) relative to the tip of master. Those are the ones worth looking at; anything else in the list fails the same way on both sides.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants