Carlos Fernandez Sanz 77daaddb9f [IMPROVEMENT] Remove dead seek guards in buffered_read_opt() (#2326)
* fix(file_functions): check the seek that can fail instead of one that cannot

buffered_read_opt()'s seek branch guarded against moving before the start of
the file with "op + bytes < 0". That could not fire: bytes is unsigned, so the
sum was evaluated unsigned and never went negative, and every caller passes a
forward distance anyway.

What can fail is LSEEK itself. On error it returns -1, and the code then
computed "np - op" from two error values and reported the result as a byte
count. Today that lands on 0 and the loop exits, so the observable behaviour is
unchanged -- but only by arithmetic accident, and the next reader has no way to
tell that the guard above it was inert.

Check what actually fails, and return the bytes copied so far rather than
inventing a distance from two failures.

Noted while reviewing the MSVC narrowing warnings for #2325, which flagged this
line as dead rather than wrong and left it out of that change deliberately.

* Remove dead seek guards in buffered_read_opt()

Both skip paths had "if (op + bytes < 0) return 0;". bytes is a
size_t, so the sum is unsigned and the check can never be true.
Removing it changes no behaviour; failed seeks are already handled
below each guard. Replaces the earlier early-return approach, which
changed how the buffered path handles a pipe that can't seek.
2026-11-11 08:08:12 -08:00
2026-01-05 12:44:06 +01:00
2026-01-05 12:44:06 +01:00
2026-02-02 14:19:03 +05:30
2016-12-13 14:32:35 +03:00
2021-04-04 16:07:12 -07:00

logo

CCExtractor

Sample-Platform Build Status Windows Sample-Platform Build Status Linux SourceForge GitHub All Releases

CCExtractor is a tool used to produce subtitles for TV recordings from almost anywhere in the world. We intend to keep up with all sources and formats.

Subtitles are important for many people. If you're learning a new language, subtitles are a great way to learn it from movies or TV shows. If you are hard of hearing, subtitles can help you better understand what's happening on the screen. We aim to make it easy to generate subtitles by using the command line tool or Windows GUI.

The official repository is (CCExtractor/ccextractor) and master being the most stable branch.

Features

  • Extract subtitles in real-time
  • Translate subtitles
  • Extract closed captions from DVDs
  • Convert closed captions to subtitles

Programming Languages & Technologies

The core functionality is written in C. Other languages used include C++ and Python.

Installation and Usage

Downloads for precompiled binaries and source code can be found on our website.

WebVTT Output Options

CCExtractor supports optional WebVTT-specific headers for advanced use cases such as HTTP Live Streaming (HLS).

--timestamp-map

Enable writing the X-TIMESTAMP-MAP header in WebVTT output.

This header is required for HLS workflows but is disabled by default to preserve compatibility with standard WebVTT players.

Example:

ccextractor input.ts --timestamp-map -o output.vtt

Windows Package Managers

WinGet:

winget install CCExtractor.CCExtractor

Chocolatey:

choco install ccextractor

Scoop:

scoop bucket add extras
scoop install ccextractor

Extracting subtitles is relatively simple. Just run the following command:

ccextractor <input>

This will extract the subtitles.

More usage information can be found on our website:

You can also find the list of parameters and their brief description by running ccextractor without any arguments.

You can find sample files on our website to test the software.

Building from Source

Linux (Autotools) build notes

CCExtractor also supports an autotools-based build system under the linux/ directory.

Important notes:

  • The autotools workflow lives inside linux/. The configure script is generated there and should be run from that directory.
  • Typical build steps are:
cd linux
./autogen.sh
./configure
make
  • Rust support is enabled automatically if cargo and rustc are available on the system. In that case, Rust components are built and linked during make.
  • If you encounter unexpected build or linking issues, a clean rebuild (make clean or a fresh clone) is recommended, especially when Rust is involved.

This build flow has been tested on Linux and WSL.

Compiling CCExtractor

To learn more about how to compile and build CCExtractor for your platform check the compilation guide.

Support

By far the best way to get support is by opening an issue at our issue tracker.

When you create a new issue, please fill in the needed details in the provided template. That makes it easier for us to help you more efficiently.

If you have a question or a problem you can also contact us by email or chat with the team in Slack.

If you want to contribute to CCExtractor but can't submit some code patches or issues or video samples, you can also donate to us

Contributing

You can contribute to the project by reporting issues, forking it, modifying the code and making a pull request to the repository. We have some rules, outlined in the contributor's guide.

News & Other Information

News about releases and modifications to the code can be found in the CHANGES.TXT file.

For more information visit the CCExtractor website: https://www.ccextractor.org

License

GNU General Public License version 2.0 (GPL-2.0)

Description
No description provided
Readme 336 MiB
Latest
2026-02-20 02:01:27 +00:00
Languages
C 67.5%
Rust 29.5%
Shell 0.8%
M4 0.6%
Makefile 0.5%
Other 0.9%