Skip to content

Commit dd06fe2

Browse files
committed
isdbs module added in lib_ccxr
1 parent a84256d commit dd06fe2

File tree

11 files changed

+4695
-0
lines changed

11 files changed

+4695
-0
lines changed

src/lib_ccx/ccx_decoders_isdb.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
#include "utility.h"
55
#include "limits.h"
66

7+
#ifndef DISABLE_RUST
8+
9+
extern int ccxr_isdb_set_global_time(struct lib_cc_decode *dec_ctx, uint64_t timestamp);
10+
extern void ccxr_delete_isdb_decoder(void **isdb_ctx);
11+
extern void *ccxr_init_isdb_decoder(void);
12+
extern int ccxr_isdb_parse_data_group(void *codec_ctx, const uint8_t *buf, int size, struct cc_subtitle *sub);
13+
extern int ccxr_isdbsub_decode(struct lib_cc_decode *dec_ctx, const uint8_t *buf, size_t buf_size, struct cc_subtitle *sub);
14+
15+
#endif
16+
717
// #define DEBUG
818
// #define COMMAND_DEBUG
919

@@ -281,6 +291,9 @@ typedef struct
281291
*/
282292
void delete_isdb_decoder(void **isdb_ctx)
283293
{
294+
#ifndef DISABLE_RUST
295+
ccxr_delete_isdb_decoder(isdb_ctx);
296+
#else
284297
ISDBSubContext *ctx = *isdb_ctx;
285298
struct ISDBText *text = NULL;
286299
struct ISDBText *text1 = NULL;
@@ -298,6 +311,7 @@ void delete_isdb_decoder(void **isdb_ctx)
298311
free(text);
299312
}
300313
freep(isdb_ctx);
314+
#endif
301315
}
302316

303317
static void init_layout(ISDBSubLayout *ls)
@@ -308,10 +322,14 @@ static void init_layout(ISDBSubLayout *ls)
308322

309323
ls->font_scale.fscx = 100;
310324
ls->font_scale.fscy = 100;
325+
311326
}
312327

313328
void *init_isdb_decoder(void)
314329
{
330+
#ifndef DISABLE_RUST
331+
return ccxr_init_isdb_decoder();
332+
#else
315333
ISDBSubContext *ctx;
316334

317335
ctx = malloc(sizeof(ISDBSubContext));
@@ -326,6 +344,7 @@ void *init_isdb_decoder(void)
326344
ctx->current_state.rollup_mode = 0;
327345
init_layout(&ctx->current_state.layout_state);
328346
return ctx;
347+
#endif
329348
}
330349

331350
/**
@@ -585,6 +604,9 @@ static int get_text(ISDBSubContext *ctx, unsigned char *buffer, int len)
585604

586605
static void set_writing_format(ISDBSubContext *ctx, uint8_t *arg)
587606
{
607+
#ifdef DISABLE_RUST
608+
ccxr_set_writing_format(&ctx, arg);
609+
#else
588610
ISDBSubLayout *ls = &ctx->current_state.layout_state;
589611

590612
/* One param means its initialization */
@@ -637,6 +659,7 @@ static void set_writing_format(ISDBSubContext *ctx, uint8_t *arg)
637659
}
638660

639661
return;
662+
#endif
640663
}
641664

642665
/** move pen position to (col, row) relative to display area's top left.
@@ -1328,6 +1351,9 @@ static int parse_caption_statement_data(ISDBSubContext *ctx, int lang_id, const
13281351
*/
13291352
int isdb_parse_data_group(void *codec_ctx, const uint8_t *buf, struct cc_subtitle *sub)
13301353
{
1354+
#ifndef DISABLE_RUST
1355+
return ccxr_isdb_parse_data_group(codec_ctx, buf, 0, sub);
1356+
#else
13311357
ISDBSubContext *ctx = codec_ctx;
13321358
const uint8_t *buf_pivot = buf;
13331359
int id = (*buf >> 2);
@@ -1393,10 +1419,14 @@ int isdb_parse_data_group(void *codec_ctx, const uint8_t *buf, struct cc_subtitl
13931419
buf += 2;
13941420

13951421
return buf - buf_pivot;
1422+
#endif
13961423
}
13971424

13981425
int isdbsub_decode(struct lib_cc_decode *dec_ctx, const uint8_t *buf, size_t buf_size, struct cc_subtitle *sub)
13991426
{
1427+
#ifndef DISABLE_RUST
1428+
return ccxr_isdbsub_decode(dec_ctx, buf, buf_size, sub);
1429+
#else
14001430
const uint8_t *header_end = NULL;
14011431
int ret = 0;
14021432
ISDBSubContext *ctx = dec_ctx->private_data;
@@ -1421,10 +1451,16 @@ int isdbsub_decode(struct lib_cc_decode *dec_ctx, const uint8_t *buf, size_t buf
14211451
return -1;
14221452

14231453
return 1;
1454+
#endif
14241455
}
1456+
14251457
int isdb_set_global_time(struct lib_cc_decode *dec_ctx, uint64_t timestamp)
14261458
{
1459+
#ifndef DISABLE_RUST
1460+
return ccxr_isdb_set_global_time(dec_ctx, timestamp);
1461+
#else
14271462
ISDBSubContext *ctx = dec_ctx->private_data;
14281463
ctx->timestamp = timestamp;
14291464
return CCX_OK;
1465+
#endif
14301466
}

src/rust/Cargo.lock

Lines changed: 102 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rust/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ time = "0.3.39"
2727
cfg-if = "1.0.0"
2828
num-integer = "0.1.46"
2929
lib_ccxr = { path = "lib_ccxr" }
30+
3031
url = "2.5.4"
32+
libc = "0.2.169"
33+
nanomsg = { version = "0.7.2" }
34+
prost = "0.13.4"
35+
prost-types = "0.13.4"
36+
lazy_static = "1.5.0"
37+
nanomsg-sys = "0.7.2"
3138

3239
[build-dependencies]
3340
bindgen = "0.64.0"

src/rust/lib_ccxr/Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ strum = "0.26.3"
1515
strum_macros = "0.26.4"
1616
crc32fast = "1.4.2"
1717
num_enum = "0.6.1"
18+
libc = "0.2.169"
19+
nanomsg = "0.7.2"
20+
prost = "0.13.4"
21+
prost-types = "0.13.4"
22+
lazy_static = "1.5.0"
23+
nanomsg-sys = "0.7.2"
1824

1925
[features]
2026
default = [
@@ -30,3 +36,5 @@ enable_ffmpeg = []
3036
debug_out = []
3137
debug = []
3238
with_libcurl = []
39+
40+

0 commit comments

Comments
 (0)