3
3
#include "lib_ccx.h"
4
4
#include "utility.h"
5
5
#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
6
16
7
17
static void ccx_demuxer_reset (struct ccx_demuxer * ctx )
8
18
{
19
+ #ifndef DISABLE_RUST
20
+ ccxr_demuxer_reset (ctx );
21
+ #else
9
22
ctx -> startbytes_pos = 0 ;
10
23
ctx -> startbytes_avail = 0 ;
11
24
ctx -> num_of_PIDs = 0 ;
@@ -17,25 +30,37 @@ static void ccx_demuxer_reset(struct ccx_demuxer *ctx)
17
30
}
18
31
memset (ctx -> stream_id_of_each_pid , 0 , (MAX_PSI_PID + 1 ) * sizeof (uint8_t ));
19
32
memset (ctx -> PIDs_programs , 0 , 65536 * sizeof (struct PMT_entry * ));
33
+ #endif
20
34
}
21
35
22
36
static void ccx_demuxer_close (struct ccx_demuxer * ctx )
23
37
{
38
+ #ifndef DISABLE_RUST
39
+ ccxr_demuxer_close (ctx );
40
+ #else
24
41
ctx -> past = 0 ;
25
42
if (ctx -> infd != -1 && ccx_options .input_source == CCX_DS_FILE )
26
43
{
27
44
close (ctx -> infd );
28
45
ctx -> infd = -1 ;
29
46
activity_input_file_closed ();
30
47
}
48
+ #endif
31
49
}
32
50
33
51
static int ccx_demuxer_isopen (struct ccx_demuxer * ctx )
34
52
{
53
+ #ifndef DISABLE_RUST
54
+ return ccxr_demuxer_isopen (ctx );
55
+ #else
35
56
return ctx -> infd != -1 ;
57
+ #endif
36
58
}
37
59
static int ccx_demuxer_open (struct ccx_demuxer * ctx , const char * file )
38
60
{
61
+ #ifndef DISABLE_RUST
62
+ return ccxr_demuxer_open (ctx , file );
63
+ #else
39
64
ctx -> past = 0 ;
40
65
ctx -> min_global_timestamp = 0 ;
41
66
ctx -> global_timestamp_inited = 0 ;
@@ -193,9 +218,13 @@ static int ccx_demuxer_open(struct ccx_demuxer *ctx, const char *file)
193
218
}
194
219
195
220
return 0 ;
221
+ #endif
196
222
}
197
223
LLONG ccx_demuxer_get_file_size (struct ccx_demuxer * ctx )
198
224
{
225
+ #ifndef DISABLE_RUST
226
+ return ccxr_demuxer_get_file_size (ctx );
227
+ #else
199
228
LLONG ret = 0 ;
200
229
int in = ctx -> infd ;
201
230
LLONG current = LSEEK (in , 0 , SEEK_CUR );
@@ -208,15 +237,23 @@ LLONG ccx_demuxer_get_file_size(struct ccx_demuxer *ctx)
208
237
return -1 ;
209
238
210
239
return length ;
240
+ #endif
211
241
}
212
242
213
243
static int ccx_demuxer_get_stream_mode (struct ccx_demuxer * ctx )
214
244
{
245
+ #ifndef DISABLE_RUST
246
+ return ccxr_demuxer_get_stream_mode (ctx );
247
+ #else
215
248
return ctx -> stream_mode ;
249
+ #endif
216
250
}
217
251
218
252
static void ccx_demuxer_print_cfg (struct ccx_demuxer * ctx )
219
253
{
254
+ #ifndef DISABLE_RUST
255
+ ccxr_demuxer_print_cfg (ctx );
256
+ #else
220
257
switch (ctx -> auto_stream )
221
258
{
222
259
case CCX_SM_ELEMENTARY_OR_NOT_FOUND :
@@ -261,10 +298,14 @@ static void ccx_demuxer_print_cfg(struct ccx_demuxer *ctx)
261
298
fatal (CCX_COMMON_EXIT_BUG_BUG , "BUG: Unknown stream mode. Please file a bug report on Github.\n" );
262
299
break ;
263
300
}
301
+ #endif
264
302
}
265
303
266
304
void ccx_demuxer_delete (struct ccx_demuxer * * ctx )
267
305
{
306
+ #ifndef DISABLE_RUST
307
+ ccxr_demuxer_delete (ctx );
308
+ #else
268
309
struct ccx_demuxer * lctx = * ctx ;
269
310
int i ;
270
311
dinit_cap (lctx );
@@ -287,6 +328,7 @@ void ccx_demuxer_delete(struct ccx_demuxer **ctx)
287
328
288
329
freep (& lctx -> filebuffer );
289
330
freep (ctx );
331
+ #endif
290
332
}
291
333
292
334
struct ccx_demuxer * init_demuxer (void * parent , struct demuxer_cfg * cfg )
0 commit comments