Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Add log module in lib_ccxr #1622

Merged
merged 12 commits into from
Jul 16, 2024
Merged
1 change: 1 addition & 0 deletions docs/CHANGES.TXT
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.95 (to be released)
-----------------
- New: Add log module in lib_ccxr (#1622)
- New: Create `lib_ccxr` and `libccxr_exports` (#1621)
- Fix: Unexpected behavior of get_write_interval (#1609)
- Update: Bump rsmpeg to latest version for ffmpeg bindings (#1600)
Expand Down
11 changes: 3 additions & 8 deletions src/lib_ccx/activity.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ relevant events. */
#include "lib_ccx.h"
#include "ccx_common_option.h"

static int credits_shown = 0;
unsigned long net_activity_gui = 0;

/* Print current progress. For percentage, -1 -> streaming mode */
Expand Down Expand Up @@ -129,11 +128,7 @@ void activity_report_data_read(void)

void activity_header(void)
{
if (!credits_shown)
{
credits_shown = 1;
mprint("CCExtractor %s, Carlos Fernandez Sanz, Volker Quetschke.\n", VERSION);
mprint("Teletext portions taken from Petr Kutalek's telxcc\n");
mprint("--------------------------------------------------------------------------\n");
}
mprint("CCExtractor %s, Carlos Fernandez Sanz, Volker Quetschke.\n", VERSION);
mprint("Teletext portions taken from Petr Kutalek's telxcc\n");
mprint("--------------------------------------------------------------------------\n");
}
6 changes: 6 additions & 0 deletions src/lib_ccx/lib_ccx.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,19 @@ struct lib_ccx_ctx *init_libraries(struct ccx_s_options *opt)
{
int ret = 0;

activity_header(); // Brag about writing it :-)

// Set logging functions for libraries
ccx_common_logging.debug_ftn = &dbg_print;
ccx_common_logging.debug_mask = opt->debug_mask;
ccx_common_logging.fatal_ftn = &fatal;
ccx_common_logging.log_ftn = &mprint;
ccx_common_logging.gui_ftn = &activity_library_process;

#ifndef DISABLE_RUST
ccxr_init_basic_logger(opt);
#endif

struct lib_ccx_ctx *ctx = malloc(sizeof(struct lib_ccx_ctx));
if (!ctx)
ccx_common_logging.fatal_ftn(EXIT_NOT_ENOUGH_MEMORY, "init_libraries: Not enough memory allocating lib_ccx_ctx context.");
Expand Down
4 changes: 4 additions & 0 deletions src/lib_ccx/lib_ccx.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ struct lib_ccx_ctx
struct lib_ccx_ctx *init_libraries(struct ccx_s_options *opt);
void dinit_libraries( struct lib_ccx_ctx **ctx);

#ifndef DISABLE_RUST
extern void ccxr_init_basic_logger(struct ccx_s_options *opts);
#endif

//ccextractor.c
void print_end_msg(void);

Expand Down
1 change: 0 additions & 1 deletion src/lib_ccx/utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ void mprint(const char *fmt, ...)
va_list args;
if (!ccx_options.messages_target)
return;
activity_header(); // Brag about writing it :-)
va_start(args, fmt);
if (ccx_options.messages_target == CCX_MESSAGES_STDOUT)
{
Expand Down
11 changes: 7 additions & 4 deletions src/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ fn main() {
"lib_cc_decode",
"cc_subtitle",
"ccx_output_format",
"ccx_s_options",
]);

#[cfg(feature = "hardsubx_ocr")]
Expand Down
9 changes: 9 additions & 0 deletions src/rust/lib_ccxr/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/rust/lib_ccxr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bitflags = "2.6.0"

[features]
default = ["enable_sharing", "wtv_debug", "enable_ffmpeg", "debug", "with_libcurl"]
Expand Down
Loading
Loading