Skip to content

[Rust]Added MythTV Module #1713

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

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d677f98
feat: added demuxer module
steel-bucket Feb 11, 2025
c919330
Cargo Lock Update
steel-bucket Mar 23, 2025
2a5f5fe
Completed file_functions and demuxer
steel-bucket Mar 25, 2025
4c148c3
Completed file_functions and demuxer
steel-bucket Mar 25, 2025
8dd043f
written extern functions for demuxer
steel-bucket Mar 25, 2025
b8cd075
Removed libc completely, added tests for gxf and ported gxf to C
steel-bucket Mar 27, 2025
08106b2
Hardsubx error fixed
steel-bucket Mar 29, 2025
b164623
Fixing format issues
steel-bucket Mar 29, 2025
a51203c
clippy errors fixed
steel-bucket Mar 30, 2025
d1b3c48
fixing format issues
steel-bucket Mar 30, 2025
681b5ad
fixing format issues
steel-bucket Mar 30, 2025
90d8c78
Windows failing tests
steel-bucket Mar 30, 2025
f6d6cbd
Windows failing tests
steel-bucket Mar 30, 2025
a1c71b6
demuxer: added demuxer data transfer functions and removed some structs
steel-bucket May 19, 2025
c10e5c8
made Demuxer and File Functions
steel-bucket Jun 7, 2025
bfbe1d6
Minor formatting changes
steel-bucket Jun 7, 2025
bdfced0
Minor Rebasing changes
steel-bucket Jun 7, 2025
1cd4ad0
demuxer: format rust and unit test rust checks
steel-bucket Jun 7, 2025
625fc46
C formatting
steel-bucket Jun 7, 2025
df8c075
Windows Failing test
steel-bucket Jun 7, 2025
1262e8a
Windows Failing test
steel-bucket Jun 7, 2025
a0f0b59
Update CHANGES.TXT
steel-bucket Jun 7, 2025
c90f91f
Update CHANGES.TXT
steel-bucket Jun 11, 2025
f4698f0
Windows Failing Tests
steel-bucket Jun 11, 2025
ddcdf5f
Windows Failing Tests
steel-bucket Jun 11, 2025
ff2925e
Problem in Copy to Rust and some typos that copilot review suggested
steel-bucket Jun 13, 2025
5d66be0
Minor Formatting Error
steel-bucket Jun 13, 2025
ab41b15
Windows Failing Regressions
steel-bucket Jun 14, 2025
06313cc
Windows Failing Regressions
steel-bucket Jun 15, 2025
a29682d
Minor Comment Change
steel-bucket Jun 16, 2025
5184ac5
Data transfer module for DemuxerData added and more rustlike syntax t…
steel-bucket Jun 22, 2025
d32b353
Minor Formatting Changes
steel-bucket Jun 22, 2025
a3239fb
Added GXF module
steel-bucket Jun 22, 2025
785ffff
ChangeLog
steel-bucket Jun 22, 2025
7c63b9f
feat:Added MXF module
steel-bucket Jun 30, 2025
58ac595
mxf: Minor Formatting changes
steel-bucket Jun 30, 2025
bff4450
mxf: Update CHANGES.txt
steel-bucket Jun 30, 2025
d3243ee
feat: Added MythTV Module
steel-bucket Jul 6, 2025
3a40107
myth: Minor Changes and ChangeLog
steel-bucket Jul 6, 2025
bd64d62
MythTV: problem with AVPacket redefinition
steel-bucket Jul 6, 2025
144ca59
Merge branch 'master' into migration-mythtv-module
steel-bucket Jul 13, 2025
17f0664
MythTV: Minor Problems in lib.rs
steel-bucket Jul 13, 2025
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: 5 additions & 1 deletion docs/CHANGES.TXT
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
1.0 (to be released)
-----------------
- New: Added MythTV module
- New: Added MXF module
- New: Added GXF module
- New: Add demuxer and file_functions module (#1662)
- Fix: Unit Test Rust failing due to changes in Rust Version 1.86.0 (#1694)
- Fix: Segmentation faults on XDS files
- Fix: Clippy Errors Based on Rust 1.88
- IMPROVEMENT: Refactor and optimize Dockerfile
Expand Down Expand Up @@ -42,7 +47,6 @@
- New: Add tesseract page segmentation modes control with `--psm` flag
- Fix: Resolve compile-time error about implicit declarations (#1646)
- Fix: fatal out of memory error extracting from a VOB PS
- Fix: Unit Test Rust failing due to changes in Rust Version 1.86.0

0.94 (2021-12-14)
-----------------
Expand Down
2 changes: 1 addition & 1 deletion src/ccextractor.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ int api_start(struct ccx_s_options api_options)
api_options.use_gop_as_pts = 0;
if (api_options.ignore_pts_jumps)
ccx_common_timing_settings.disable_sync_check = 1;
mprint("\rAnalyzing data in general mode\n");
mprint("\r\n Analyzing data in general mode\n");
tmp = general_loop(ctx);
if (!ret)
ret = tmp;
Expand Down
36 changes: 35 additions & 1 deletion src/lib_ccx/ccx_demuxer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@
#include "lib_ccx.h"
#include "utility.h"
#include "ffmpeg_intgr.h"
#ifndef DISABLE_RUST
void ccxr_demuxer_reset(struct ccx_demuxer *ctx);
void ccxr_demuxer_close(struct ccx_demuxer *ctx);
int ccxr_demuxer_isopen(const struct ccx_demuxer *ctx);
int ccxr_demuxer_open(struct ccx_demuxer *ctx, const char *file);
LLONG ccxr_demuxer_get_file_size(struct ccx_demuxer *ctx);
void ccxr_demuxer_print_cfg(const struct ccx_demuxer *ctx);
#endif

static void ccx_demuxer_reset(struct ccx_demuxer *ctx)
{
#ifndef DISABLE_RUST
ccxr_demuxer_reset(ctx);
#else
ctx->startbytes_pos = 0;
ctx->startbytes_avail = 0;
ctx->num_of_PIDs = 0;
Expand All @@ -17,25 +28,38 @@ static void ccx_demuxer_reset(struct ccx_demuxer *ctx)
}
memset(ctx->stream_id_of_each_pid, 0, (MAX_PSI_PID + 1) * sizeof(uint8_t));
memset(ctx->PIDs_programs, 0, 65536 * sizeof(struct PMT_entry *));
#endif
}

static void ccx_demuxer_close(struct ccx_demuxer *ctx)
{
#ifndef DISABLE_RUST
ccxr_demuxer_close(ctx);
#else
ctx->past = 0;
if (ctx->infd != -1 && ccx_options.input_source == CCX_DS_FILE)
{
close(ctx->infd);
ctx->infd = -1;
activity_input_file_closed();
}
#endif
}

static int ccx_demuxer_isopen(struct ccx_demuxer *ctx)
{
#ifndef DISABLE_RUST
return ccxr_demuxer_isopen(ctx);
#else
return ctx->infd != -1;
#endif
}

static int ccx_demuxer_open(struct ccx_demuxer *ctx, const char *file)
{
#ifndef DISABLE_RUST
return ccxr_demuxer_open(ctx, file);
#else
ctx->past = 0;
ctx->min_global_timestamp = 0;
ctx->global_timestamp_inited = 0;
Expand Down Expand Up @@ -193,9 +217,14 @@ static int ccx_demuxer_open(struct ccx_demuxer *ctx, const char *file)
}

return 0;
#endif
}

LLONG ccx_demuxer_get_file_size(struct ccx_demuxer *ctx)
{
#ifndef DISABLE_RUST
return ccxr_demuxer_get_file_size(ctx);
#else
LLONG ret = 0;
int in = ctx->infd;
LLONG current = LSEEK(in, 0, SEEK_CUR);
Expand All @@ -208,6 +237,7 @@ LLONG ccx_demuxer_get_file_size(struct ccx_demuxer *ctx)
return -1;

return length;
#endif
}

static int ccx_demuxer_get_stream_mode(struct ccx_demuxer *ctx)
Expand All @@ -217,6 +247,9 @@ static int ccx_demuxer_get_stream_mode(struct ccx_demuxer *ctx)

static void ccx_demuxer_print_cfg(struct ccx_demuxer *ctx)
{
#ifndef DISABLE_RUST
ccxr_demuxer_print_cfg(ctx);
#else
switch (ctx->auto_stream)
{
case CCX_SM_ELEMENTARY_OR_NOT_FOUND:
Expand Down Expand Up @@ -261,6 +294,7 @@ static void ccx_demuxer_print_cfg(struct ccx_demuxer *ctx)
fatal(CCX_COMMON_EXIT_BUG_BUG, "BUG: Unknown stream mode. Please file a bug report on Github.\n");
break;
}
#endif
}

void ccx_demuxer_delete(struct ccx_demuxer **ctx)
Expand Down Expand Up @@ -407,4 +441,4 @@ struct demuxer_data *alloc_demuxer_data(void)
data->next_stream = 0;
data->next_program = 0;
return data;
}
}
38 changes: 10 additions & 28 deletions src/lib_ccx/ccx_demuxer_mxf.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@
#include "utility.h"
#include "lib_ccx.h"

