CCExtractor - Official version maintained by the core team
Go to file
kdrag0n 732b20aefa
[FIX] Clang warning fixes (#1205)
* file_buffer: Fix unitialized variable usage warning

Clang warns:

In file included from src/lib_ccx/asf_functions.c:5:
src/lib_ccx/file_buffer.h:76:7: warning: variable 'result' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                if (buffer)
                    ^~~~~~
src/lib_ccx/file_buffer.h:86:9: note: uninitialized use occurs here
        return result;
               ^~~~~~
src/lib_ccx/file_buffer.h:76:3: note: remove the 'if' if its condition is always true
                if (buffer)
                ^~~~~~~~~~~
src/lib_ccx/file_buffer.h:73:15: note: initialize the variable 'result' to silence this warning
        size_t result;
                     ^
                      = 0

* common_timing: Fix uninitialized variable usage warning

The vast majority of the code is already using fatal(), so I don't see
why this should be an exception.

Clang warns:

src/lib_ccx/ccx_common_timing.c:274:3: warning: variable 'fts' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
                default:
                ^~~~~~~
src/lib_ccx/ccx_common_timing.c:280:9: note: uninitialized use occurs here
        return fts;
               ^~~
src/lib_ccx/ccx_common_timing.c:261:11: note: initialize the variable 'fts' to silence this warning
        LLONG fts;
                 ^
                  = 0

* encoders: Fix handling of multibyte characters in UTF-8 converter

This is actually incorrect because characters longer than 1 byte will be
butchered.

Clang warns:

src/lib_ccx/ccx_encoders_common.c:178:12: warning: result of comparison of constant 256 with expression of
type 'unsigned char' is always true [-Wtautological-constant-out-of-range-compare]
                                        if (c < 256)
                                            ~ ^ ~~~
src/lib_ccx/ccx_encoders_common.c:193:12: warning: result of comparison of constant 256 with expression of
type 'unsigned char' is always true [-Wtautological-constant-out-of-range-compare]
                                        if (c < 256)
                                            ~ ^ ~~~
src/lib_ccx/ccx_encoders_common.c:209:12: warning: result of comparison of constant 256 with expression of
type 'unsigned char' is always true [-Wtautological-constant-out-of-range-compare]
                                        if (c < 256)
                                            ~ ^ ~~~
src/lib_ccx/ccx_encoders_common.c:229:12: warning: result of comparison of constant 256 with expression of type 'unsigned char' is always true [-Wtautological-constant-out-of-range-compare]
                                        if (c < 256)
                                            ~ ^ ~~~

* gxf: Fix tautological comparison warnings

Clang warns:

src/lib_ccx/ccx_gxf.c:425:17: warning: result of comparison of constant 256 with expression of type 'unsigned char' is always false [-Wtautological-constant-out-of-range-compare]
                                if (tag_len > STR_LEN)
                                    ~~~~~~~ ^ ~~~~~~~
src/lib_ccx/ccx_gxf.c:542:17: warning: result of comparison of constant 256 with expression of type 'unsigned char' is always false [-Wtautological-constant-out-of-range-compare]
                                if (tag_len > STR_LEN)
                                    ~~~~~~~ ^ ~~~~~~~
src/lib_ccx/ccx_gxf.c:617:17: warning: result of comparison of constant 256 with expression of type 'unsigned char' is always false [-Wtautological-constant-out-of-range-compare]
                                if (tag_len > STR_LEN)
                                    ~~~~~~~ ^ ~~~~~~~

* gxf: Fix uninitialized variable usage warnings

Clang warns:

src/lib_ccx/ccx_gxf.c:1449:8: warning: variable 'first_field_nb' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
                case TRACK_TYPE_MPEG1_525:
                     ^~~~~~~~~~~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:1475:35: note: uninitialized use occurs here
        debug("first field number %d\n", first_field_nb);
                                         ^~~~~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:28:115: note: expanded from macro 'debug'
                                                                                                                  ^~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:1450:8: warning: variable 'first_field_nb' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
                case TRACK_TYPE_MPEG2_525:
                     ^~~~~~~~~~~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:1475:35: note: uninitialized use occurs here
        debug("first field number %d\n", first_field_nb);
                                         ^~~~~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:28:115: note: expanded from macro 'debug'
                                                                                                                  ^~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:1456:3: warning: variable 'first_field_nb' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
                default:
                ^~~~~~~
src/lib_ccx/ccx_gxf.c:1475:35: note: uninitialized use occurs here
        debug("first field number %d\n", first_field_nb);
                                         ^~~~~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:28:115: note: expanded from macro 'debug'
                                                                                                                  ^~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:1410:30: note: initialize the variable 'first_field_nb' to silence this warning
        unsigned char first_field_nb;
                                    ^
                                     = '\0'
src/lib_ccx/ccx_gxf.c:1449:8: warning: variable 'last_field_nb' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
                case TRACK_TYPE_MPEG1_525:
                     ^~~~~~~~~~~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:1476:34: note: uninitialized use occurs here
        debug("last field number %d\n", last_field_nb);
                                        ^~~~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:28:115: note: expanded from macro 'debug'
                                                                                                                  ^~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:1450:8: warning: variable 'last_field_nb' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
                case TRACK_TYPE_MPEG2_525:
                     ^~~~~~~~~~~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:1476:34: note: uninitialized use occurs here
        debug("last field number %d\n", last_field_nb);
                                        ^~~~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:28:115: note: expanded from macro 'debug'
                                                                                                                  ^~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:1456:3: warning: variable 'last_field_nb' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
                default:
                ^~~~~~~
src/lib_ccx/ccx_gxf.c:1476:34: note: uninitialized use occurs here
        debug("last field number %d\n", last_field_nb);
                                        ^~~~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:28:115: note: expanded from macro 'debug'
                                                                                                                  ^~~~~~~~~~~
src/lib_ccx/ccx_gxf.c:1411:29: note: initialize the variable 'last_field_nb' to silence this warning
        unsigned char last_field_nb;
                                   ^
                                    = '\0'

* ts_functions: Fix incorrect enumeration type in get_buffer_type

Clang warns:

src/lib_ccx/ts_functions.c:127:10: warning: implicit conversion from enumeration type 'enum ccx_bufferdata_type' to different enumeration type 'enum ccx_stream_type' [-Wenum-conversion]
                return CCX_PES;
                ~~~~~~ ^~~~~~~
src/lib_ccx/ts_functions.c:131:10: warning: implicit conversion from enumeration type 'enum ccx_bufferdata_type' to different enumeration type 'enum ccx_stream_type' [-Wenum-conversion]
                return CCX_H264;
                ~~~~~~ ^~~~~~~~
src/lib_ccx/ts_functions.c:135:10: warning: implicit conversion from enumeration type 'enum ccx_bufferdata_type' to different enumeration type 'enum ccx_stream_type' [-Wenum-conversion]
                return CCX_DVB_SUBTITLE;
                ~~~~~~ ^~~~~~~~~~~~~~~~
src/lib_ccx/ts_functions.c:139:10: warning: implicit conversion from enumeration type 'enum ccx_bufferdata_type' to different enumeration type 'enum ccx_stream_type' [-Wenum-conversion]
                return CCX_ISDB_SUBTITLE;
                ~~~~~~ ^~~~~~~~~~~~~~~~~
src/lib_ccx/ts_functions.c:143:10: warning: implicit conversion from enumeration type 'enum ccx_bufferdata_type' to different enumeration type 'enum ccx_stream_type' [-Wenum-conversion]
                return CCX_HAUPPAGE;
                ~~~~~~ ^~~~~~~~~~~~
src/lib_ccx/ts_functions.c:147:10: warning: implicit conversion from enumeration type 'enum ccx_bufferdata_type' to different enumeration type 'enum ccx_stream_type' [-Wenum-conversion]
                return CCX_TELETEXT;
                ~~~~~~ ^~~~~~~~~~~~
src/lib_ccx/ts_functions.c:151:10: warning: implicit conversion from enumeration type 'enum ccx_bufferdata_type' to different enumeration type 'enum ccx_stream_type' [-Wenum-conversion]
                return CCX_PRIVATE_MPEG2_CC;
                ~~~~~~ ^~~~~~~~~~~~~~~~~~~~
src/lib_ccx/ts_functions.c:155:10: warning: implicit conversion from enumeration type 'enum ccx_bufferdata_type' to different enumeration type 'enum ccx_stream_type' [-Wenum-conversion]
                return CCX_PES;
                ~~~~~~ ^~~~~~~
src/lib_ccx/ts_functions.c:491:24: warning: implicit conversion from enumeration type 'enum ccx_stream_type' to different enumeration type 'enum ccx_bufferdata_type' [-Wenum-conversion]
        ptr->bufferdatatype = get_buffer_type(cinfo);
                            ~ ^~~~~~~~~~~~~~~~~~~~~~

* utility: Fix tautological comparison warnings

Clang warns:

src/lib_ccx/utility.c:605:24: warning: result of comparison of constant 65536 with expression of type 'unsigned short' is always true [-Wtautological-constant-out-of-range-compare]
        } else if (utf16_char < 0x010000) {
                   ~~~~~~~~~~ ^ ~~~~~~~~
src/lib_ccx/utility.c:610:24: warning: result of comparison of constant 1114112 with expression of type 'unsigned short' is always true [-Wtautological-constant-out-of-range-compare]
        } else if (utf16_char < 0x110000) {
                   ~~~~~~~~~~ ^ ~~~~~~~~

* ocr: Fix floating point -> integer abs() warning

Clang warns:

src/lib_ccx/ocr.c:529:8: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
                                if(abs(h-h0)>50) // Color has changed
                                   ^
src/lib_ccx/ocr.c:529:8: note: use function 'fabsf' instead
                                if(abs(h-h0)>50) // Color has changed
                                   ^~~
                                   fabsf
src/lib_ccx/ocr.c:529:8: note: include the header <math.h> or explicitly provide a declaration for 'fabsf'

* encoders: Fix incorrect string types when EIA-608 is in use

Clang warns:

src/lib_ccx/ccx_encoders_helpers.c: In function ‘clever_capitalize’:
src/lib_ccx/ccx_encoders_helpers.c:186:4: warning: case label value exceeds maximum value for type
  186 |    case 0x89: // This is a transparent space
      |    ^~~~

* ocr: Fix implicit struct declaration warning

Clang warns:

In file included from src/lib_ccx/dvd_subtitle_decoder.c:10:
src/lib_ccx/ocr.h:18:54: warning: ‘struct encoder_ctx’ declared inside parameter list will not be visible outside of this definition or declaration
   18 | char *paraof_ocrtext(struct cc_subtitle *sub, struct encoder_ctx *context);
      |                                                      ^~~~~~~~~~~
2020-01-29 21:39:40 -08:00
.github Cmake with OCR and Hardsubx in different job 2020-01-19 20:30:04 +00:00
api [FIX] GCC warning fixes (#1204) 2020-01-23 18:49:16 -08:00
Dictionary Move show specific dictionaries to separate repo. (#891) 2018-01-09 12:14:18 -08:00
docs Update CHANGES.TXT 2020-01-25 15:35:34 -08:00
fonts Add GUI for CCExtractor (GSoC 2017) (#794) 2017-10-11 14:11:39 -07:00
gsoc/skrill Python bindings with extraction of CE608 grid and writing to a SRT output. (#768) 2017-08-20 08:54:35 -07:00
icon Add GUI for CCExtractor (GSoC 2017) (#794) 2017-10-11 14:11:39 -07:00
linux [FIX] GCC warning fixes (#1204) 2020-01-23 18:49:16 -08:00
mac [FIX] GCC warning fixes (#1204) 2020-01-23 18:49:16 -08:00
OpenBSD Update Makefile 2019-05-21 20:41:08 +02:00
package_creators Update PKGBUILD 2019-05-21 20:34:41 +02:00
src [FIX] Clang warning fixes (#1205) 2020-01-29 21:39:40 -08:00
tests Remove SBS stuff from decoder_init 2017-01-15 23:55:41 +05:00
tools [FIX] #995 for All platforms and removed the icons folder in source package (#1057) 2018-12-25 23:08:06 +01:00
windows Applied clang formatting to our .c files. Tried to leave everyone else's alone. 2020-01-25 13:29:18 -08:00
.gitignore **[FIX]** Fix typos; **[IMPROVEMENT]** Update .gitignore for Visual Studio databases (#1052) 2018-12-11 12:29:21 -08:00
.travis.yml [FIX] Travis build for macOS. Also add cmake build test. (#1063) 2019-03-23 15:24:42 -07:00
LICENSE.txt [IMPROVEMENT] Add LICENSE File (#959) 2018-03-12 11:19:47 -07:00
README.md Add TV Samples to README 2019-12-02 16:56:33 +08:00
Vagrantfile Added Vagrantfile 2016-12-13 14:32:35 +03:00

logo

CCExtractor

Build Status 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.

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 website to test the software.

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)