From ed7ee12e7ec6d965ceef6a47dca7b92e726218d5 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 7 Aug 2024 15:11:31 +0200 Subject: [GTK] Added wrapped GstVideoBufferPool --- src/include/gtkclass.h | 36 +++++++++++++++ src/tools/gtkclass.c | 102 +++++++++++++++++++++++++++++++++++++++++ src/wrapped/wrappedgstreamer.c | 4 +- src/wrapped/wrappedgstvideo.c | 4 +- 4 files changed, 144 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/include/gtkclass.h b/src/include/gtkclass.h index 9960d74f..54fcb1ce 100644 --- a/src/include/gtkclass.h +++ b/src/include/gtkclass.h @@ -2104,6 +2104,40 @@ typedef struct my_GstAudioFilterClass_s { void* _gst_reserved[20]; } my_GstAudioFilterClass_t; +typedef struct my_GstBufferPool_s { + my_GstObject_t object; + int flushing; + void* priv; //GstBufferPoolPrivate + void* _gst_reserved[4]; +} my_GstBufferPool_t; + +typedef struct my_GstBufferPoolClass_s { + my_GstObjectClass_t object_class; + void* (*get_options) (void* pool); + int (*set_config) (void* pool, void* config); + int (*start) (void* pool); + int (*stop) (void* pool); + int (*acquire_buffer) (void* pool, void* buffer, void* params); + int (*alloc_buffer) (void* pool, void* buffer, void* params); + void (*reset_buffer) (void* pool, void* buffer); + void (*release_buffer) (void* pool, void* buffer); + void (*free_buffer) (void* pool, void* buffer); + void (*flush_start) (void* pool); + void (*flush_stop) (void* pool); + void* _gst_reserved[4 - 2]; +} my_GstBufferPoolClass_t; + +typedef struct my_GstVideoBufferPool_s +{ + my_GstBufferPool_t bufferpool; + void* priv; //GstVideoBufferPoolPrivate +} my_GstVideoBufferPool_t; + +typedef struct my_GstVideoBufferPoolClass_s +{ + my_GstBufferPoolClass_t parent; +} my_GstVideoBufferPoolClass_t; + typedef struct my_GDBusProxy_s { my_GObject_t parent; @@ -2262,6 +2296,8 @@ GTKCLASS(GstGLBaseSrc) \ GTKCLASS(GstAudioDecoder) \ GTKCLASS(GstVideoFilter) \ GTKCLASS(GstAudioFilter) \ +GTKCLASS(GstBufferPool) \ +GTKCLASS(GstVideoBufferPool) \ GTKIFACE(GstURIHandler) \ #define GTKCLASS(A) void Set##A##ID(size_t id); diff --git a/src/tools/gtkclass.c b/src/tools/gtkclass.c index 34d1803f..63e0cd56 100644 --- a/src/tools/gtkclass.c +++ b/src/tools/gtkclass.c @@ -4460,6 +4460,108 @@ static void bridgeGstAudioFilterInstance(my_GstAudioFilter_t* class) { bridgeGstBaseTransformInstance(&class->parent); } +// ----- GstBufferPoolClass ------ +// wrapper x86 -> natives of callbacks +WRAPPER(GstBufferPool, get_options, void*,(void* pool), "p", pool); +WRAPPER(GstBufferPool, set_config, int ,(void* pool, void* config), "pp", pool, config); +WRAPPER(GstBufferPool, start, int ,(void* pool), "p", pool); +WRAPPER(GstBufferPool, stop, int ,(void* pool), "p", pool); +WRAPPER(GstBufferPool, acquire_buffer, int ,(void* pool, void* buffer, void* params), "ppp", pool, buffer, params); +WRAPPER(GstBufferPool, alloc_buffer, int ,(void* pool, void* buffer, void* params), "ppp", pool, buffer, params); +WRAPPER(GstBufferPool, reset_buffer, void ,(void* pool, void* buffer), "pp", pool, buffer); +WRAPPER(GstBufferPool, release_buffer, void ,(void* pool, void* buffer), "pp", pool, buffer); +WRAPPER(GstBufferPool, free_buffer, void ,(void* pool, void* buffer), "pp", pool, buffer); +WRAPPER(GstBufferPool, flush_start, void ,(void* pool), "p", pool); +WRAPPER(GstBufferPool, flush_stop, void ,(void* pool), "p", pool); + +#define SUPERGO() \ + GO(get_options, pFp); \ + GO(set_config, iFpp); \ + GO(start, iFp); \ + GO(stop, iFp); \ + GO(acquire_buffer, iFppp); \ + GO(alloc_buffer, iFppp); \ + GO(reset_buffer, vFpp); \ + GO(release_buffer, vFpp); \ + GO(free_buffer, vFpp); \ + GO(flush_start, vFp); \ + GO(flush_stop, vFp); \ + +// wrap (so bridge all calls, just in case) +static void wrapGstBufferPoolClass(my_GstBufferPoolClass_t* class) +{ + wrapGstObjectClass(&class->object_class); + #define GO(A, W) class->A = reverse_##A##_GstBufferPool (W, class->A) + SUPERGO() + #undef GO +} +// unwrap (and use callback if not a native call anymore) +static void unwrapGstBufferPoolClass(my_GstBufferPoolClass_t* class) +{ + unwrapGstObjectClass(&class->object_class); + #define GO(A, W) class->A = find_##A##_GstBufferPool (class->A) + SUPERGO() + #undef GO +} +// autobridge +static void bridgeGstBufferPoolClass(my_GstBufferPoolClass_t* class) +{ + bridgeGstObjectClass(&class->object_class); + #define GO(A, W) autobridge_##A##_GstBufferPool (W, class->A) + SUPERGO() + #undef GO +} +#undef SUPERGO + +static void unwrapGstBufferPoolInstance(my_GstBufferPool_t* class) +{ + unwrapGstObjectInstance(&class->object); +} +// autobridge +static void bridgeGstBufferPoolInstance(my_GstBufferPool_t* class) +{ + bridgeGstObjectInstance(&class->object); +} +// ----- GstVideoBufferPoolClass ------ +// wrapper x86 -> natives of callbacks + +#define SUPERGO() \ + +// wrap (so bridge all calls, just in case) +static void wrapGstVideoBufferPoolClass(my_GstVideoBufferPoolClass_t* class) +{ + wrapGstBufferPoolClass(&class->parent); + #define GO(A, W) class->A = reverse_##A##_GstVideoBufferPool (W, class->A) + SUPERGO() + #undef GO +} +// unwrap (and use callback if not a native call anymore) +static void unwrapGstVideoBufferPoolClass(my_GstVideoBufferPoolClass_t* class) +{ + unwrapGstBufferPoolClass(&class->parent); + #define GO(A, W) class->A = find_##A##_GstVideoBufferPool (class->A) + SUPERGO() + #undef GO +} +// autobridge +static void bridgeGstVideoBufferPoolClass(my_GstVideoBufferPoolClass_t* class) +{ + bridgeGstBufferPoolClass(&class->parent); + #define GO(A, W) autobridge_##A##_GstBufferPool (W, class->A) + SUPERGO() + #undef GO +} +#undef SUPERGO + +static void unwrapGstVideoBufferPoolInstance(my_GstVideoBufferPool_t* class) +{ + unwrapGstBufferPoolInstance(&class->bufferpool); +} +// autobridge +static void bridgeGstVideoBufferPoolInstance(my_GstVideoBufferPool_t* class) +{ + bridgeGstBufferPoolInstance(&class->bufferpool); +} // ----- GDBusProxyClass ------ // wrapper x86 -> natives of callbacks WRAPPER(GDBusProxy, g_properties_changed, void, (void* proxy, void* changed_properties, const char* const* invalidated_properties), "ppp", proxy, changed_properties, invalidated_properties); diff --git a/src/wrapped/wrappedgstreamer.c b/src/wrapped/wrappedgstreamer.c index 16fcc747..42aa6cde 100644 --- a/src/wrapped/wrappedgstreamer.c +++ b/src/wrapped/wrappedgstreamer.c @@ -52,6 +52,7 @@ void* my_dlsym(x64emu_t* emu, void *handle, void *symbol); 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) \ @@ -1149,7 +1150,8 @@ EXPORT int my_gst_buffer_foreach_meta(x64emu_t* emu, void* buff, void* f, void* 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()); + SetGstURIHandlerID(my->gst_uri_handler_get_type()); \ + SetGstBufferPoolID(my->gst_buffer_pool_get_type()); \ #ifdef ANDROID #define NEEDED_LIBS "libgtk-3.so" diff --git a/src/wrapped/wrappedgstvideo.c b/src/wrapped/wrappedgstvideo.c index 37538d35..f74223c2 100644 --- a/src/wrapped/wrappedgstvideo.c +++ b/src/wrapped/wrappedgstvideo.c @@ -37,6 +37,7 @@ typedef size_t (*LFv_t)(); GO(gst_video_aggregator_get_type, LFv_t) \ GO(gst_video_aggregator_pad_get_type, LFv_t) \ GO(gst_video_filter_get_type, LFv_t) \ + GO(gst_video_buffer_pool_get_type, LFv_t) \ #include "generated/wrappedgstbasetypes.h" @@ -52,7 +53,8 @@ typedef size_t (*LFv_t)(); SetGstVideoSinkID(my->gst_video_sink_get_type());\ SetGstVideoAggregatorID(my->gst_video_aggregator_get_type());\ SetGstVideoAggregatorPadID(my->gst_video_aggregator_pad_get_type());\ - SetGstVideoFilterID(my->gst_video_filter_get_type()); + SetGstVideoFilterID(my->gst_video_filter_get_type());\ + SetGstVideoBufferPoolID(my->gst_video_buffer_pool_get_type());\ #ifdef ANDROID #define NEEDED_LIBS "libgstreamer-1.0.so" -- cgit 1.4.1