* 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
* 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.
* 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.
* 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.
* 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
* 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);
| ^~~~~~
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.
* 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
* 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
* 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
* 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
* 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