about summary refs log tree commit diff stats
path: root/src/wrapped/wrappedgstreamer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wrapped/wrappedgstreamer.c')
-rw-r--r--src/wrapped/wrappedgstreamer.c95
1 files changed, 62 insertions, 33 deletions
diff --git a/src/wrapped/wrappedgstreamer.c b/src/wrapped/wrappedgstreamer.c
index 7c22cc6c..8a279866 100644
--- a/src/wrapped/wrappedgstreamer.c
+++ b/src/wrapped/wrappedgstreamer.c
@@ -32,6 +32,7 @@ typedef int     (*iFpp_t)(void*, void*);
 #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_structure_new_valist, pFppA_t)   \
     GO(gst_structure_new_empty, pFp_t)      \
     GO(gst_caps_new_empty, pFv_t)           \
@@ -50,10 +51,10 @@ GO(3)   \
 
 // GDestroyFunc ...
 #define GO(A)   \
-static uintptr_t my_destroyfunc_fct_##A = 0;   \
-static int my_destroyfunc_##A(void* a, void* b)     \
-{                                       \
-    return RunFunction(my_context, my_destroyfunc_fct_##A, 2, a, b);\
+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
@@ -74,10 +75,10 @@ static void* findDestroyFct(void* fct)
 }
 //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)RunFunction(my_context, my_GstPadActivateModeFunction_fct_##A, 4, a, b, c, d);  \
+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
@@ -97,10 +98,10 @@ static void* findGstPadActivateModeFunctionFct(void* fct)
 }
 //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)RunFunction(my_context, my_GstPadQueryFunction_fct_##A, 3, a, b, c);    \
+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
@@ -120,10 +121,10 @@ static void* findGstPadQueryFunctionFct(void* fct)
 }
 //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)RunFunction(my_context, my_GstPadGetRangeFunction_fct_##A, 5, a, b, c, d, e);   \
+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
@@ -143,10 +144,10 @@ static void* findGstPadGetRangeFunctionFct(void* fct)
 }
 //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)RunFunction(my_context, my_GstPadChainFunction_fct_##A, 3, a, b, c);    \
+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
@@ -166,10 +167,10 @@ static void* findGstPadChainFunctionFct(void* fct)
 }
 //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)RunFunction(my_context, my_GstPadEventFunction_fct_##A, 3, a, b, c);    \
+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
@@ -187,10 +188,10 @@ static void* findGstPadEventFunctionFct(void* fct)
 }
 //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)RunFunction(my_context, my_GstBusSyncHandler_fct_##A, 3, a, b, c);    \
+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
@@ -209,10 +210,10 @@ static void* findGstBusSyncHandlerFct(void* fct)
 
 //GstPluginFeatureFilter
 #define GO(A)   \
-static uintptr_t my_GstPluginFeatureFilter_fct_##A = 0;                                 \
-static int my_GstPluginFeatureFilter_##A(void* a, void* b)                              \
-{                                                                                       \
-    return (int)RunFunction(my_context, my_GstPluginFeatureFilter_fct_##A, 2, a, b);    \
+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
@@ -229,6 +230,28 @@ static void* findGstPluginFeatureFilterFct(void* fct)
     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;
+}
+
 #undef SUPER
 
 EXPORT void my_gst_caps_set_simple(x64emu_t* emu, void* caps, void* field, void* b) {
@@ -332,7 +355,7 @@ EXPORT void* my_gst_buffer_new_wrapped_full(x64emu_t* emu, uint32_t f, void* dat
 
 EXPORT void* my_gst_structure_new(x64emu_t* emu, void* name, void* first, uint64_t* b)
 {
-    if(!first)    
+    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);
@@ -362,6 +385,11 @@ EXPORT void* my_gst_registry_feature_filter(x64emu_t* emu, void* reg, void* filt
     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);
+}
+
 #define PRE_INIT    \
     if(box64_nogtk) \
         return -1;
@@ -370,6 +398,7 @@ EXPORT void* my_gst_registry_feature_filter(x64emu_t* emu, void* reg, void* filt
     getMy(lib);     \
     SetGstObjectID(my->gst_object_get_type());                 \
     SetGstAllocatorID(my->gst_allocator_get_type());           \
+    SetGstTaskPoolID(my->gst_task_pool_get_type());            \
     setNeededLibs(lib, 1, "libgtk-3.so.0");
 
 #define CUSTOM_FINI \