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