Skip to content

Commit 8dd043f

Browse files
committed
written extern functions for demuxer
1 parent 4c148c3 commit 8dd043f

File tree

21 files changed

+985
-232
lines changed

21 files changed

+985
-232
lines changed

src/lib_ccx/ccx_demuxer.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,22 @@
33
#include "lib_ccx.h"
44
#include "utility.h"
55
#include "ffmpeg_intgr.h"
6+
#ifndef DISABLE_RUST
7+
void ccxr_demuxer_reset(struct ccx_demuxer *ctx);
8+
void ccxr_demuxer_close(struct ccx_demuxer *ctx);
9+
int ccxr_demuxer_isopen(const struct ccx_demuxer *ctx);
10+
int ccxr_demuxer_open(struct ccx_demuxer *ctx, const char *file);
11+
LLONG ccxr_demuxer_get_file_size(struct ccx_demuxer *ctx);
12+
int ccxr_demuxer_get_stream_mode(const struct ccx_demuxer *ctx);
13+
void ccxr_demuxer_print_cfg(const struct ccx_demuxer *ctx);
14+
void ccxr_demuxer_delete(struct ccx_demuxer **ctx);
15+
#endif
616

717
static void ccx_demuxer_reset(struct ccx_demuxer *ctx)
818
{
19+
#ifndef DISABLE_RUST
20+
ccxr_demuxer_reset(ctx);
21+
#else
922
ctx->startbytes_pos = 0;
1023
ctx->startbytes_avail = 0;
1124
ctx->num_of_PIDs = 0;
@@ -17,25 +30,37 @@ static void ccx_demuxer_reset(struct ccx_demuxer *ctx)
1730
}
1831
memset(ctx->stream_id_of_each_pid, 0, (MAX_PSI_PID + 1) * sizeof(uint8_t));
1932
memset(ctx->PIDs_programs, 0, 65536 * sizeof(struct PMT_entry *));
33+
#endif
2034
}
2135

2236
static void ccx_demuxer_close(struct ccx_demuxer *ctx)
2337
{
38+
#ifndef DISABLE_RUST
39+
ccxr_demuxer_close(ctx);
40+
#else
2441
ctx->past = 0;
2542
if (ctx->infd != -1 && ccx_options.input_source == CCX_DS_FILE)
2643
{
2744
close(ctx->infd);
2845
ctx->infd = -1;
2946
activity_input_file_closed();
3047
}
48+
#endif
3149
}
3250

3351
static int ccx_demuxer_isopen(struct ccx_demuxer *ctx)
3452
{
53+
#ifndef DISABLE_RUST
54+
return ccxr_demuxer_isopen(ctx);
55+
#else
3556
return ctx->infd != -1;
57+
#endif
3658
}
3759
static int ccx_demuxer_open(struct ccx_demuxer *ctx, const char *file)
3860
{
61+
#ifndef DISABLE_RUST
62+
return ccxr_demuxer_open(ctx, file);
63+
#else
3964
ctx->past = 0;
4065
ctx->min_global_timestamp = 0;
4166
ctx->global_timestamp_inited = 0;
@@ -193,9 +218,13 @@ static int ccx_demuxer_open(struct ccx_demuxer *ctx, const char *file)
193218
}
194219

195220
return 0;
221+
#endif
196222
}
197223
LLONG ccx_demuxer_get_file_size(struct ccx_demuxer *ctx)
198224
{
225+
#ifndef DISABLE_RUST
226+
return ccxr_demuxer_get_file_size(ctx);
227+
#else
199228
LLONG ret = 0;
200229
int in = ctx->infd;
201230
LLONG current = LSEEK(in, 0, SEEK_CUR);
@@ -208,15 +237,23 @@ LLONG ccx_demuxer_get_file_size(struct ccx_demuxer *ctx)
208237
return -1;
209238

210239
return length;
240+
#endif
211241
}
212242

213243
static int ccx_demuxer_get_stream_mode(struct ccx_demuxer *ctx)
214244
{
245+
#ifndef DISABLE_RUST
246+
return ccxr_demuxer_get_stream_mode(ctx);
247+
#else
215248
return ctx->stream_mode;
249+
#endif
216250
}
217251

218252
static void ccx_demuxer_print_cfg(struct ccx_demuxer *ctx)
219253
{
254+
#ifndef DISABLE_RUST
255+
ccxr_demuxer_print_cfg(ctx);
256+
#else
220257
switch (ctx->auto_stream)
221258
{
222259
case CCX_SM_ELEMENTARY_OR_NOT_FOUND:
@@ -261,10 +298,14 @@ static void ccx_demuxer_print_cfg(struct ccx_demuxer *ctx)
261298
fatal(CCX_COMMON_EXIT_BUG_BUG, "BUG: Unknown stream mode. Please file a bug report on Github.\n");
262299
break;
263300
}
301+
#endif
264302
}
265303

266304
void ccx_demuxer_delete(struct ccx_demuxer **ctx)
267305
{
306+
#ifndef DISABLE_RUST
307+
ccxr_demuxer_delete(ctx);
308+
#else
268309
struct ccx_demuxer *lctx = *ctx;
269310
int i;
270311
dinit_cap(lctx);
@@ -287,6 +328,7 @@ void ccx_demuxer_delete(struct ccx_demuxer **ctx)
287328

288329
freep(&lctx->filebuffer);
289330
freep(ctx);
331+
#endif
290332
}
291333

292334
struct ccx_demuxer *init_demuxer(void *parent, struct demuxer_cfg *cfg)

0 commit comments

Comments
 (0)