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.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/wrapped/wrappedgstreamer.c b/src/wrapped/wrappedgstreamer.c
index 2ce5adc5..cbf51165 100644
--- a/src/wrapped/wrappedgstreamer.c
+++ b/src/wrapped/wrappedgstreamer.c
@@ -229,6 +229,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_context, 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) {
@@ -362,6 +384,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;