Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ option (WITH_FFMPEG "Build using FFmpeg demuxer and decoder" OFF)
option (WITH_OCR "Build with OCR (Optical Character Recognition) feature" OFF)
option (WITH_HARDSUBX "Build with support for burned-in subtitles" OFF)
option (VBI_DEBUG "Enable VBI decoder debug output" OFF)
option (NETWORKING_DEBUG "Enable networking debug output" OFF)

# HARDSUBX requires OCR (tesseract/leptonica) and FFmpeg
if (WITH_HARDSUBX)
Expand Down Expand Up @@ -164,6 +165,11 @@ if (VBI_DEBUG)
add_definitions(-DVBI_DEBUG)
message(STATUS "VBI debug output enabled")
endif (VBI_DEBUG)

if (NETWORKING_DEBUG)
add_definitions(-DNETWORKING_DEBUG)
message(STATUS "Networking debug output enabled")
endif (NETWORKING_DEBUG)
add_subdirectory (lib_ccx)

aux_source_directory(${PROJECT_SOURCE_DIR} SOURCEFILE)
Expand Down
14 changes: 9 additions & 5 deletions src/lib_ccx/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
#include <errno.h>
#include <assert.h>

#ifdef NETWORKING_DEBUG
#define DEBUG_OUT 1
#else
#define DEBUG_OUT 0
#endif

/* Protocol constants: */
#define INT_LEN 10
Expand Down Expand Up @@ -144,14 +148,14 @@ void net_send_header(const unsigned char *data, size_t len)
assert(srv_sd > 0);

#if DEBUG_OUT
fprintf(stderr, "Sending header (len = %u): \n", len);
fprintf(stderr, "Sending header (len = %zu): \n", len);
fprintf(stderr, "File created by %02X version %02X%02X\n", data[3], data[4], data[5]);
fprintf(stderr, "File format revision: %02X%02X\n", data[6], data[7]);
#endif

if (write_block(srv_sd, BIN_HEADER, data, len) <= 0)
{
printf("Can't send BIN header\n");
fprintf(stderr, "Can't send BIN header\n");
return;
}

Expand All @@ -178,7 +182,7 @@ int net_send_cc(const unsigned char *data, int len, void *private_data, struct c

if (write_block(srv_sd, BIN_DATA, data, len) <= 0)
{
printf("Can't send BIN data\n");
fprintf(stderr, "Can't send BIN data\n");
return -1;
}

Expand Down Expand Up @@ -238,7 +242,7 @@ void net_check_conn()
{
if (write_block(srv_sd, PING, NULL, 0) < 0)
{
printf("Unable to send data\n");
fprintf(stderr, "Unable to send data\n");
exit(EXIT_FAILURE);
}

Expand Down Expand Up @@ -325,7 +329,7 @@ void net_send_epg(
end += c;

#if DEBUG_OUT
fprintf(stderr, "[C] Sending EPG: %u bytes\n", len);
fprintf(stderr, "[C] Sending EPG: %zu bytes\n", len);
#endif

if (write_block(srv_sd, EPG_DATA, epg, len) <= 0)
Expand Down
4 changes: 2 additions & 2 deletions src/rust/src/demuxer/scc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,11 @@ mod tests {

// 24fps - 24 frames = 1 second
let time_24 = parse_smpte_timecode("00:00:00:24", SccFrameRate::Fps24).unwrap();
assert!(time_24 >= 999 && time_24 <= 1001); // Approximately 1 second
assert!((999..=1001).contains(&time_24)); // Approximately 1 second

// 30fps - 30 frames = 1 second
let time_30 = parse_smpte_timecode("00:00:00:30", SccFrameRate::Fps30).unwrap();
assert!(time_30 >= 999 && time_30 <= 1001); // Approximately 1 second
assert!((999..=1001).contains(&time_30)); // Approximately 1 second

// Drop-frame separator (semicolon)
assert_eq!(
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/demuxer/stream_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ pub fn detect_myth(ctx: &mut CcxDemuxer) -> i32 {
uc.copy_from_slice(&ctx.startbytes[..3]);

for &byte in &ctx.startbytes[3..ctx.startbytes_avail as usize] {
if (uc == [b't', b'v', b'0']) || (uc == [b'T', b'V', b'0']) {
if (uc == *b"tv0") || (uc == *b"TV0") {
vbi_blocks += 1;
}

Expand Down
Loading