about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-04-09 09:54:43 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-04-09 09:54:43 +0200
commit57e858ccc461a049c7a744f8f53c3fd9180f0bd9 (patch)
treed7a91ac50962108c664fe53f44569c5d8b23e1b6 /src
parent2c44452dc6ec06df54b74848a6d9907dc73bd2a0 (diff)
downloadbox64-57e858ccc461a049c7a744f8f53c3fd9180f0bd9.tar.gz
box64-57e858ccc461a049c7a744f8f53c3fd9180f0bd9.zip
Added some more gstreamer wrapped function (in sync with box86)
Diffstat (limited to 'src')
-rw-r--r--src/wrapped/generated/functions_list.txt4
-rw-r--r--src/wrapped/generated/wrappedgstreamertypes.h4
-rw-r--r--src/wrapped/wrappedgstaudio_private.h2
-rw-r--r--src/wrapped/wrappedgstreamer.c55
-rw-r--r--src/wrapped/wrappedgstreamer_private.h18
5 files changed, 72 insertions, 11 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index e315fa6f..aeecda92 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -2964,14 +2964,18 @@ wrappedgstreamer:
 - iFppA:
   - gst_structure_get_valist
 - pFppV:
+  - gst_caps_new_simple
   - gst_structure_new
 - vFpppp:
   - gst_bus_set_sync_handler
+  - gst_mini_object_set_qdata
   - gst_pad_set_activatemode_function_full
   - gst_pad_set_chain_function_full
   - gst_pad_set_event_function_full
   - gst_pad_set_getrange_function_full
   - gst_pad_set_query_function_full
+- pFppip:
+  - gst_registry_feature_filter
 - pFiplllpp:
   - gst_buffer_new_wrapped_full
 - vFpippippV:
diff --git a/src/wrapped/generated/wrappedgstreamertypes.h b/src/wrapped/generated/wrappedgstreamertypes.h
index d64e5a0c..1464e544 100644
--- a/src/wrapped/generated/wrappedgstreamertypes.h
+++ b/src/wrapped/generated/wrappedgstreamertypes.h
@@ -17,6 +17,7 @@ typedef int32_t (*iFppV_t)(void*, void*, ...);
 typedef int32_t (*iFppA_t)(void*, void*, va_list);
 typedef void* (*pFppV_t)(void*, void*, ...);
 typedef void (*vFpppp_t)(void*, void*, void*, void*);
+typedef void* (*pFppip_t)(void*, void*, int32_t, void*);
 typedef void* (*pFiplllpp_t)(int32_t, void*, intptr_t, intptr_t, intptr_t, void*, void*);
 typedef void (*vFpippippV_t)(void*, int32_t, void*, void*, int32_t, void*, void*, ...);
 typedef void (*vFpippippA_t)(void*, int32_t, void*, void*, int32_t, void*, void*, va_list);
@@ -28,13 +29,16 @@ typedef void (*vFpippippA_t)(void*, int32_t, void*, void*, int32_t, void*, void*
 	GO(gst_structure_remove_fields_valist, vFppA_t) \
 	GO(gst_structure_get, iFppV_t) \
 	GO(gst_structure_get_valist, iFppA_t) \
+	GO(gst_caps_new_simple, pFppV_t) \
 	GO(gst_structure_new, pFppV_t) \
 	GO(gst_bus_set_sync_handler, vFpppp_t) \
+	GO(gst_mini_object_set_qdata, vFpppp_t) \
 	GO(gst_pad_set_activatemode_function_full, vFpppp_t) \
 	GO(gst_pad_set_chain_function_full, vFpppp_t) \
 	GO(gst_pad_set_event_function_full, vFpppp_t) \
 	GO(gst_pad_set_getrange_function_full, vFpppp_t) \
 	GO(gst_pad_set_query_function_full, vFpppp_t) \
+	GO(gst_registry_feature_filter, pFppip_t) \
 	GO(gst_buffer_new_wrapped_full, pFiplllpp_t) \
 	GO(gst_debug_log, vFpippippV_t) \
 	GO(gst_debug_log_valist, vFpippippA_t)
diff --git a/src/wrapped/wrappedgstaudio_private.h b/src/wrapped/wrappedgstaudio_private.h
index 4573f24d..2a40615a 100644
--- a/src/wrapped/wrappedgstaudio_private.h
+++ b/src/wrapped/wrappedgstaudio_private.h
@@ -153,7 +153,7 @@ GO(gst_audio_format_build_integer, iFiiii)
 //GO(gst_audio_format_get_type, 
 //GO(gst_audio_format_info_get_type, 
 //GO(gst_audio_formats_raw, 
-//GO(gst_audio_format_to_string, 
+GO(gst_audio_format_to_string, pFi)
 //GO(gst_audio_get_channel_reorder_map, 
 //GO(gst_audio_iec61937_frame_size, 
 //GO(gst_audio_iec61937_payload, 
diff --git a/src/wrapped/wrappedgstreamer.c b/src/wrapped/wrappedgstreamer.c
index 35f5610a..7c22cc6c 100644
--- a/src/wrapped/wrappedgstreamer.c
+++ b/src/wrapped/wrappedgstreamer.c
@@ -23,14 +23,20 @@ const char* gstreamerName = "libgstreamer-1.0.so.0";
 #define LIBNAME gstreamer
 
 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*);
 
 #define ADDED_FUNCTIONS()                   \
     GO(gst_object_get_type, LFv_t)          \
     GO(gst_allocator_get_type, LFv_t)       \
     GO(gst_structure_new_valist, pFppA_t)   \
