Commit Graph

2284 Commits

Author SHA1 Message Date
Willem
cf828471d6
Fix Windows build pipeline
warrenbuckley/Setup-MSBuild has been deprecated in favour of microsoft/setup-msbuild, which includes a fix for the failure of the build pipelines (refer to https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/)
2020-12-21 10:26:56 +01:00
MackeyStingray
cf84757e02
Fix hardsubx segmentation fault (#1280) 2020-09-13 10:10:02 -07:00
Nils
f486efbb57
[FIX] -Wunused-result warnings (#1269)
* Fix -Wunused-result warnings

* Wrap checked writes into a function

* In write_wrapped, continue writing in case of partial write

If a partial write occurs, it doesn't necessarily mean that something
failed, according to write(2). If this is the case, then the following
write will return -1.

* Fix build on MSVC

https://stackoverflow.com/questions/37460579/error-c2036-void-unknown-size
2020-06-28 14:29:35 -07:00
Nils
0db5b0c838
[Formatting] Remove trailing whitespace (#1270) 2020-05-20 15:09:00 +02:00
hamelg
e411a75dcd
[FIX] Disable BOM in non-Windows build (#1268)
* Disable BOM in non-Windows build

* Disable BOM in non-Windows build
2020-05-09 15:21:45 -07:00
hamelg
33ecccedce
[FIX] Allow all oem modes with tesseract v4 (#1267)
* Allow all oem modes with tesseract v4

* Allow all oem modes with tesseract v4

* Fix formatting
2020-05-08 14:52:47 -07:00
Willem
28dd35b040
Add DLL's to artifact (#1263)
Expands the Windows build steps to include DLL's in the artifact, making an out-of-box use of said artifacts easier. The new artifacts will allow running ccextractor (not the GUI yet) directly.
2020-04-28 22:31:15 +02:00
Willem
e82a492c94
Update build_windows.yml
Add version information for all builds
2020-04-26 21:09:19 +02:00
Willem
4509b9daf5
Update build_windows.yml 2020-04-26 21:04:09 +02:00
Willem
d330b78f37
Update build_windows.yml 2020-04-26 20:54:19 +02:00
Willem
ab89f88aea
Update build_windows.yml
Add a build information on the release build.
2020-04-26 20:50:09 +02:00
Willem
0227c2787a
Update build_linux.yml
Correct path for version check for building with cmake
2020-04-26 20:48:25 +02:00
Willem
84dec36845
Update build_linux.yml
Add version information step on all Linux builds
2020-04-26 20:42:44 +02:00
Willem
b4f692807a
Update build_linux.yml
Add a step to show version information
2020-04-26 20:38:59 +02:00
apovalyaev
1f5ec6cd8d
Update VS project build settings (issue #1254) (#1261)
Improves the build for 32 bit variants.

Contains fixes:
- `/SAFESEH:NO`: needed for linking precompiled ffmpeg-lib libraries
- add paths from $(ProjectDir)libs\lib\ffmpeg-lib and avcodec.lib; avformat.lib; avutil.lib; swscale.lib
- add extra post-build actions to copy libraries
- add $(vcpkg) paths
2020-04-25 17:13:33 +02:00
Willem
6f375cd9b3
Update build_windows.yml
Split up artifacts for easier re-use; ensure paths are correct.
2020-04-25 13:00:27 +02:00
Willem
e959654c6f
Update build_windows.yml
Fix wrong paths
2020-04-25 12:39:06 +02:00
Willem
18484d555f
Add OCR build to Windows action
Adds a (likely non-working) build stage for building with OCR to the Windows GitHub actions, so we can assure that Windows keeps building with OCR just fine.
2020-04-25 12:32:04 +02:00
Carlos Fernandez Sanz
1534d81ae7 Added new utf8proc location to Windows project 2020-04-12 15:13:48 -07:00
Nils
84b5df2713
Mention where to send private invitation in the ISSUE_TEMPLATE (#1253)
Makes a small update to the ISSUE_TEMPLATE to clarify instructions for sending samples that cannot be made public.

Co-authored-by: Willem <github@canihavesome.coffee>
2020-04-07 13:55:49 +02:00
Anshul Maheshwari
8e729cc62c
Merge pull request #1246 from anshul1912/master
put check for DVB duration with pagetimeout
2020-03-30 22:35:04 +05:30
Willem
0f1f4d889f
Apply suggestions from code review 2020-03-29 22:22:49 +02:00
Willem
487b521c9b
Merge branch 'master' into master 2020-03-29 22:19:26 +02:00
Willem
1aed90e42c
[IMPROVEMENT] Apply clang-format to all remaining files (#1247)
Apply clang-format to all files aside from the icon file in the GUI and modify the action appropriately.
2020-03-29 22:16:39 +02:00
Anshul Maheshwari
e2d387bfa9 put check for DVB duration with pagetimeout 2020-03-28 22:26:40 +05:30
Nils
b974a7ed81
Remove installation of clang (#1244)
This is possible thanks to
https://github.com/actions/virtual-environments/pull/447
2020-03-20 13:08:19 +01:00
vishwesh-D-kumar
522ebae65e
[FIX] Fixed paths in MakeFile, fixing the AutoConf compile error (#1242)
Closes #1241. 

Co-authored-by: Willem <github@canihavesome.coffee>
2020-03-03 20:50:55 +01:00
Willem
1b17a04b25
[FIX] Fix Mac build error for reproducible builds (#1232)
* Fix Mac build error for reproducible builds
* Shorten solution with vr8hub's suggestion

Closes #1230
2020-02-16 01:08:21 +01:00
Willem
588c4a8187
Merge pull request #1231 from NilsIrl/remove_branch_specification
[IMPROVEMENT] Remove the need for the push to be on the master branch
2020-02-15 23:50:34 +01:00
Nils André-Chang
88830e6c58 Remove the need for the push to be on the master branch
This is because contributors don't have branches called master it isn't
possible to manually trigger workflows as suggested by
https://github.community/t5/GitHub-Actions/GitHub-Actions-Manual-Trigger-Approvals/m-p/31517.

Also removed the workflow file from the path as it is implicitely set.
2020-02-15 22:12:55 +00:00
Carlos Fernandez Sanz
db646f50ac
Update ISSUE_TEMPLATE.md 2020-02-12 17:39:12 -08:00
Nils
b1c9540085
[IMPROVEMENT] Comment out issue (#1178)
* [ISSUE_TEMPLATE.md] Comment out instructions

* [PULL_REQUEST_TEMPLATE.md] Comment out instructions

* Mention in ISSUE_TEMPLATE.md that only useful arguments should be put

* Follow feedback
2020-02-12 17:36:05 -08:00
Nils
e98137e059
[FIX] Fix tags displaying incorrectly (#1229)
This was caused by 19241744d7, moving from
`unsigned char` to `enums` for colors and fonts. The problem with this is
that each colour isn't one byte next to each other so memcpy and memset
didn't work anymore.

The problem:

```patch
6812,6813c6812,6813
< EDITION OF AMERICA'S NEXT TOP
< <i> MODEL</i> ON WEDNESDAYS.<i>          </i>
---
> EDITION OF<i> AMERICA'S NEXT TOP</i>
> <i> MODEL</i> ON WEDNESDAYS.
6817c6817
< EDITION OF AMERICA'S NEXT TOP
---
> EDITION OF<i> AMERICA'S NEXT TOP</i>
6819c6819
< >><i> THE VAMPIRE DIARIES         </i>
---
> >><i> THE VAMPIRE DIARIES</i>
6824,6825c6824,6825
< >><i> THE VA</i>MPIRE DIARIES
< AND<i> THE SECRET CIRCLE          </i>
---
> >><i> THE VAMPIRE DIARIES</i>
> AND<i> THE SECRET CIRCLE</i>
6829,6831c6829,6831
< >><i> THE VA</i>MPIRE DIARIES
< AND<i> THE S</i>ECRET CIRCLE
< ON THURSDAYS.<i>                  </i>
---
> >><i> THE VAMPIRE DIARIES</i>
> AND<i> THE SECRET CIRCLE</i>
> ON THURSDAYS.
6835c6835
< AND<i> THE S</i>ECRET CIRCLE
---
> AND<i> THE SECRET CIRCLE</i>
```
2020-02-12 15:01:15 -08:00
Willem
3c37d49764 Merge pull request #1228 from CCExtractor/canihavesomecoffee-patch-1
[FIX] Remove Windows XP workaround
2020-02-08 21:01:54 +01:00
Willem
a8d6b81baf
Remove Windows XP workaround
Removes the workaround that was put in place while waiting for actions/virtual-environments#288 to being fixed.
2020-02-08 20:56:45 +01:00
Willem
b8321cac0f
Finetune formatting action
Only trigger action when the action is edited, or when source code is actually being changed.
2020-02-08 20:52:36 +01:00
Ed Marshall
6697ed3496
[FIX] Fix multiple definitions with new -fno-common default in GCC 10 (#1226)
* Fix multiple definitions with new -fno-common default in GCC 10

* Add GCC 10 fix to changelog
2020-02-01 22:26:48 -08:00
Nils ANDRÉ-CHANG
722d52420c
[IMPROVEMENT] Clang format (#1222)
* Add .clang-format

* Add clang-format github action

* Set more explicit name to GitHub workflow

Co-Authored-By: Willem <github@canihavesome.coffee>

Co-authored-by: Willem <github@canihavesome.coffee>
2020-01-30 09:00:00 -08:00
Nils ANDRÉ-CHANG
af6d8282cb
[IMPROVEMENT] Move dependencies to a third party directory (#1219)
* Move dependencies in a folder

* Windows

* MacOS
2020-01-30 04:58:37 -08:00
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
Nils ANDRÉ-CHANG
54318d0402
Allow the user the choose between CRLF and LF (#1220)
Defaults to CRLF
2020-01-28 21:18:10 -08:00
kdrag0n
5f61fae0c7 scc: Switch to CRLF line endings (#1209)
All the SCC and CCD examples I can find have CRLF line endings. VLC and
libavformat (used by MPV) don't care, so just go with the popular
convention and switch to CRLF. There's no reason a user would want to
choose their line endings in this scenario.
2020-01-25 19:33:22 -08:00
kdrag0n
0afba56a26 scc: Implement colors (#1213) 2020-01-25 16:16:00 -08:00
Carlos Fernandez Sanz
0873953d9f
Update CHANGES.TXT 2020-01-25 15:35:34 -08:00
Carlos Fernandez Sanz
75af5f2e8c Applied clang formatting to our .c files. Tried to leave everyone else's alone. 2020-01-25 13:29:18 -08:00
Nils ANDRÉ-CHANG
8d8dc9ccc2 Improve and simplify dprintf implementation (#1185)
It now returns a value like the rest of the printf family. It doesn't
brute force the amount of memory that needs to be allocated.

It also removes a warning.

I do not believe there should be any performance concerns with this
implementation as it is what `glibc` does:

https://code.woboq.org/userspace/glibc/libio/iovdprintf.c.html
2020-01-24 23:58:44 -08:00
Nils ANDRÉ-CHANG
e37a21aace Fix longer subtitles (#1216) 2020-01-23 19:05:19 -08:00
Nils ANDRÉ-CHANG
40a603d366 Fix documentation (#1218) 2020-01-23 18:49:58 -08:00
kdrag0n
c5bed1e3b2 [FIX] GCC warning fixes (#1204)
* cea708: Fix missing new line in log message

* subtype: Remove unused CC_708 type

CEA-708 inputs are coerced to CC_608 before hitting encode_sub.

GCC warns:

src/lib_ccx/ccx_encoders_common.c: In function ‘encode_sub’:
src/lib_ccx/ccx_encoders_common.c:1119:2: warning: enumeration value ‘CC_708’ not handled in switch [-Wswitch]
 1119 |  switch (sub->type)
      |  ^~~~~~

* build: Disable pointer-sign warning

This warning triggers all over the codebase due to the widespread use of
unsigned char arrays for parsed subtitle strings and them being passed
to string functions that expect signed ones. Since this won't actually
cause issues, silence the warning across the entire codebase.

* splitbysentence: Fix warnings

GCC warns:

src/lib_ccx/ccx_encoders_splitbysentence.c: In function ‘sbs_is_pointer_on_sentence_breaker’:
src/lib_ccx/ccx_encoders_splitbysentence.c:170:7: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
  170 |  char p = *(current - 1);
      |       ^
src/lib_ccx/ccx_encoders_splitbysentence.c: In function ‘sbs_find_insert_point_partial’:
src/lib_ccx/ccx_encoders_splitbysentence.c:231:1: warning: multi-line comment [-Wcomment]
  231 | //   sprintf(fmtbuf, "SBS: sbs_find_insert_point_partial: compare\n\
      | ^
src/lib_ccx/ccx_encoders_splitbysentence.c:263:1: warning: multi-line comment [-Wcomment]
  263 | //   LOG_DEBUG("SBS: sbs_find_insert_point_partial: LEFT CHANGED,\n\tbuf:[%s]\n\tstr:[%s]\n\
      | ^
src/lib_ccx/ccx_encoders_splitbysentence.c:297:1: warning: multi-line comment [-Wcomment]
  297 | //   sprintf(fmtbuf, "SBS: sbs_find_insert_point_partial: REPLACE ENTIRE TAIL !!\n\
      | ^
src/lib_ccx/ccx_encoders_splitbysentence.c:222:6: warning: unused variable ‘i’ [-Wunused-variable]
  222 |  int i; // top level indexer for strings
      |      ^
src/lib_ccx/ccx_encoders_splitbysentence.c: In function ‘reformat_cc_bitmap_through_sentence_buffer’:
src/lib_ccx/ccx_encoders_splitbysentence.c:730:8: warning: unused variable ‘str’ [-Wunused-variable]
  730 |  char *str;
      |        ^~~
src/lib_ccx/ccx_encoders_splitbysentence.c:729:6: warning: unused variable ‘i’ [-Wunused-variable]
  729 |  int i = 0;
      |      ^
src/lib_ccx/ccx_encoders_splitbysentence.c:728:6: warning: unused variable ‘used’ [-Wunused-variable]
  728 |  int used;
      |      ^~~~
src/lib_ccx/ccx_encoders_splitbysentence.c:727:18: warning: unused variable ‘ms_end’ [-Wunused-variable]
  727 |  LLONG ms_start, ms_end;
      |                  ^~~~~~
src/lib_ccx/ccx_encoders_splitbysentence.c:727:8: warning: unused variable ‘ms_start’ [-Wunused-variable]
  727 |  LLONG ms_start, ms_end;
      |        ^~~~~~~~
src/lib_ccx/ccx_encoders_splitbysentence.c:726:20: warning: unused variable ‘rect’ [-Wunused-variable]
  726 |  struct cc_bitmap* rect;
      |                    ^~~~

* spupng: Fix warnings

GCC warns:

src/lib_ccx/ccx_encoders_spupng.c: In function ‘init_face’:
src/lib_ccx/ccx_encoders_spupng.c:644:6: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
  644 |  if (error = FT_New_Face(ft_library, font, 0, face))
      |      ^~~~~
src/lib_ccx/ccx_encoders_spupng.c:651:6: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
  651 |  if (error = FT_Set_Pixel_Sizes(*face, 0, FONT_SIZE))
      |      ^~~~~
src/lib_ccx/ccx_encoders_spupng.c: In function ‘spupng_export_string2png’:
src/lib_ccx/ccx_encoders_spupng.c:698:7: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
  698 |   if (error = FT_Init_FreeType(&ft_library))
      |       ^~~~~
src/lib_ccx/ccx_encoders_spupng.c:706:6: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
  706 |  if (error = init_face(&face_regular, ccx_options.enc_cfg.render_font))
      |      ^~~~~
src/lib_ccx/ccx_encoders_spupng.c:708:6: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
  708 |  if (error = init_face(&face_italics, ccx_options.enc_cfg.render_font_italics))
      |      ^~~~~
src/lib_ccx/ccx_encoders_spupng.c:850:9: warning: unused variable ‘height’ [-Wunused-variable]
  850 |     int height = slot->bitmap.rows;
      |         ^~~~~~
src/lib_ccx/ccx_encoders_spupng.c:849:9: warning: unused variable ‘width’ [-Wunused-variable]
  849 |     int width = slot->bitmap.width;
      |         ^~~~~
src/lib_ccx/ccx_encoders_webvtt.c: In function ‘write_webvtt_header’:
src/lib_ccx/ccx_encoders_webvtt.c:263:1: warning: control reaches end of non-void function [-Wreturn-type]
  263 | }
      | ^

* webvtt: Fix missing return warning

The return value of this function is never used, so just drop the
values.

GCC warns:

src/lib_ccx/ccx_encoders_webvtt.c: In function ‘write_webvtt_header’:
src/lib_ccx/ccx_encoders_webvtt.c:263:1: warning: control reaches end of non-void function [-Wreturn-type]
  263 | }
      | ^

* gxf: Fix MIN macro redefinition warning

GCC warns:

src/lib_ccx/ccx_gxf.c:23: warning: "MIN" redefined
   23 | #define MIN(a, b) ( (a < b) ? a : b)
      |
In file included from src/lib_ccx/ccx_demuxer.h:8,
                 from src/lib_ccx/ccx_gxf.h:4,
                 from src/lib_ccx/ccx_gxf.c:13:
src/lib_ccx/utility.h:8: note: this is the location of the previous definition
    8 | #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
      |

* dvd: Fix unused variable warnings

GCC warns:

src/lib_ccx/dvd_subtitle_decoder.c: In function ‘get_bitmap’:
src/lib_ccx/dvd_subtitle_decoder.c:133:9: warning: unused variable ‘discard’ [-Wunused-variable]
  133 |     int discard = get_bits(ctx, &nextbyte, &pos, &m);
      |         ^~~~~~~
src/lib_ccx/dvd_subtitle_decoder.c:172:9: warning: unused variable ‘discard’ [-Wunused-variable]
  172 |     int discard = get_bits(ctx, &nextbyte, &pos, &m);
      |         ^~~~~~~
src/lib_ccx/dvd_subtitle_decoder.c: In function ‘write_dvd_sub’:
src/lib_ccx/dvd_subtitle_decoder.c:320:6: warning: unused variable ‘ret’ [-Wunused-variable]
  320 |  int ret =0;
      |      ^~~

* es_functions: Fix unused variable warning

This also removes the stale commented code that used this variable.

GCC warns:

src/lib_ccx/es_functions.c: In function ‘read_pic_info’:
src/lib_ccx/es_functions.c:682:7: warning: unused variable ‘frame_type_to_char’ [-Wunused-variable]
  682 |  char frame_type_to_char[] = { '?', 'I', 'P','B', 'D', '?', '?','?' };
      |       ^~~~~~~~~~~~~~~~~~

* dvb: Fix unused variable warning when OCR is disabled

GCC warns:

src/lib_ccx/dvb_subtitle_decoder.c: In function ‘write_dvb_sub’:
src/lib_ccx/dvb_subtitle_decoder.c:1509:6: warning: unused variable ‘ret’ [-Wunused-variable]
 1509 |  int ret = 0;
      |      ^~~

* general_loop: Fix warnings

GCC warns:

src/lib_ccx/general_loop.c: In function ‘general_loop’:
src/lib_ccx/general_loop.c:1113:15: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
 1113 |      (enc_ctx && (enc_ctx->srt_counter || enc_ctx->cea_708_counter) ||
      |       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
src/lib_ccx/general_loop.c:25:28: warning: ‘DO_NOTHING’ defined but not used [-Wunused-const-variable=]
   25 | const static unsigned char DO_NOTHING[] = {0x80, 0x80};
      |                            ^~~~~~~~~~

* networking: Fix unknown pragma warning for non-MSVC compilers

GCC warns:

src/lib_ccx/networking.c:22: warning: ignoring #pragma warning  [-Wunknown-pragmas]
   22 | #pragma warning( suppress : 4005)
      |

* networking: Fix unused variable warnings on non-Windows platforms

GCC warns:

src/lib_ccx/networking.c: In function ‘net_udp_read’:
src/lib_ccx/networking.c:342:12: warning: variable ‘addr’ set but not used [-Wunused-but-set-variable]
  342 |  in_addr_t addr;
      |            ^~~~
src/lib_ccx/networking.c:340:12: warning: unused variable ‘len’ [-Wunused-variable]
  340 |  socklen_t len = sizeof(source_addr);
      |            ^~~
src/lib_ccx/networking.c:338:7: warning: unused variable ‘ip’ [-Wunused-variable]
  338 |  char ip[INET_ADDRSTRLEN];
      |       ^~

* params: Fix unused variable warning when OCR is disabled

GCC warns:

src/lib_ccx/params.c: In function ‘version’:
src/lib_ccx/params.c:1015:8: warning: unused variable ‘leptversion’ [-Wunused-variable]
 1015 |  char *leptversion;
      |        ^~~~~~~~~~~

* params_dump: Fix empty encoding when ASCII is used

GCC warns:

src/lib_ccx/params_dump.c: In function ‘params_dump’:
src/lib_ccx/params_dump.c:110:2: warning: enumeration value ‘CCX_ENC_ASCII’ not handled in switch [-Wswitch]
  110 |  switch (ccx_options.enc_cfg.encoding)
      |  ^~~~~~

* params_dump: Fix comparison between mismatching enums

GCC warns:

src/lib_ccx/params_dump.c: In function ‘print_file_report’:
src/lib_ccx/params_dump.c:402:18: warning: comparison between ‘enum ccx_stream_type’ and ‘enum ccx_stream_mode_enum’ [-Wenum-compare]
  402 |    (info->stream == CCX_SM_TRANSPORT ||
      |                  ^~
src/lib_ccx/params_dump.c:403:18: warning: comparison between ‘enum ccx_stream_type’ and ‘enum ccx_stream_mode_enum’ [-Wenum-compare]
  403 |     info->stream == CCX_SM_PROGRAM ||
      |                  ^~
src/lib_ccx/params_dump.c:404:18: warning: comparison between ‘enum ccx_stream_type’ and ‘enum ccx_stream_mode_enum’ [-Wenum-compare]
  404 |     info->stream == CCX_SM_ASF ||
      |                  ^~
src/lib_ccx/params_dump.c:405:18: warning: comparison between ‘enum ccx_stream_type’ and ‘enum ccx_stream_mode_enum’ [-Wenum-compare]
  405 |     info->stream == CCX_SM_WTV))
      |                  ^~

* telxcc: Fix unused variable warning

GCC warns:

src/lib_ccx/telxcc.c: In function ‘process_telx_packet’:
src/lib_ccx/telxcc.c:928:10: warning: unused variable ‘flag_subtitle’ [-Wunused-variable]
  928 |  uint8_t flag_subtitle;
      |          ^~~~~~~~~~~~~

* ts_functions: Fix unused variable warnings

GCC warns:

src/lib_ccx/ts_functions.c: In function ‘get_pts’:
src/lib_ccx/ts_functions.c:642:11: warning: variable ‘pes_packet_length’ set but not used [-Wunused-but-set-variable]
  642 |  uint16_t pes_packet_length;
      |           ^~~~~~~~~~~~~~~~~
src/lib_ccx/ts_functions.c:641:10: warning: variable ‘pes_stream_id’ set but not used [-Wunused-but-set-variable]
  641 |  uint8_t pes_stream_id;
      |          ^~~~~~~~~~~~~

* ts_tables_epg: Fix warnings

GCC warns:

src/lib_ccx/ts_tables_epg.c: In function ‘EPG_add_event’:
src/lib_ccx/ts_tables_epg.c:380:6: warning: unused variable ‘isnew’ [-Wunused-variable]
  380 |  int isnew=true, j;
      |      ^~~~~
src/lib_ccx/ts_tables_epg.c: In function ‘EPG_DVB_decode_string’:
src/lib_ccx/ts_tables_epg.c:469:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
  469 |  int ret=-1;
      |      ^~~
src/lib_ccx/ts_tables_epg.c: In function ‘EPG_ATSC_decode_EIT’:
src/lib_ccx/ts_tables_epg.c:802:25: warning: variable ‘emt_location’ set but not used [-Wunused-but-set-variable]
  802 |   uint8_t title_length, emt_location;
      |                         ^~~~~~~~~~~~
src/lib_ccx/ts_tables_epg.c:764:10: warning: variable ‘table_id’ set but not used [-Wunused-but-set-variable]
  764 |  uint8_t table_id;
      |          ^~~~~~~~
src/lib_ccx/ts_tables_epg.c: In function ‘EPG_ATSC_decode_VCT’:
src/lib_ccx/ts_tables_epg.c:837:10: warning: variable ‘table_id’ set but not used [-Wunused-but-set-variable]
  837 |  uint8_t table_id;
      |          ^~~~~~~~
src/lib_ccx/ts_tables_epg.c: In function ‘EPG_DVB_decode_EIT’:
src/lib_ccx/ts_tables_epg.c:883:10: warning: variable ‘segment_last_section_number’ set but not used [-Wunused-but-set-variable]
  883 |  uint8_t segment_last_section_number;
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib_ccx/ts_tables_epg.c:882:10: warning: variable ‘last_section_number’ set but not used [-Wunused-but-set-variable]
  882 |  uint8_t last_section_number;
      |          ^~~~~~~~~~~~~~~~~~~
src/lib_ccx/ts_tables_epg.c: In function ‘parse_EPG_packet’:
src/lib_ccx/ts_tables_epg.c:1041:11: warning: unused variable ‘transport_error_indicator’ [-Wunused-variable]
 1041 |  unsigned transport_error_indicator = (tspacket[1]&0x80)>>7;
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~

* matroska: Fix unused variable warning

The call is left alone since it might create a decoder context.
GCC warns:

src/lib_ccx/matroska.c: In function ‘matroska_save_all’:
src/lib_ccx/matroska.c:1182:27: warning: unused variable ‘dec_ctx’ [-Wunused-variable]
 1182 |     struct lib_cc_decode *dec_ctx = update_decoder_list(mkv_ctx->ctx);
      |                           ^~~~~~~

* utility: Only define MIN when necessary

GCC warns:

In file included from src/lib_ccx/ccx_demuxer.h:8,
                 from src/lib_ccx/lib_ccx.h:15,
                 from src/gpacmp4/mp4.c:6:
src/lib_ccx/utility.h:8: warning: "MIN" redefined
    8 | #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
      |
In file included from src/gpacmp4/gpac/tools.h:33,
                 from src/gpacmp4/gpac/isomedia.h:50,
                 from src/gpacmp4/mp4.c:5:
src/gpacmp4/gpac/setup.h:324: note: this is the location of the previous definition
  324 | #define MIN(X, Y) ((X)<(Y)?(X):(Y))
      |
2020-01-23 18:49:16 -08:00
Nils ANDRÉ-CHANG
8db3398eb7 [IMPROVEMENT] Implement subtitle modifications for each encoder (#1214)
* Implement subtitle modification for all 608 encoders

This is done by modifying the subtitles in `ccx_encoders_common.c`
rather than per encoder.

* Use `char *` instead of subtitle data to capitalize

* Implement subtitle modification for OCR encoders

* Remove signness warnings

* Remove two-word profanity

They do not work for the moment

* Deal with different encoding

* Mention in changelog
2020-01-23 18:45:56 -08:00