Commit Graph

2235 Commits

Author SHA1 Message Date
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
Nils ANDRÉ-CHANG
7b038ab649 Fix use-after-free (#1215) 2020-01-23 09:39:45 -08:00
kdrag0n
7d0c2ede26 [IMPROVEMENT] Clean up SCC control codes (#1212)
* scc: Reformat control code list

- Separate sections with a blank line
- Align with 4-wide tabs rather than spaces
- Rewrite some comments

* scc: Revamp control code handling

This can be made much more readable by adding a small info struct that
contains all the information about a control code (first byte odd &
even, second byte, and assembly). Information is stored in and retrieved
from an array, created using an array initializer with the enum values
as indices.

This allows us to remove the massive switch-case blocks, leading to much
cleaner and more streamlined code.
2020-01-22 23:26:23 -08:00
Nils ANDRÉ-CHANG
60773bb859 [IMPROVEMENT] Add noreturn attribute to fatal (#1179)
* Set no return

* Add MSVC
2020-01-22 23:25:43 -08:00
kdrag0n
a919ef4410 [FIX] SCC character pair writing (#1210)
* scc: Fix character pair writing

The space was being inserted in the wrong position, so the first
character of each caption was being cut off. The last character was also
cut off in captions with even lengths.

Reported-By: Nils ANDRÉ-CHANG <nils@nilsand.re>

* scc: Apply pair writing to control codes

The same mandatory pair logic applies here.
2020-01-22 23:23:00 -08:00
kdrag0n
424e67f5f4 [FIX] Fix SCC timing and lingering captions (#1211)
* scc: Fix timing and lingering captions

- Write EDM codes at end times to clear them from the screen as intended
  by the captioners
- Show captions at the correct times:
  - EOC+ENM *shows* the caption. It doesn't clear it -- that's EDM's job.
  - The caption is *not* shown immediately after loading. EOC (End Of
    Caption) is required for it to actually show.

Old behavior:
Start time: Load caption
End time: Show loaded caption

New behavior:
Start time: Load and show caption
End time: Clear displayed caption

These changes fix the issue where captions were always one line off --
that is, caption 1 would show when caption 2 was supposed to show.

* scc: Calculate frame number using a more precise frame rate

* scc: Fix timecode format specifiers

These are ints are unsigned.
2020-01-22 23:18:18 -08:00
Nils ANDRÉ-CHANG
4097831b9b Remove useless O(N) operations and memory allocations (#1207) 2020-01-22 09:03:21 -08:00
kdrag0n
1764aa1f92 scc: Write all characters in pairs (#1208)
This is how every example appears to be structured. MPV doesn't display
anything without this.

Before: "e5 f2 e5 20"
After: "e5f2 e520"
2020-01-22 08:01:53 -08:00
kdrag0n
19de49763a [FIX] Fix minor memory leak in OCR code (#1206)
* ocr: Fix minor memory leak

Detected by Valgrind:

==1203168== 2,880 bytes in 57 blocks are definitely lost in loss record 3 of 4
==1203168==    at 0x483877F: malloc (vg_replace_malloc.c:309)
==1203168==    by 0x51ADBEE: strdup (in /usr/lib/libc-2.30.so)
==1203168==    by 0x24D1F8: ocr_bitmap (ocr.c:569)
==1203168==    by 0x24E25B: ocr_rect (ocr.c:907)
==1203168==    by 0x284832: write_dvb_sub (dvb_subtitle_decoder.c:1665)
==1203168==    by 0x284B7A: dvbsub_handle_display_segment (dvb_subtitle_decoder.c:1720)
==1203168==    by 0x285024: dvbsub_decode (dvb_subtitle_decoder.c:1828)
==1203168==    by 0x2406AF: process_data (general_loop.c:648)
==1203168==    by 0x2416D0: general_loop (general_loop.c:1025)
==1203168==    by 0x1AC89A: api_start (ccextractor.c:214)
==1203168==    by 0x16EC03: main (ccextractor.c:536)

* changes: Document OCR memory leak fix
2020-01-21 08:19:19 -08:00
kdrag0n
a0b4e389f9 [FIX] EIA-608 screen clearing fix (#1203)
* eia608: Re-use constant rather than hard-coding length in arrays

Hard-coding them is less clear and more prone to breakage.

* eia608: Add and use constant for max number of rows

Hard-coding it everywhere is unclear and prone to breakage.

* eia608: Initialize colors and fonts properly with a loop

memset is for single-byte types; an enum is defined to be the size of an
int, so using memset to fill an array of enum values is incorrect.

Fix it by using a simple loop to fill the elements, as there is no
memset-like function for arbitrary item lengths in C.

GCC warns:

src/lib_ccx/ccx_decoders_608.c: In function ‘clear_eia608_cc_buffer’:
src/lib_ccx/ccx_decoders_608.c:111:3: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
  111 |   memset(data->colors[i], context->settings->default_color, CCX_DECODER_608_SCREEN_WIDTH + 1);
      |   ^~~~~~
src/lib_ccx/ccx_decoders_608.c:112:3: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
  112 |   memset(data->fonts[i], FONT_REGULAR, CCX_DECODER_608_SCREEN_WIDTH + 1);
      |   ^~~~~~
2020-01-20 19:06:06 -08:00
Nils ANDRÉ-CHANG
2281051d3d Remove warning when calling paraof_ocrtext (#1199) 2020-01-19 16:51:41 -08:00
Willem
fc21280857
Merge pull request #1201 from NilsIrl/ocr_hardsubx_cmake_actions
[IMPROVEMENT] Test with OCR and HARDSUBX
2020-01-19 21:36:06 +01:00
Nils André-Chang
746806dcef Cmake with OCR and Hardsubx in different job 2020-01-19 20:30:04 +00:00
Nils André-Chang
812734fd2a Add dependencies 2020-01-19 20:00:03 +00:00
Nils ANDRÉ-CHANG
66d59e498b Make -ocrlang work (#1200) 2020-01-19 11:44:16 -08:00
Nils André-Chang
5599ce9eaf Test with OCR and HARDSUBX 2020-01-19 19:16:15 +00:00
Willem
2e2075ca52
Add GitHub Action for Windows
Adds a GitHub Action that will build CCExtractor for Windows with msbuild. It will build in Release mode and Debug mode, without OCR or other features enabled.
2020-01-19 15:34:25 +01:00
Sam Poder
c69d2db52b [FEATURE] Simple MacOS GUI (#1138)
* Create info.md

* Add files via upload

* Update

* Rename info.md to README.md

* Delete InstallCCExtractor.zip

* Add files via upload

* fix bugs

* Update InstallCCExtractorMacGUI.zip

* Create placeholder.md

* Add Source Files

* Create HowToGenerateApp

* Rename HowToGenerateApp to HowToGenerateApp.md

* Done Alert
2020-01-18 17:34:19 -08:00
Willem
54ecce8b86
Merge pull request #1193 from NilsIrl/cmake_github_action
[IMPROVEMENT] Add Cmake job to github action
2020-01-18 21:45:30 +01:00
Nils André-Chang
82b60988bb Parallelize 2020-01-18 20:20:40 +00:00
Nils André-Chang
ab1af7c678 Add Cmake job to github action 2020-01-18 20:16:15 +00:00
Nils ANDRÉ-CHANG
84ba7c5238 Fix segfault (#1192) 2020-01-18 12:15:40 -08:00
Willem
676be1f193
Add GitHub Action for Linux
Adds a GitHub Action that will build CCExtractor for Linux (Ubuntu in this case) using the shell script and the autoconf option.
2020-01-18 20:05:42 +01:00
Nils ANDRÉ-CHANG
e8cb55e739 [FIX] Fix free segfault (#1190)
* Fix free segfault

I restricted the scope and used free because the features of freep
aren't needed here.

Restricting the scope makes it clear when freeing the variable should be
done.

* Mention that freeing should be done
2020-01-18 09:29:58 -08:00
Nils ANDRÉ-CHANG
30613b224a Fix memory leak (#1187)
Addresses https://github.com/CCExtractor/ccextractor/pull/402#discussion_r368041348
2020-01-18 08:53:43 -08:00
Nils ANDRÉ-CHANG
19241744d7 [FEATURE] SCC and CCD encoder (#1154)
* Fix indentation, use switch instead of if

* Remove confusing comment

Enums are abstractions and should be used as such. They shouldn't be
used like integers.

* Return a const char* instead of char * allocated on heap

* Test return value inline

* Add SCC output

* Add CCD format

* Add channel header to CCD

* Return const pointer

* Revert formatting change

* Colour -> Color

* Fix formatting

* Move comment to relevant place

* Improve readability

* Fix formatting

* Fix erroneous comment

* Use different parity function not requiring GNU extension

* Use enum instead of int

* Fix bug

* Implement channel functionality

* Fix CI errors

* Fix CI build

* Add options to help menu

* Mention change in changelog

* Add file to build systems

* Remove uneeded link against zlib

* Remove the use of <stdbool.h> and use const char

* Rewrite SCC formatter

* Use fdprintf
2020-01-18 08:52:03 -08:00
Willem
27288ccf89
Merge pull request #1189 from NilsIrl/warning_filter_word
[IMPROVEMENT] Fix implicit declaration of function 'add_word'

Closes #1188
2020-01-18 17:31:17 +01:00
Nils André-Chang
34282c17b8 Fix implicit declaration of function 'add_word'
Fix #1188
2020-01-18 16:16:34 +00:00
Nils ANDRÉ-CHANG
227f149670 [FIX] Allow -dvblang that doesn't follow ISO 639-2 (#1183)
* Allow `-dvblang` that doesn't follow ISO 639-2

Fix #1161

* Allows 'und' to be specified to `-dvblang`
2020-01-16 12:03:13 -08:00
Nils ANDRÉ-CHANG
27477e9f7c [IMPROVEMENT] Remove warnings (#1186)
* [Warning] Make subtitle modification work on unsigned char *

* Remove LOG_DEBUG no side effect warning
2020-01-16 08:25:25 -08:00
Jacob Shin
b3018e083e [FIX] Add FT_Done_Face to destroy face objects after they're used (#1184)
* Add FT_Done_Face to destroy face objects after they're used

* Update CHANGES.TXT
2020-01-14 17:11:18 -08:00
Nils ANDRÉ-CHANG
96de55429d Remove freep warnings (#1182) 2020-01-14 11:22:31 -08:00
Nils ANDRÉ-CHANG
863eacc440 Revert "Remove freep warning (#1180)" (#1181)
This reverts commit 78249045f8.
2020-01-13 14:12:39 -08:00
Nils ANDRÉ-CHANG
78249045f8 Remove freep warning (#1180) 2020-01-13 12:16:42 -08:00
Nils ANDRÉ-CHANG
dad108b7e1 Fix wrong format string (#1177) 2020-01-13 07:54:15 -08:00
Dhrumil Patel
79f18b996b [FIX] Added the option to disable timestamps for WebVTT (#1176)
* Added the option to disable timestamps for WebVTT

* Mentioned in changelog

* Added the option to params.c

* Encoder checks its context nwo

* Encoder checks its context
2020-01-12 18:06:26 -08:00
Nils ANDRÉ-CHANG
987c5cd301 Remove useless nulling of pointer (#1171) 2020-01-09 17:36:10 -08:00
Nils ANDRÉ-CHANG
34d0df1d96 [Fix] Make -delay all output formats (#1167)
* Fix indentation

* Calculate subs_delay in encode_sub rather than in the individual encoders

Fix #1103

* Use precalculated times when sub->type == CC_TEXT

* Use calculate delay in encode_sub when sub->type == CC_608
2020-01-09 17:35:19 -08:00
Willem
1db731a7a8
Update CHANGES.TXT 2020-01-05 18:44:05 +01:00
Willem
af67596e66
Merge pull request #1139 from NilsIrl/filter_bad_words
Adds a built-in method to filter bad words to the program.
2020-01-05 18:41:37 +01:00
Jacob Shin
86f98ddf5f Used the INET_ADDRSTRLEN constant for network functions (#1172) 2020-01-04 07:34:10 +01:00
eshandhawan51
bba6c4fcfd [FIX] Solved issue #1131 (#1169)
* Removed invalid free condition for multiple files

* Apply suggestions from code review

statement to free pointer

Co-Authored-By: Nils ANDRÉ-CHANG <nils@nilsand.re>

Co-authored-by: Nils ANDRÉ-CHANG <nils@nilsand.re>
2020-01-02 17:56:02 +01:00
Nils André-Chang
af64fa8a3d Remove multi word profanity 2020-01-01 21:44:02 +00:00
Nils André-Chang
e1d3060232 Fix crash 2020-01-01 17:15:53 +00:00
Willem
3a1815163f
Merge pull request #1164 from NilsIrl/patch-1
[IMPROVEMENT] Mention -DWITH_OCR in compilation instruction
2019-12-31 05:26:08 +01:00
Willem
0954b47a24
Merge pull request #1165 from jshin313/xp
[FIX] Change inet_ntop to inet_ntoa for Windows XP compatibility
2019-12-30 19:32:58 +01:00
Jacob Shin
594a83cc4e Update CHANGES.TXT 2019-12-30 11:59:58 -05:00
Jacob Shin
ecec3ea22b Change inet_ntop to inet_ntoa for Windows XP compatibility 2019-12-30 11:55:30 -05:00
Nils ANDRÉ-CHANG
f9cfc7219d Mention -DWITH_OCR 2019-12-30 14:12:15 +00:00
Jacob Shin
c854d25963 [FIX] Get rid of a few compilation warnings (#1160)
* Added underline support

* Added changes to CHANGES.TXT

* Delete CHANGES.TXT~

* Delete .CHANGES.TXT.un~

* Update CHANGES.TXT

* Changed strncpy to memcpy when the size of the data being transferred is known

* Add declaration of struct image_copy before function

* Used strdup for duplicating strings

* Added error checking for strdup
2019-12-29 22:26:30 +01:00