-    GO(gst_structure_new_empty, pFp_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)   \
 
 #include "generated/wrappedgstreamertypes.h"
 
@@ -200,6 +206,29 @@ static void* findGstBusSyncHandlerFct(void* fct)
     printf_log(LOG_NONE, "Warning, no more slot for gstreamer GstBusSyncHandler 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)RunFunction(my_context, my_GstPluginFeatureFilter_fct_##A, 2, 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;
+}
+
 #undef SUPER
 
 EXPORT void my_gst_caps_set_simple(x64emu_t* emu, void* caps, void* field, void* b) {
@@ -309,6 +338,30 @@ EXPORT void* my_gst_structure_new(x64emu_t* emu, void* name, void* first, uint64
     return my->gst_structure_new_valist(name, first, VARARGS);
 }
 
+EXPORT void my_gst_mini_object_set_qdata(x64emu_t* emu, void* object, void* 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);
+}
+
 #define PRE_INIT    \
     if(box64_nogtk) \
         return -1;
diff --git a/src/wrapped/wrappedgstreamer_private.h b/src/wrapped/wrappedgstreamer_private.h
index 3e481530..7a59e567 100644
--- a/src/wrapped/wrappedgstreamer_private.h
+++ b/src/wrapped/wrappedgstreamer_private.h
@@ -240,7 +240,7 @@ GO(gst_caps_new_empty, pFv)
 GO(gst_caps_new_empty_simple, pFp)
 //GOM(gst_caps_new_full, pFEpV)
 //GOM(gst_caps_new_full_valist, pFEpA)
-//GOM(gst_caps_new_simple, pFppV)
+GOM(gst_caps_new_simple, pFEppV)
 //DATAB(_gst_caps_none, 
 GO(gst_caps_normalize, pFp)
 GO(gst_caps_ref, pFp)
@@ -745,16 +745,16 @@ GO(gst_is_initialized, iFv)
 //GO(gst_iterator_find_custom, 
 //GO(gst_iterator_fold, 
 //GO(gst_iterator_foreach, 
-//GO(gst_iterator_free, 
+GO(gst_iterator_free, vFp)
 //GO(gst_iterator_get_type, 
 //GO(gst_iterator_item_get_type, 
 //GO(gst_iterator_new, 
 //GO(gst_iterator_new_list, 
 //GO(gst_iterator_new_single, 
-//GO(gst_iterator_next, 
+GO(gst_iterator_next, iFpp)
 //GO(gst_iterator_push, 
 //GO(gst_iterator_result_get_type, 
-//GO(gst_iterator_resync, 
+GO(gst_iterator_resync, vFp)
 //GO(gst_library_error_get_type, 
 //GO(gst_library_error_quark, 
 //GO(gst_lock_flags_get_type, 
@@ -897,7 +897,7 @@ GO(gst_message_writable_structure, pFp)
 //GO(gst_mini_object_add_parent, 
 //GO(gst_mini_object_copy, 
 //GO(gst_mini_object_flags_get_type, 
-//GO(gst_mini_object_get_qdata, 
+GO(gst_mini_object_get_qdata, pFpp)
 //GO(gst_mini_object_init, 
 GO(gst_mini_object_is_writable, iFp)
 //GO(gst_mini_object_lock, 
@@ -905,7 +905,7 @@ GO(gst_mini_object_make_writable, pFp)
 GO(gst_mini_object_ref, pFp)
 //GO(gst_mini_object_remove_parent, 
 //GO(gst_mini_object_replace, 
-//GO(gst_mini_object_set_qdata, 
+GOM(gst_mini_object_set_qdata, vFEpppp)
 //GO(gst_mini_object_steal, 
 //GO(gst_mini_object_steal_qdata, 
 //GO(gst_mini_object_take, 
@@ -1097,7 +1097,7 @@ GO(gst_pad_use_fixed_caps, vFp)
 //GO(gst_plugin_feature_check_version, 
 //GO(gst_plugin_feature_get_plugin, 
 //GO(gst_plugin_feature_get_plugin_name, 
-//GO(gst_plugin_feature_get_rank, 
+GO(gst_plugin_feature_get_rank, uFp)
 GO(gst_plugin_feature_get_type, LFv)
 //GO(gst_plugin_feature_list_copy, 
 //GO(gst_plugin_feature_list_debug, 
@@ -1289,12 +1289,12 @@ GO(gst_query_writable_structure, pFp)
 //GO(gst_registry_add_feature, 
 //GO(gst_registry_add_plugin, 
 //GO(gst_registry_check_feature_version, 
-//GO(gst_registry_feature_filter, 
+GOM(gst_registry_feature_filter, pFEppip)
 //GO(gst_registry_find_feature, 
 //GO(gst_registry_find_plugin, 
 //GO(gst_registry_fork_is_enabled, 
 //GO(gst_registry_fork_set_enabled, 
-//GO(gst_registry_get, 
+GO(gst_registry_get, pFpL)
 //GO(gst_registry_get_feature_list, 
 //GO(gst_registry_get_feature_list_by_plugin, 
 //GO(gst_registry_get_feature_list_cookie,