#ifndef DISABLE_RUST
int ccxr_mxf_getmoredata(struct ccx_demuxer *ctx, struct demuxer_data *data);
#endif

#define debug(fmt, ...) ccx_common_logging.debug_ftn(CCX_DMT_PARSE, "MXF:%s:%d: " fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define log(fmt, ...) ccx_common_logging.log_ftn("MXF:%d: " fmt, __LINE__, ##__VA_ARGS__)
#define IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y)))
#define IS_KLV_KEY_ANY_VERSION(x, y) (!memcmp(x, y, 7) && !memcmp(x + 8, y + 8, sizeof(y) - 8))

enum MXFCaptionType
{
MXF_CT_VBI,
MXF_CT_ANC,
};

typedef uint8_t UID[16];
typedef struct KLVPacket
{
UID key;
Expand All @@ -35,29 +32,12 @@ typedef struct MXFCodecUL

typedef int ReadFunc(struct ccx_demuxer *ctx, uint64_t size);

typedef struct
{
int track_id;
uint8_t track_number[4];
} MXFTrack;

typedef struct MXFReadTableEntry
{
const UID key;
ReadFunc *read;
} MXFReadTableEntry;

typedef struct MXFContext
{
enum MXFCaptionType type;
int cap_track_id;
UID cap_essence_key;
MXFTrack tracks[32];
int nb_tracks;
int cap_count;
struct ccx_rational edit_rate;
} MXFContext;

typedef struct MXFLocalTAGS
{
uint16_t tag;
Expand Down Expand Up @@ -540,13 +520,12 @@ static int read_packet(struct ccx_demuxer *demux, struct demuxer_data *data)
struct MXFContext *ctx = demux->private_data;
while ((ret = klv_read_packet(&klv, demux)) == 0)
{
debug("Key %02X%02X%02X%02X%02X%02X%02X%02X.%02X%02X%02X%02X%02X%02X%02X%02X size %" PRIu64 "\n",
debug("Key: %02X%02X%02X%02X%02X%02X%02X%02X.%02X%02X%02X%02X%02X%02X%02X%02X size %" PRIu64 "\n",
klv.key[0], klv.key[1], klv.key[2], klv.key[3],
klv.key[4], klv.key[5], klv.key[5], klv.key[7],
klv.key[4], klv.key[5], klv.key[6], klv.key[7],
klv.key[8], klv.key[9], klv.key[10], klv.key[11],
klv.key[12], klv.key[13], klv.key[14], klv.key[15],
klv.length);

if (IS_KLV_KEY(klv.key, ctx->cap_essence_key))
{
mxf_read_essence_element(demux, klv.length, data);
Expand Down Expand Up @@ -597,10 +576,13 @@ int ccx_mxf_getmoredata(struct lib_ccx_ctx *ctx, struct demuxer_data **ppdata)
{
data = *ppdata;
}
#ifndef DISABLE_RUST
return ccxr_mxf_getmoredata(ctx->demux_ctx, data);
#else

ret = read_packet(ctx->demux_ctx, data);

return ret;
#endif
}

int ccx_probe_mxf(struct ccx_demuxer *ctx)
Expand Down
29 changes: 27 additions & 2 deletions src/lib_ccx/ccx_demuxer_mxf.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,31 @@

#include "ccx_demuxer.h"

int ccx_probe_mxf(struct ccx_demuxer *ctx);
struct MXFContext *ccx_mxf_init(struct ccx_demuxer *demux);
typedef uint8_t UID[16];

enum MXFCaptionType
{
MXF_CT_VBI,
MXF_CT_ANC,
};

typedef struct
{
int track_id;
uint8_t track_number[4];
} MXFTrack;

typedef struct MXFContext
{
enum MXFCaptionType type;
int cap_track_id;
UID cap_essence_key;
MXFTrack tracks[32];
int nb_tracks;
int cap_count;
struct ccx_rational edit_rate;
} MXFContext;

int ccx_probe_mxf(struct ccx_demuxer* ctx);
struct MXFContext* ccx_mxf_init(struct ccx_demuxer* demux);
#endif
Loading
Loading