Skip to content
Merged
1 change: 1 addition & 0 deletions docs/CHANGES.TXT
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
1.0 (to be released)
-----------------
- New: Add Encoder Module to Rust
- Fix: Elementary stream regressions
- Fix: Segmentation faults on XDS files
- Fix: Clippy Errors Based on Rust 1.88
Expand Down
11 changes: 9 additions & 2 deletions src/lib_ccx/ccx_encoders_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ int fsync(int fd)
}
#endif

#ifndef DISABLE_RUST
int ccxr_get_str_basic(unsigned char *out_buffer, unsigned char *in_buffer, int trim_subs,
enum ccx_encoding_type in_enc, enum ccx_encoding_type out_enc, int max_len);
#endif
// These are the default settings for plain transcripts. No times, no CC or caption mode, and no XDS.
ccx_encoders_transcript_format ccx_encoders_default_transcript_settings =
{
Expand Down Expand Up @@ -293,6 +297,9 @@ int change_ascii_encoding(unsigned char *dest, unsigned char *src, int len, enum
int get_str_basic(unsigned char *out_buffer, unsigned char *in_buffer, int trim_subs,
enum ccx_encoding_type in_enc, enum ccx_encoding_type out_enc, int max_len)
{
#ifndef DISABLE_RUST
return ccxr_get_str_basic(out_buffer, in_buffer, trim_subs, in_enc, out_enc, max_len);
#else
int last_non_blank = -1;
int first_non_blank = -1;
int len = 0;
Expand All @@ -305,7 +312,6 @@ int get_str_basic(unsigned char *out_buffer, unsigned char *in_buffer, int trim_
*out_buffer = 0;
return 0;
}

// change encoding only when required
switch (in_enc)
{
Expand All @@ -331,6 +337,7 @@ int get_str_basic(unsigned char *out_buffer, unsigned char *in_buffer, int trim_
return (unsigned)len; // Return length

return 0; // Return length
#endif
}

int write_subtitle_file_footer(struct encoder_ctx *ctx, struct ccx_s_write *out)
Expand Down Expand Up @@ -631,8 +638,8 @@ int write_cc_buffer_as_simplexml(struct eia608_screen *data, struct encoder_ctx
if (data->row_used[i])
{
write_cc_line_as_simplexml(data, context, i);
wrote_something = 1;
}
wrote_something = 1;
}
return wrote_something;
}
Expand Down
12 changes: 0 additions & 12 deletions src/lib_ccx/ccx_encoders_spupng.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,6 @@ FT_Face face_regular = NULL;
FT_Face face_italics = NULL;
FT_Face face = NULL;

struct spupng_t
{
FILE *fpxml;
FILE *fppng;
char *dirname;
char *pngfile;
char *relative_path_png;
int fileIndex;
int xOffset;
int yOffset;
};

#define CCPL (ccfont2_width / CCW * ccfont2_height / CCH)

static int initialized = 0;
Expand Down
12 changes: 12 additions & 0 deletions src/lib_ccx/ccx_encoders_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,16 @@ struct ccx_s_write

};

struct spupng_t
{
FILE *fpxml;
FILE *fppng;
char *dirname;
char *pngfile;
char *relative_path_png;
int fileIndex;
int xOffset;
int yOffset;
};

#endif
4 changes: 4 additions & 0 deletions src/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ fn main() {
"writercwtdata",
"version",
"set_binary_mode",
"net_send_header", // shall be removed after NET
"write_spumux_footer",
"write_spumux_header",
]);

#[cfg(feature = "hardsubx_ocr")]
Expand Down Expand Up @@ -39,6 +42,7 @@ fn main() {
"ccx_encoding_type",
"ccx_decoder_608_settings",
"ccx_decoder_608_report",
"eia608_screen",
"uint8_t",
"word_list",
]);
Expand Down
4 changes: 4 additions & 0 deletions src/rust/lib_ccxr/src/encoder/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub mod txt_helpers;
/* Note
This is a part of the encoder library, which is made in pure rust; hence it's kept in `lib_ccxr` instead of `src`.
*/
Loading
Loading