Skip to content

Commit 8536bf4

Browse files
authored
Merge branch 'master' into migration-demuxer-module
2 parents 65960db + 24f7184 commit 8536bf4

34 files changed

+3764
-1917
lines changed

src/lib_ccx/ccx_decoders_608.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ unsigned char *debug_608_to_ASC(unsigned char *cc_data, int channel)
12881288
if (hi >= 0x20)
12891289
{
12901290
output[0] = hi;
1291-
output[1] = (lo >= 20 ? lo : '.');
1291+
output[1] = (lo >= 0x20 ? lo : '.');
12921292
output[2] = '\x00';
12931293
}
12941294
else

src/lib_ccx/ccx_decoders_vbi.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@ struct ccx_decoder_vbi_ctx
2525
};
2626

2727

28-
int decode_vbi(struct lib_cc_decode *dec_ctx, uint8_t field, unsigned char *buffer, size_t len, struct cc_subtitle *sub);
2928
#endif

src/lib_ccx/es_functions.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,14 @@ static int read_pic_data(struct bitstream *esstream);
2222
/* Process a mpeg-2 data stream with "length" bytes in buffer "data".
2323
* The number of processed bytes is returned.
2424
* Defined in ISO/IEC 13818-2 6.2 */
25+
#ifndef DISABLE_RUST
26+
size_t ccxr_process_m2v(struct encoder_ctx *enc_ctx, struct lib_cc_decode *dec_ctx, unsigned char *data, size_t length, struct cc_subtitle *sub);
27+
#endif
2528
size_t process_m2v(struct encoder_ctx *enc_ctx, struct lib_cc_decode *dec_ctx, unsigned char *data, size_t length, struct cc_subtitle *sub)
2629
{
30+
#ifndef DISABLE_RUST
31+
return ccxr_process_m2v(enc_ctx, dec_ctx, data, length, sub);
32+
#endif
2733
if (length < 8) // Need to look ahead 8 bytes
2834
return length;
2935

src/lib_ccx/lib_ccx.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,4 +325,6 @@ int process_non_multiprogram_general_loop(struct lib_ccx_ctx* ctx,
325325
int ret,
326326
int *caps);
327327
void segment_output_file(struct lib_ccx_ctx *ctx, struct lib_cc_decode *dec_ctx);
328+
int decode_vbi(struct lib_cc_decode *dec_ctx, uint8_t field, unsigned char *buffer, size_t len, struct cc_subtitle *sub);
329+
328330
#endif

src/lib_ccx/networking.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,24 @@ const char *srv_pwd;
4545
unsigned char *srv_header;
4646
size_t srv_header_len;
4747

48+
#ifndef DISABLE_RUST
49+
extern void ccxr_connect_to_srv(const char *addr, const char *port, const char *cc_desc, const char *pwd);
50+
extern void ccxr_net_send_header(const unsigned char *data, size_t len);
51+
extern int ccxr_net_send_cc(const unsigned char *data, int length, void *private_data, struct cc_subtitle *sub);
52+
extern void ccxr_net_check_conn();
53+
extern void ccxr_net_send_epg(
54+
const char *start,
55+
const char *stop,
56+
const char *title,
57+
const char *desc,
58+
const char *lang,
59+
const char *category);
60+
extern int ccxr_net_tcp_read(int socket, void *buffer, size_t length);
61+
extern int ccxr_net_udp_read(int socket, void *buffer, size_t length, const char *src_str, const char *addr_str);
62+
extern int ccxr_start_tcp_srv(const char *port, const char *pwd);
63+
extern int ccxr_start_udp_srv(const char *src, const char *addr, unsigned port);
64+
#endif
65+
4866
/*
4967
* Established connection to specified address.
5068
* Returns socked id
@@ -84,6 +102,9 @@ int set_nonblocking(int fd);
84102

85103
void connect_to_srv(const char *addr, const char *port, const char *cc_desc, const char *pwd)
86104
{
105+
#ifndef DISABLE_RUST
106+
return ccxr_connect_to_srv(addr, port, cc_desc, pwd);
107+
#endif
87108
if (NULL == addr)
88109
{
89110
mprint("Server address is not set\n");
@@ -115,6 +136,9 @@ void connect_to_srv(const char *addr, const char *port, const char *cc_desc, con
115136

116137
void net_send_header(const unsigned char *data, size_t len)
117138
{
139+
#ifndef DISABLE_RUST
140+
return ccxr_net_send_header(data, len);
141+
#endif
118142
assert(srv_sd > 0);
119143

120144
#if DEBUG_OUT
@@ -141,6 +165,9 @@ void net_send_header(const unsigned char *data, size_t len)
141165

142166
int net_send_cc(const unsigned char *data, int len, void *private_data, struct cc_subtitle *sub)
143167
{
168+
#ifndef DISABLE_RUST
169+
return ccxr_net_send_cc(data, len, private_data, sub);
170+
#endif
144171
assert(srv_sd > 0);
145172

146173
#if DEBUG_OUT
@@ -160,6 +187,9 @@ int net_send_cc(const unsigned char *data, int len, void *private_data, struct c
160187

161188
void net_check_conn()
162189
{
190+
#ifndef DISABLE_RUST
191+
return ccxr_net_check_conn();
192+
#endif
163193
time_t now;
164194
static time_t last_ping = 0;
165195
char c = 0;
@@ -221,6 +251,9 @@ void net_send_epg(
221251
const char *lang,
222252
const char *category)
223253
{
254+
#ifndef DISABLE_RUST
255+
return ccxr_net_send_epg(start, stop, title, desc, lang, category);
256+
#endif
224257
size_t st;
225258
size_t sp;
226259
size_t t;
@@ -301,6 +334,9 @@ void net_send_epg(
301334

302335
int net_tcp_read(int socket, void *buffer, size_t length)
303336
{
337+
#ifndef DISABLE_RUST
338+
return ccxr_net_tcp_read(socket, buffer, length);
339+
#endif
304340
assert(buffer != NULL);
305341
assert(length > 0);
306342

@@ -333,6 +369,9 @@ int net_tcp_read(int socket, void *buffer, size_t length)
333369

334370
int net_udp_read(int socket, void *buffer, size_t length, const char *src_str, const char *addr_str)
335371
{
372+
#ifndef DISABLE_RUST
373+
return ccxr_net_udp_read(socket, buffer, length, src_str, addr_str);
374+
#endif
336375
assert(buffer != NULL);
337376
assert(length > 0);
338377

@@ -519,6 +558,9 @@ int tcp_connect(const char *host, const char *port)
519558

520559
int start_tcp_srv(const char *port, const char *pwd)
521560
{
561+
#ifndef DISABLE_RUST
562+
return ccxr_start_tcp_srv(port, pwd);
563+
#endif
522564
if (NULL == port)
523565
port = DFT_PORT;
524566

@@ -974,6 +1016,10 @@ ssize_t read_byte(int fd, char *ch)
9741016

9751017
int start_upd_srv(const char *src_str, const char *addr_str, unsigned port)
9761018
{
1019+
#ifndef DISABLE_RUST
1020+
return ccxr_start_udp_srv(src_str, addr_str, port);
1021+
#endif
1022+
9771023
init_sockets();
9781024

9791025
in_addr_t src;

0 commit comments

Comments
 (0)