1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
|
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#include <dirent.h>
#include "wrappedlibs.h"
#include "debug.h"
#include "wrapper.h"
#include "bridge.h"
#include "librarian/library_private.h"
#include "x64emu.h"
#include "emu/x64emu_private.h"
#include "callback.h"
#include "librarian.h"
#include "box64context.h"
#include "emu/x64emu_private.h"
#include "myalign.h"
#include "gtkclass.h"
#include "fileutils.h"
const char* gstreamerName = "libgstreamer-1.0.so.0";
#define ALTNAME "libgstreamer-1.0.so"
#define LIBNAME gstreamer
typedef void (*vFv_t)();
typedef void* (*pFppA_t)(void*, void*, va_list);
typedef void* (*pFv_t)();
typedef size_t (*LFv_t)();
typedef void* (*pFp_t)(void*);
typedef void (*vFpp_t)(void*, void*);
typedef int (*iFpp_t)(void*, void*);
void* my_dlopen(x64emu_t* emu, void *filename, int flag);
int my_dlclose(x64emu_t* emu, void *handle);
void* my_dlsym(x64emu_t* emu, void *handle, void *symbol);
#ifndef MAX_PATH
#define MAX_PATH 4096
#endif
#define ADDED_FUNCTIONS() \
GO(gst_object_get_type, LFv_t) \
GO(gst_allocator_get_type, LFv_t) \
GO(gst_task_pool_get_type, LFv_t) \
GO(gst_element_get_type, LFv_t) \
GO(gst_bin_get_type, LFv_t) \
GO(gst_pad_get_type, LFv_t) \
GO(gst_uri_handler_get_type, LFv_t) \
GO(gst_buffer_pool_get_type, LFv_t) \
GO(gst_structure_new_empty, pFp_t) \
GO(gst_caps_new_empty, pFv_t) \
GO(gst_caps_replace, iFpp_t) \
GO(gst_caps_append_structure, vFpp_t) \
GO(gst_bin_add, iFpp_t) \
GO(gst_element_link, iFpp_t) \
typedef struct my_gst_plugin_s {
void* handle;
int is_native;
} my_gst_plugin_t;
#define ADDED_STRUCT() \
int plugin_cnt; \
int plugin_cap; \
my_gst_plugin_t* plugins; \
#define ADDED_FINI() \
for(int i=0; i<my->plugin_cnt; ++i) { \
if(my->plugins[i].is_native) \
dlclose(my->plugins[i].handle); \
else \
my_dlclose(thread_get_emu(), my->plugins[i].handle); \
} \
if(my->plugins) box_free(my->plugins); \
#include "generated/wrappedgstreamertypes.h"
#include "wrappercallback.h"
#define SUPER() \
GO(0) \
GO(1) \
GO(2) \
GO(3) \
GO(4) \
GO(5) \
GO(6) \
GO(7) \
GO(8) \
GO(9) \
GO(10) \
GO(11) \
GO(12) \
// GDestroyFunc ...
#define GO(A) \
static uintptr_t my_destroyfunc_fct_##A = 0; \
static int my_destroyfunc_##A(void* a, void* b) \
{ \
return RunFunctionFmt(my_destroyfunc_fct_##A, "pp", a, b); \
}
SUPER()
#undef GO
static void* findDestroyFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_destroyfunc_fct_##A == (uintptr_t)fct) return my_destroyfunc_##A;
SUPER()
#undef GO
#define GO(A) if(my_destroyfunc_fct_##A == 0) {my_destroyfunc_fct_##A = (uintptr_t)fct; return my_destroyfunc_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GDestroyNotify callback\n");
return NULL;
}
//GstPadActivateModeFunction
#define GO(A) \
static uintptr_t my_GstPadActivateModeFunction_fct_##A = 0; \
static int my_GstPadActivateModeFunction_##A(void* a, void* b, int c, int d) \
{ \
return (int)RunFunctionFmt(my_GstPadActivateModeFunction_fct_##A, "ppii", a, b, c, d); \
}
SUPER()
#undef GO
static void* findGstPadActivateModeFunctionFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstPadActivateModeFunction_fct_##A == (uintptr_t)fct) return my_GstPadActivateModeFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstPadActivateModeFunction_fct_##A == 0) {my_GstPadActivateModeFunction_fct_##A = (uintptr_t)fct; return my_GstPadActivateModeFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstPadActivateModeFunction callback\n");
return NULL;
}
//GstPadQueryFunction
#define GO(A) \
static uintptr_t my_GstPadQueryFunction_fct_##A = 0; \
static int my_GstPadQueryFunction_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GstPadQueryFunction_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstPadQueryFunctionFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstPadQueryFunction_fct_##A == (uintptr_t)fct) return my_GstPadQueryFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstPadQueryFunction_fct_##A == 0) {my_GstPadQueryFunction_fct_##A = (uintptr_t)fct; return my_GstPadQueryFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstPadQueryFunction callback\n");
return NULL;
}
//GstPadGetRangeFunction
#define GO(A) \
static uintptr_t my_GstPadGetRangeFunction_fct_##A = 0; \
static int my_GstPadGetRangeFunction_##A(void* a, void* b, uint64_t c, uint32_t d, void* e) \
{ \
return (int)RunFunctionFmt(my_GstPadGetRangeFunction_fct_##A, "ppUup", a, b, c, d, e); \
}
SUPER()
#undef GO
static void* findGstPadGetRangeFunctionFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstPadGetRangeFunction_fct_##A == (uintptr_t)fct) return my_GstPadGetRangeFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstPadGetRangeFunction_fct_##A == 0) {my_GstPadGetRangeFunction_fct_##A = (uintptr_t)fct; return my_GstPadGetRangeFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstPadGetRangeFunction callback\n");
return NULL;
}
//GstPadChainFunction
#define GO(A) \
static uintptr_t my_GstPadChainFunction_fct_##A = 0; \
static int my_GstPadChainFunction_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GstPadChainFunction_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstPadChainFunctionFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstPadChainFunction_fct_##A == (uintptr_t)fct) return my_GstPadChainFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstPadChainFunction_fct_##A == 0) {my_GstPadChainFunction_fct_##A = (uintptr_t)fct; return my_GstPadChainFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstPadChainFunction callback\n");
return NULL;
}
//GstPadEventFunction
#define GO(A) \
static uintptr_t my_GstPadEventFunction_fct_##A = 0; \
static int my_GstPadEventFunction_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GstPadEventFunction_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstPadEventFunctionFct(void* fct)
{
if(!fct) return fct;
#define GO(A) if(my_GstPadEventFunction_fct_##A == (uintptr_t)fct) return my_GstPadEventFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstPadEventFunction_fct_##A == 0) {my_GstPadEventFunction_fct_##A = (uintptr_t)fct; return my_GstPadEventFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstPadEventFunction callback\n");
return NULL;
}
//GstBusSyncHandler
#define GO(A) \
static uintptr_t my_GstBusSyncHandler_fct_##A = 0; \
static int my_GstBusSyncHandler_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GstBusSyncHandler_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstBusSyncHandlerFct(void* fct)
{
if(!fct) return fct;
#define GO(A) if(my_GstBusSyncHandler_fct_##A == (uintptr_t)fct) return my_GstBusSyncHandler_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstBusSyncHandler_fct_##A == 0) {my_GstBusSyncHandler_fct_##A = (uintptr_t)fct; return my_GstBusSyncHandler_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstBusSyncHandler callback\n");
return NULL;
}
//GstBusFunc
#define GO(A) \
static uintptr_t my_GstBusFunc_fct_##A = 0; \
static int my_GstBusFunc_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GstBusFunc_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstBusFuncFct(void* fct)
{
if(!fct) return fct;
#define GO(A) if(my_GstBusFunc_fct_##A == (uintptr_t)fct) return my_GstBusFunc_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstBusFunc_fct_##A == 0) {my_GstBusFunc_fct_##A = (uintptr_t)fct; return my_GstBusFunc_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstBusFunc callback\n");
return NULL;
}
//GstPluginFeatureFilter
#define GO(A) \
static uintptr_t my_GstPluginFeatureFilter_fct_##A = 0; \
static int my_GstPluginFeatureFilter_##A(void* a, void* b) \
{ \
return (int)RunFunctionFmt(my_GstPluginFeatureFilter_fct_##A, "pp", a, b); \
}
SUPER()
#undef GO
static void* findGstPluginFeatureFilterFct(void* fct)
{
if(!fct) return fct;
#define GO(A) if(my_GstPluginFeatureFilter_fct_##A == (uintptr_t)fct) return my_GstPluginFeatureFilter_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstPluginFeatureFilter_fct_##A == 0) {my_GstPluginFeatureFilter_fct_##A = (uintptr_t)fct; return my_GstPluginFeatureFilter_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstPluginFeatureFilter callback\n");
return NULL;
}
//GstCapsFilterMapFunc
#define GO(A) \
static uintptr_t my_GstCapsFilterMapFunc_fct_##A = 0; \
static int my_GstCapsFilterMapFunc_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GstCapsFilterMapFunc_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstCapsFilterMapFuncFct(void* fct)
{
if(!fct) return fct;
#define GO(A) if(my_GstCapsFilterMapFunc_fct_##A == (uintptr_t)fct) return my_GstCapsFilterMapFunc_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstCapsFilterMapFunc_fct_##A == 0) {my_GstCapsFilterMapFunc_fct_##A = (uintptr_t)fct; return my_GstCapsFilterMapFunc_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstCapsFilterMapFunc callback\n");
return NULL;
}
//GstPluginInit
#define GO(A) \
static uintptr_t my_GstPluginInit_fct_##A = 0; \
static int my_GstPluginInit_##A(void* a) \
{ \
return (int)RunFunctionFmt(my_GstPluginInit_fct_##A, "p", a); \
}
SUPER()
#undef GO
static void* findGstPluginInitFct(void* fct)
{
if(!fct) return fct;
#define GO(A) if(my_GstPluginInit_fct_##A == (uintptr_t)fct) return my_GstPluginInit_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstPluginInit_fct_##A == 0) {my_GstPluginInit_fct_##A = (uintptr_t)fct; return my_GstPluginInit_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstPluginInit callback\n");
return NULL;
}
//GstIteratorFoldFunction
#define GO(A) \
static uintptr_t my_GstIteratorFoldFunction_fct_##A = 0; \
static int my_GstIteratorFoldFunction_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GstIteratorFoldFunction_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstIteratorFoldFunctionFct(void* fct)
{
if(!fct) return fct;
#define GO(A) if(my_GstIteratorFoldFunction_fct_##A == (uintptr_t)fct) return my_GstIteratorFoldFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstIteratorFoldFunction_fct_##A == 0) {my_GstIteratorFoldFunction_fct_##A = (uintptr_t)fct; return my_GstIteratorFoldFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstIteratorFoldFunction callback\n");
return NULL;
}
//GCompareFunc
#define GO(A) \
static uintptr_t my_GCompareFunc_fct_##A = 0; \
static int my_GCompareFunc_##A(void* a, void* b) \
{ \
return (int)RunFunctionFmt(my_GCompareFunc_fct_##A, "pp", a, b); \
}
SUPER()
#undef GO
static void* findGCompareFuncFct(void* fct)
{
if(!fct) return fct;
#define GO(A) if(my_GCompareFunc_fct_##A == (uintptr_t)fct) return my_GCompareFunc_##A;
SUPER()
#undef GO
#define GO(A) if(my_GCompareFunc_fct_##A == 0) {my_GCompareFunc_fct_##A = (uintptr_t)fct; return my_GCompareFunc_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GCompareFunc callback\n");
return NULL;
}
//GCompareDataFunc
#define GO(A) \
static uintptr_t my_GCompareDataFunc_fct_##A = 0; \
static int my_GCompareDataFunc_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GCompareDataFunc_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGCompareDataFuncFct(void* fct)
{
if(!fct) return fct;
#define GO(A) if(my_GCompareDataFunc_fct_##A == (uintptr_t)fct) return my_GCompareDataFunc_##A;
SUPER()
#undef GO
#define GO(A) if(my_GCompareDataFunc_fct_##A == 0) {my_GCompareDataFunc_fct_##A = (uintptr_t)fct; return my_GCompareDataFunc_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GCompareDataFunc callback\n");
return NULL;
}
//GstTaskFunction
#define GO(A) \
static uintptr_t my_GstTaskFunction_fct_##A = 0; \
static void my_GstTaskFunction_##A(void* a) \
{ \
RunFunctionFmt(my_GstTaskFunction_fct_##A, "p", a); \
}
SUPER()
#undef GO
static void* findGstTaskFunctionFct(void* fct)
{
if(!fct) return fct;
#define GO(A) if(my_GstTaskFunction_fct_##A == (uintptr_t)fct) return my_GstTaskFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstTaskFunction_fct_##A == 0) {my_GstTaskFunction_fct_##A = (uintptr_t)fct; return my_GstTaskFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstTaskFunction callback\n");
return NULL;
}
//GstTagForeachFunc
#define GO(A) \
static uintptr_t my_GstTagForeachFunc_fct_##A = 0; \
static void my_GstTagForeachFunc_##A(void* a, void* b, void* c) \
{ \
RunFunctionFmt(my_GstTagForeachFunc_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstTagForeachFuncFct(void* fct)
{
if(!fct) return fct;
#define GO(A) if(my_GstTagForeachFunc_fct_##A == (uintptr_t)fct) return my_GstTagForeachFunc_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstTagForeachFunc_fct_##A == 0) {my_GstTagForeachFunc_fct_##A = (uintptr_t)fct; return my_GstTagForeachFunc_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstTagForeachFunc callback\n");
return NULL;
}
//GstPadActivateFunction
#define GO(A) \
static uintptr_t my_GstPadActivateFunction_fct_##A = 0; \
static int my_GstPadActivateFunction_##A(void* a, void* b) \
{ \
return (int)RunFunctionFmt(my_GstPadActivateFunction_fct_##A, "pp", a, b); \
}
SUPER()
#undef GO
static void* findGstPadActivateFunctionFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstPadActivateFunction_fct_##A == (uintptr_t)fct) return my_GstPadActivateFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstPadActivateFunction_fct_##A == 0) {my_GstPadActivateFunction_fct_##A = (uintptr_t)fct; return my_GstPadActivateFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstPadActivateFunction callback\n");
return NULL;
}
//GstPadProbeCallback
#define GO(A) \
static uintptr_t my_GstPadProbeCallback_fct_##A = 0; \
static int my_GstPadProbeCallback_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GstPadProbeCallback_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstPadProbeCallbackFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstPadProbeCallback_fct_##A == (uintptr_t)fct) return my_GstPadProbeCallback_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstPadProbeCallback_fct_##A == 0) {my_GstPadProbeCallback_fct_##A = (uintptr_t)fct; return my_GstPadProbeCallback_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstPadProbeCallback callback\n");
return NULL;
}
//GstStructureForeachFunc
#define GO(A) \
static uintptr_t my_GstStructureForeachFunc_fct_##A = 0; \
static int my_GstStructureForeachFunc_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GstStructureForeachFunc_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstStructureForeachFuncFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstStructureForeachFunc_fct_##A == (uintptr_t)fct) return my_GstStructureForeachFunc_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstStructureForeachFunc_fct_##A == 0) {my_GstStructureForeachFunc_fct_##A = (uintptr_t)fct; return my_GstStructureForeachFunc_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstStructureForeachFunc callback\n");
return NULL;
}
//GstPadLinkFunction
#define GO(A) \
static uintptr_t my_GstPadLinkFunction_fct_##A = 0; \
static int my_GstPadLinkFunction_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GstPadLinkFunction_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstPadLinkFunctionFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstPadLinkFunction_fct_##A == (uintptr_t)fct) return my_GstPadLinkFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstPadLinkFunction_fct_##A == 0) {my_GstPadLinkFunction_fct_##A = (uintptr_t)fct; return my_GstPadLinkFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstPadLinkFunction callback\n");
return NULL;
}
//GstStructureFilterMapFunc
#define GO(A) \
static uintptr_t my_GstStructureFilterMapFunc_fct_##A = 0; \
static int my_GstStructureFilterMapFunc_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GstStructureFilterMapFunc_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstStructureFilterMapFuncFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstStructureFilterMapFunc_fct_##A == (uintptr_t)fct) return my_GstStructureFilterMapFunc_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstStructureFilterMapFunc_fct_##A == 0) {my_GstStructureFilterMapFunc_fct_##A = (uintptr_t)fct; return my_GstStructureFilterMapFunc_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstStructureFilterMapFunc callback\n");
return NULL;
}
//GstElementForeachPadFunc
#define GO(A) \
static uintptr_t my_GstElementForeachPadFunc_fct_##A = 0; \
static int my_GstElementForeachPadFunc_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GstElementForeachPadFunc_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstElementForeachPadFuncFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstElementForeachPadFunc_fct_##A == (uintptr_t)fct) return my_GstElementForeachPadFunc_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstElementForeachPadFunc_fct_##A == 0) {my_GstElementForeachPadFunc_fct_##A = (uintptr_t)fct; return my_GstElementForeachPadFunc_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstElementForeachPadFunc callback\n");
return NULL;
}
//GstTypeFindFunction
#define GO(A) \
static uintptr_t my_GstTypeFindFunction_fct_##A = 0; \
static void my_GstTypeFindFunction_##A(void* a, void* b) \
{ \
RunFunctionFmt(my_GstTypeFindFunction_fct_##A, "pp", a, b); \
}
SUPER()
#undef GO
static void* findGstTypeFindFunctionFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstTypeFindFunction_fct_##A == (uintptr_t)fct) return my_GstTypeFindFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstTypeFindFunction_fct_##A == 0) {my_GstTypeFindFunction_fct_##A = (uintptr_t)fct; return my_GstTypeFindFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstTypeFindFunction callback\n");
return NULL;
}
//GstPadIterIntLinkFunction
#define GO(A) \
static uintptr_t my_GstPadIterIntLinkFunction_fct_##A = 0; \
static void* my_GstPadIterIntLinkFunction_##A(void* a, void* b) \
{ \
return (void*)RunFunctionFmt(my_GstPadIterIntLinkFunction_fct_##A, "pp", a, b); \
}
SUPER()
#undef GO
static void* findGstPadIterIntLinkFunctionFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstPadIterIntLinkFunction_fct_##A == (uintptr_t)fct) return my_GstPadIterIntLinkFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstPadIterIntLinkFunction_fct_##A == 0) {my_GstPadIterIntLinkFunction_fct_##A = (uintptr_t)fct; return my_GstPadIterIntLinkFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstPadIterIntLinkFunction callback\n");
return NULL;
}
//GstPadStickyEventsForeachFunction
#define GO(A) \
static uintptr_t my_GstPadStickyEventsForeachFunction_fct_##A = 0; \
static int my_GstPadStickyEventsForeachFunction_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GstPadStickyEventsForeachFunction_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstPadStickyEventsForeachFunctionFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstPadStickyEventsForeachFunction_fct_##A == (uintptr_t)fct) return my_GstPadStickyEventsForeachFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstPadStickyEventsForeachFunction_fct_##A == 0) {my_GstPadStickyEventsForeachFunction_fct_##A = (uintptr_t)fct; return my_GstPadStickyEventsForeachFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstPadStickyEventsForeachFunction callback\n");
return NULL;
}
//GstBufferForeachMetaFunc
#define GO(A) \
static uintptr_t my_GstBufferForeachMetaFunc_fct_##A = 0; \
static int my_GstBufferForeachMetaFunc_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_GstBufferForeachMetaFunc_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* findGstBufferForeachMetaFuncFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstBufferForeachMetaFunc_fct_##A == (uintptr_t)fct) return my_GstBufferForeachMetaFunc_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstBufferForeachMetaFunc_fct_##A == 0) {my_GstBufferForeachMetaFunc_fct_##A = (uintptr_t)fct; return my_GstBufferForeachMetaFunc_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstBufferForeachMetaFunc callback\n");
return NULL;
}
//GstMiniObjectCopyFunction
#define GO(A) \
static uintptr_t my_GstMiniObjectCopyFunction_fct_##A = 0; \
static void* my_GstMiniObjectCopyFunction_##A(void* a) \
{ \
return (void*)RunFunctionFmt(my_GstMiniObjectCopyFunction_fct_##A, "p", a); \
}
SUPER()
#undef GO
static void* findGstMiniObjectCopyFunctionFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstMiniObjectCopyFunction_fct_##A == (uintptr_t)fct) return my_GstMiniObjectCopyFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstMiniObjectCopyFunction_fct_##A == 0) {my_GstMiniObjectCopyFunction_fct_##A = (uintptr_t)fct; return my_GstMiniObjectCopyFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstMiniObjectCopyFunction callback\n");
return NULL;
}
//GstMiniObjectDisposeFunction
#define GO(A) \
static uintptr_t my_GstMiniObjectDisposeFunction_fct_##A = 0; \
static int my_GstMiniObjectDisposeFunction_##A(void* a) \
{ \
return (int)RunFunctionFmt(my_GstMiniObjectDisposeFunction_fct_##A, "p", a); \
}
SUPER()
#undef GO
static void* findGstMiniObjectDisposeFunctionFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstMiniObjectDisposeFunction_fct_##A == (uintptr_t)fct) return my_GstMiniObjectDisposeFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstMiniObjectDisposeFunction_fct_##A == 0) {my_GstMiniObjectDisposeFunction_fct_##A = (uintptr_t)fct; return my_GstMiniObjectDisposeFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstMiniObjectDisposeFunction callback\n");
return NULL;
}
//GstMiniObjectFreeFunction
#define GO(A) \
static uintptr_t my_GstMiniObjectFreeFunction_fct_##A = 0; \
static void my_GstMiniObjectFreeFunction_##A(void* a) \
{ \
RunFunctionFmt(my_GstMiniObjectFreeFunction_fct_##A, "p", a); \
}
SUPER()
#undef GO
static void* findGstMiniObjectFreeFunctionFct(void* fct)
{
if(!fct) return fct;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GstMiniObjectFreeFunction_fct_##A == (uintptr_t)fct) return my_GstMiniObjectFreeFunction_##A;
SUPER()
#undef GO
#define GO(A) if(my_GstMiniObjectFreeFunction_fct_##A == 0) {my_GstMiniObjectFreeFunction_fct_##A = (uintptr_t)fct; return my_GstMiniObjectFreeFunction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstMiniObjectFreeFunction callback\n");
return NULL;
}
#undef SUPER
EXPORT void my_gst_caps_set_simple(x64emu_t* emu, void* caps, void* field, void* b) {
CREATE_VALIST_FROM_VAARG(b, emu->scratch, 2);
my->gst_caps_set_simple_valist(caps, field, VARARGS);
}
EXPORT void my_gst_caps_set_simple_valist(x64emu_t* emu, void* caps, void* field, x64_va_list_t V) {
#ifdef CONVERT_VALIST
CONVERT_VALIST(V);
#else
CREATE_VALIST_FROM_VALIST(V, emu->scratch);
#endif
my->gst_caps_set_simple_valist(caps, field, VARARGS);
}
EXPORT void my_gst_structure_remove_fields(x64emu_t* emu, void* structure, void* field, void* b) {
CREATE_VALIST_FROM_VAARG(b, emu->scratch, 2);
my->gst_structure_remove_fields_valist(structure, field, VARARGS);
}
EXPORT void my_gst_structure_remove_fields_valist(x64emu_t* emu, void* structure, void* field, x64_va_list_t V) {
#ifdef CONVERT_VALIST
CONVERT_VALIST(V);
#else
CREATE_VALIST_FROM_VALIST(V, emu->scratch);
#endif
my->gst_structure_remove_fields_valist(structure, field, VARARGS);
}
EXPORT void my_gst_debug_log(x64emu_t* emu, void* cat, uint32_t level, void* file, void* func, int line, void* obj, void* fmt, void* b) {
myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 7);
PREPARE_VALIST;
my->gst_debug_log_valist(cat, level, file, func, line, obj, fmt, VARARGS);
}
EXPORT void my_gst_debug_log_valist(x64emu_t* emu, void* cat, uint32_t level, void* file, void* func, int line, void* obj, void* fmt, x64_va_list_t V) {
#ifdef CONVERT_VALIST
CONVERT_VALIST(V);
#else
myStackAlignValist(emu, (const char*)fmt, emu->scratch, V);
PREPARE_VALIST;
#endif
my->gst_debug_log_valist(cat, level, file, func, line, obj, fmt, VARARGS);
}
EXPORT int my_gst_structure_get(x64emu_t* emu, void* structure, void* field, void* b) {
CREATE_VALIST_FROM_VAARG(b, emu->scratch, 2);
return my->gst_structure_get_valist(structure, field, VARARGS);
}
EXPORT int my_gst_structure_get_valist(x64emu_t* emu, void* structure, void* field, x64_va_list_t V) {
#ifdef CONVERT_VALIST
CONVERT_VALIST(V);
#else
CREATE_VALIST_FROM_VALIST(V, emu->scratch);
#endif
return my->gst_structure_get_valist(structure, field, VARARGS);
}
EXPORT void my_gst_pad_set_activatemode_function_full(x64emu_t* emu, void* pad, void* f, void* data, void* d)
{
my->gst_pad_set_activatemode_function_full(pad, findGstPadActivateModeFunctionFct(f), data, findDestroyFct(d));
}
EXPORT void my_gst_pad_set_query_function_full(x64emu_t* emu, void* pad, void* f, void* data, void* d)
{
my->gst_pad_set_query_function_full(pad, findGstPadQueryFunctionFct(f), data, findDestroyFct(d));
}
EXPORT void my_gst_pad_set_getrange_function_full(x64emu_t* emu, void* pad, void* f, void* data, void* d)
{
my->gst_pad_set_getrange_function_full(pad, findGstPadGetRangeFunctionFct(f), data, findDestroyFct(d));
}
EXPORT void my_gst_pad_set_chain_function_full(x64emu_t* emu, void* pad, void* f, void* data, void* d)
{
my->gst_pad_set_chain_function_full(pad, findGstPadChainFunctionFct(f), data, findDestroyFct(d));
}
EXPORT void my_gst_pad_set_event_function_full(x64emu_t* emu, void* pad, void* f, void* data, void* d)
{
my->gst_pad_set_event_function_full(pad, findGstPadEventFunctionFct(f), data, findDestroyFct(d));
}
EXPORT void my_gst_bus_set_sync_handler(x64emu_t* emu, void* bus, void* f, void* data, void* d)
{
my->gst_bus_set_sync_handler(bus, findGstBusSyncHandlerFct(f), data, findDestroyFct(d));
}
EXPORT void* my_gst_buffer_new_wrapped_full(x64emu_t* emu, uint32_t f, void* data, size_t maxsize, size_t offset, size_t size, void* user, void* d)
{
return my->gst_buffer_new_wrapped_full(f, data, maxsize, offset, size, user, findDestroyFct(d));
}
EXPORT void* my_gst_structure_new(x64emu_t* emu, void* name, void* first, uint64_t* b)
{
if(!first)
return my->gst_structure_new_empty(name);
CREATE_VALIST_FROM_VAARG(b, emu->scratch, 2);
return my->gst_structure_new_valist(name, first, VARARGS);
}
EXPORT void my_gst_mini_object_set_qdata(x64emu_t* emu, void* object, uint32_t quark, void* data, void* d)
{
my->gst_mini_object_set_qdata(object, quark, data, findDestroyFct(d));
}
EXPORT void* my_gst_caps_new_simple(x64emu_t* emu, void* type, void* name, void* b)
{
// need to unroll the function here, there is no direct VA equivalent
CREATE_VALIST_FROM_VAARG(b, emu->scratch, 2);
void* caps = my->gst_caps_new_empty();
void* structure = my->gst_structure_new_valist(type, name, VARARGS);
if (structure)
my->gst_caps_append_structure(caps, structure);
else
my->gst_caps_replace(&caps, NULL);
return caps;
}
EXPORT void* my_gst_registry_feature_filter(x64emu_t* emu, void* reg, void* filter, int first, void* data)
{
return my->gst_registry_feature_filter(reg, findGstPluginFeatureFilterFct(filter), first, data);
}
EXPORT int my_gst_caps_foreach(x64emu_t* emu, void* caps, void* f, void* data)
{
return my->gst_caps_foreach(caps, findGstCapsFilterMapFuncFct(f), data);
}
EXPORT uint32_t my_gst_bus_add_watch(x64emu_t* emu, void* bus, void* f, void* data)
{
return my->gst_bus_add_watch(bus, findGstBusFuncFct(f), data);
}
EXPORT uint32_t my_gst_bus_add_watch_full(x64emu_t* emu, void* bus, int priority, void* f, void* data, void* d)
{
return my->gst_bus_add_watch_full(bus, priority, findGstBusFuncFct(f), data, findDestroyFct(d));
}
EXPORT int my_gst_bin_add_many(x64emu_t* emu, void* bin, void* first, void** b)
{
int ret = my->gst_bin_add(bin, first);
while(ret && *b) {
ret = my->gst_bin_add(bin, *b);
++b;
}
return ret;
}
EXPORT int my_gst_element_link_many(x64emu_t* emu, void* e1, void* e2, void** b)
{
int ret = my->gst_element_link(e1, e2);
void* a = e2;
while(ret && *b) {
ret = my->gst_element_link(a, *b);
a = *b;
++b;
}
return ret;
}
EXPORT void* my_gst_plugin_load_file(x64emu_t* emu, const char* filename, void** error)
{
printf_log(LOG_INFO, "using gst_plugin_load_file, file %s (is x86_64=%d)\n", filename, FileIsX64ELF(filename));
return my->gst_plugin_load_file((void*)filename, error);
}
static void register_plugins_from_folder(x64emu_t* emu, const char* folder)
{
if(!folder) {
printf_log(/*LOG_DEBUG*/ LOG_INFO, "BOX64 didn't detect any custom gstreamer-1.0 folder\n");
return;
}
DIR *d;
struct dirent *dir;
// get folder where gstreamer came from
char native_folder[MAX_PATH+1] = {0};
Dl_info dli;
if(dladdr(my->gst_init_check, &dli)) {
strcpy(native_folder, dli.dli_fname);
char* p = strrchr(native_folder, '/');
*p = '\0';
strcat(native_folder, "/gstreamer-1.0/");
printf_log(/*LOG_DEBUG*/ LOG_INFO, "BOX64 Will look for native gstreamer plugin in %s\n", native_folder);
}
d = opendir(folder);
if(!d)
return;
while((dir = readdir(d)) != NULL) {
if(strstr(dir->d_name, "libgst")==dir->d_name && strstr(dir->d_name, ".so")) {
// handling this one, stripping to get the plugin name
char name[500];
int is_native = 0;
void* handle = NULL;
char filename[MAX_PATH];
char regfunc_name[500];
// get the name of the function
strcpy(name, dir->d_name + strlen("libgst"));
*strrchr(name, '.') = '\0';
snprintf(regfunc_name, sizeof(regfunc_name), "gst_plugin_%s_register", name);
// check if native version exist
if(native_folder[0]) {
strcpy(filename, native_folder);
strcat(filename, dir->d_name);
handle = dlopen(filename, 2);
}
if(handle)
is_native = 1;
else {
strcpy(filename, folder);
strcat(filename, "/");
strcat(filename, dir->d_name);
handle = my_dlopen(emu, filename, 2);
}
void* f_init = handle?(is_native?dlsym(handle, regfunc_name):my_dlsym(emu, handle, regfunc_name)):NULL;
if(f_init) {
printf_log(LOG_DEBUG, "Will registering %sgstplugin %s\n", is_native?"native ":"", filename);
if(is_native)
((vFv_t)(f_init))();
else
RunFunctionFmt((uintptr_t)f_init, "");
if(my->plugin_cnt==my->plugin_cap) {
my->plugin_cap += 8;
my->plugins = (my_gst_plugin_t*)box_realloc(my->plugins, my->plugin_cap*sizeof(my_gst_plugin_t));
}
my->plugins[my->plugin_cnt].is_native = is_native;
my->plugins[my->plugin_cnt++].handle = handle;
} else {
printf_log(LOG_DEBUG, "Failled to register %sgstplugin %s, name=%s, handle=%p\n", is_native?"native ":"", filename, name, handle);
}
if(handle && !f_init) {
is_native?dlclose(handle):my_dlclose(emu, handle);
handle = NULL;
}
}
}
closedir(d);
}
extern const char* box64_custom_gstreamer;
EXPORT int my_gst_init_check(x64emu_t* emu, int* argc, char*** argv, void** error)
{
int ret = my->gst_init_check(argc, argv, error);
register_plugins_from_folder(emu, box64_custom_gstreamer);
return ret;
}
EXPORT void my_gst_init(x64emu_t* emu, int* argc, char*** argv)
{
my->gst_init(argc, argv);
register_plugins_from_folder(emu, box64_custom_gstreamer);
}
EXPORT int my_gst_plugin_register_static(x64emu_t* emu, int maj_v, int min_v, void* name, void* desc, void* init_f, void* ver, void* lic, void* source, void* pack, void* orig)
{
return my->gst_plugin_register_static(maj_v, min_v, name, desc, findGstPluginInitFct(init_f), ver, lic, source, pack, orig);
}
EXPORT int my_gst_info_vasprintf(x64emu_t* emu, void* res, void* fmt, x64_va_list_t V)
{
#ifdef CONVERT_VALIST
CONVERT_VALIST(V);
#else
CREATE_VALIST_FROM_VALIST(V, emu->scratch);
#endif
return my->gst_info_vasprintf(res, fmt, VARARGS);
}
EXPORT void* my__gst_element_error_printf(x64emu_t* emu, void* fmt, uintptr_t* b)
{
char* buffer;
CREATE_VALIST_FROM_VAARG(b, emu->scratch, 1);
int len = my->gst_info_vasprintf(&buffer, fmt, VARARGS);
if(len<0)
buffer = NULL;
return buffer;
}
EXPORT void my_gst_structure_set_valist(x64emu_t* emu, void* st, void* fieldname, x64_va_list_t V)
{
#ifdef CONVERT_VALIST
CONVERT_VALIST(V);
#else
CREATE_VALIST_FROM_VALIST(V, emu->scratch);
#endif
my->gst_structure_set_valist(st, fieldname, VARARGS);
}
EXPORT void my_gst_structure_set(x64emu_t* emu, void* st, void* fieldname, uintptr_t* b)
{
CREATE_VALIST_FROM_VAARG(b, emu->scratch, 2);
my->gst_structure_set_valist(st, fieldname, VARARGS);
}
EXPORT uint32_t my_gst_iterator_fold(x64emu_t* emu, void* it, void* f, void* ret, void* data)
{
return my->gst_iterator_fold(it, findGstIteratorFoldFunctionFct(f), ret, data);
}
EXPORT void* my_gst_util_array_binary_search(x64emu_t* emu, void* array, uint32_t num, size_t size, void* f, uint32_t mode, void* search, void* data)
{
return my->gst_util_array_binary_search(array, num, size, findGCompareDataFuncFct(f), mode, search, data);
}
EXPORT void* my_gst_structure_new_valist(x64emu_t* emu, void* name, void* first, x64_va_list_t V)
{
#ifdef CONVERT_VALIST
CONVERT_VALIST(V);
#else
CREATE_VALIST_FROM_VALIST(V, emu->scratch);
#endif
return my->gst_structure_new_valist(name, first, VARARGS);
}
EXPORT void* my_gst_make_element_message_details(x64emu_t* emu, void* name, uintptr_t* b)
{
if(!name)
return NULL;
CREATE_VALIST_FROM_VAARG(b, emu->scratch, 1);
return my->gst_structure_new_valist("detail", name, VARARGS);
}
EXPORT int my_gst_pad_start_task(x64emu_t* emu, void* pad, void* f, void* data, void* d)
{
return my->gst_pad_start_task(pad, findGstTaskFunctionFct(f), data, findDestroyFct(d));
}
EXPORT void my_gst_tag_list_foreach(x64emu_t* emu, void* list, void* f, void* data)
{
my->gst_tag_list_foreach(list, findGstTagForeachFuncFct(f), data);
}
EXPORT void* my_gst_memory_new_wrapped(x64emu_t* emu, uint32_t flags, void* data, size_t maxsz, size_t offset, size_t size, void* user_data, void* d)
{
return my->gst_memory_new_wrapped(flags, data, maxsz, offset, size, user_data, findDestroyFct(d));
}
EXPORT void* my_gst_pad_create_stream_id_printf_valist(x64emu_t* emu, void* pad, void* parent, void* id, x64_va_list_t V)
{
#ifdef CONVERT_VALIST
CONVERT_VALIST(V);
#else
CREATE_VALIST_FROM_VALIST(V, emu->scratch);
#endif
return my->gst_pad_create_stream_id_printf_valist(pad, parent, id, VARARGS);
}
EXPORT void* my_gst_pad_create_stream_id_printf(x64emu_t* emu, void* pad, void* parent, void* id, uintptr_t* b)
{
CREATE_VALIST_FROM_VAARG(b, emu->scratch, 3);
return my->gst_pad_create_stream_id_printf_valist(pad, parent, id, VARARGS);
}
EXPORT void* my_gst_caps_features_new_id_valist(x64emu_t* emu, uint32_t id, x64_va_list_t V)
{
#ifdef CONVERT_VALIST
CONVERT_VALIST(V);
#else
CREATE_VALIST_FROM_VALIST(V, emu->scratch);
#endif
return my->gst_caps_features_new_id_valist(id, VARARGS);
}
EXPORT void* my_gst_caps_features_new_id(x64emu_t* emu, uint32_t id, uintptr_t* b)
{
CREATE_VALIST_FROM_VAARG(b, emu->scratch, 1);
return my->gst_caps_features_new_id_valist(id, VARARGS);
}
EXPORT void my_gst_pad_set_activate_function_full(x64emu_t* emu, void* pad, void* f, void* data, void* d)
{
my->gst_pad_set_activate_function_full(pad, findGstPadActivateFunctionFct(f), data, findDestroyFct(d));
}
EXPORT void my_gst_tag_list_add_valist(x64emu_t* emu, void* list, int mode, void* tag, x64_va_list_t V)
{
#ifdef CONVERT_VALIST
CONVERT_VALIST(V);
#else
CREATE_VALIST_FROM_VALIST(V, emu->scratch);
#endif
my->gst_tag_list_add_valist(list, mode, tag, VARARGS);
}
EXPORT void my_gst_tag_list_add(x64emu_t* emu, void* list, int mode, void* tag, uintptr_t* b)
{
CREATE_VALIST_FROM_VAARG(b, emu->scratch, 3);
my->gst_tag_list_add_valist(list, mode, tag, VARARGS);
}
EXPORT void* my_gst_tag_list_new_valist(x64emu_t* emu, x64_va_list_t V)
{
#ifdef CONVERT_VALIST
CONVERT_VALIST(V);
#else
CREATE_VALIST_FROM_VALIST(V, emu->scratch);
#endif
return my->gst_tag_list_new_valist(VARARGS);
}
EXPORT void* my_gst_tag_list_new(x64emu_t* emu, void* arg, uintptr_t* b)
{
// construct VARARGS with arg[0] too, because gst_tag_list_new_valist have just the va_list
CREATE_VALIST_FROM_VAARG(b, emu->scratch, 0);
return my->gst_tag_list_new_valist(VARARGS);
}
EXPORT void* my_gst_caps_features_new_valist(x64emu_t* emu, void* feat1, x64_va_list_t V)
{
#ifdef CONVERT_VALIST
CONVERT_VALIST(V);
#else
CREATE_VALIST_FROM_VALIST(V, emu->scratch);
#endif
return my->gst_caps_features_new_valist(feat1, VARARGS);
}
EXPORT void* my_gst_caps_features_new(x64emu_t* emu, void* feat1, uintptr_t* b)
{
CREATE_VALIST_FROM_VAARG(b, emu->scratch, 1);
return my->gst_caps_features_new_valist(feat1, VARARGS);
}
EXPORT unsigned long my_gst_pad_add_probe(x64emu_t* emu, void* pad, uint32_t mask, void* f, void* data, void* d)
{
return my->gst_pad_add_probe(pad, mask, findGstPadProbeCallbackFct(f), data, findDestroyFct(d));
}
EXPORT int my_gst_structure_foreach(x64emu_t* emu, void* st, void* f, void* data)
{
return my->gst_structure_foreach(st, findGstStructureForeachFuncFct(f), data);
}
EXPORT void my_gst_pad_set_link_function_full(x64emu_t* emu, void* pad, void* f, void* data, void *d)
{
my->gst_pad_set_link_function_full(pad, findGstPadLinkFunctionFct(f), data, findDestroyFct(d));
}
EXPORT void my_gst_tag_list_add_valist_values(x64emu_t* emu, void* list, int mode, void* tag, x64_va_list_t V)
{
#ifdef CONVERT_VALIST
CONVERT_VALIST(V);
#else
CREATE_VALIST_FROM_VALIST(V, emu->scratch);
#endif
my->gst_tag_list_add_valist_values(list, mode, tag, VARARGS);
}
EXPORT void my_gst_tag_list_add_values(x64emu_t* emu, void* list, int mode, void* tag, uintptr_t* b)
{
CREATE_VALIST_FROM_VAARG(b, emu->scratch, 3);
my->gst_tag_list_add_valist_values(list, mode, tag, VARARGS);
}
EXPORT void my_gst_structure_filter_and_map_in_place(x64emu_t* emu, void* s, void* f, void* data)
{
my->gst_structure_filter_and_map_in_place(s, findGstStructureFilterMapFuncFct(f), data);
}
EXPORT int my_gst_element_foreach_sink_pad(x64emu_t* emu, void* element, void* f, void* data)
{
return my->gst_element_foreach_sink_pad(element, findGstElementForeachPadFuncFct(f),data);
}
EXPORT void* my_gst_task_new(x64emu_t* emu, void* f, void* data, void* d)
{
return my->gst_task_new(findGstTaskFunctionFct(f), data, findDestroyFct(d));
}
EXPORT int my_gst_type_find_register(x64emu_t* emu, void* plugin, void* name, uint32_t rank, void* f, void* ext, void* caps, void* data, void* d)
{
return my->gst_type_find_register(plugin, name, rank, findGstTypeFindFunctionFct(f), ext, caps, data, findDestroyFct(f));
}
EXPORT void my_gst_pad_set_iterate_internal_links_function_full(x64emu_t* emu, void* pad, void* f, void* data, void* d)
{
my->gst_pad_set_iterate_internal_links_function_full(pad, findGstPadIterIntLinkFunctionFct(f), data, findDestroyFct(d));
}
EXPORT void my_gst_pad_sticky_events_foreach(x64emu_t* emu, void* pad, void* f, void* data)
{
my->gst_pad_sticky_events_foreach(pad, findGstPadStickyEventsForeachFunctionFct(f), data);
}
EXPORT int my_gst_buffer_foreach_meta(x64emu_t* emu, void* buff, void* f, void* data)
{
return my->gst_buffer_foreach_meta(buff, findGstBufferForeachMetaFuncFct(f), data);
}
EXPORT void my_gst_mini_object_init(x64emu_t* emu, void* obj, uint32_t flags, size_t type, void* copy_f, void* disp_f, void* free_f)
{
my->gst_mini_object_init(obj, flags, type, findGstMiniObjectCopyFunctionFct(copy_f), findGstMiniObjectDisposeFunctionFct(disp_f), findGstMiniObjectFreeFunctionFct(free_f));
}
EXPORT int my_gst_iterator_find_custom(x64emu_t* emu, void* it, void* f, void* elem, void* data)
{
return my->gst_iterator_find_custom(it, findGCompareFuncFct(f), elem, data);
}
#define PRE_INIT \
if(BOX64ENV(nogtk)) \
return -1;
#define CUSTOM_INIT \
SetGstObjectID(my->gst_object_get_type()); \
SetGstAllocatorID(my->gst_allocator_get_type()); \
SetGstTaskPoolID(my->gst_task_pool_get_type()); \
SetGstElementID(my->gst_element_get_type()); \
SetGstBinID(my->gst_bin_get_type()); \
SetGstPadID(my->gst_pad_get_type()); \
SetGstURIHandlerID(my->gst_uri_handler_get_type()); \
SetGstBufferPoolID(my->gst_buffer_pool_get_type()); \
#define NEEDED_LIBS "libgtk-3.so.0"
#include "wrappedlib_init.h"
|