GNOME Bugzilla – Bug 677898
gst_task_set_thread_callback_funcs is not binding-friendly
Last modified: 2012-06-20 10:01:14 UTC
Created attachment 216153 [details] [review] task: add gst_task_set_thread_callback_funcs and GstTaskThreadFunc gst_task_set_thread_callback_funcs (and GstTaskThreadFunc) are not very friendly to bindings. The (currently untested) attached patch creates the following API: typedef void (*GstTaskThreadFunc) (GstTask *task, GThread *thread, gpointer user_data); void gst_task_set_thread_callback_funcs (GstTask * task, GstTaskThreadFunc enter_thread, gpointer enter_thread_data, GDestroyNotify enter_thread_notify, GstTaskThreadFunc leave_thread, gpointer leave_thread_data, GDestroyNotify leave_thread_notify); It also adds g-i annotations to skip the old API.
I don't like this, the point of the structure with callbacks was to be able to add more callbacks later when needed. Now with the method we need to add a new method and deprecate the old one. Maybe we should get rid of the structure of callbacks and just do gst_task_set_thread_enter_callback (GstTask *task, GstTaskThreadFunc enter_thread, gpointer user_data, GDestroyNotify notify); gst_task_set_thread_leave_callback (GstTask *task, GstTaskThreadFunc leave_thread, gpointer user_data, GDestroyNotify notify);
That sounds good to me. Do you really ever see adding new callbacks? If not, gst_task_set_thread_callbacks could be re-purposed as a convenience method for C programmers who want to use the same user data and destroy notify for both: gst_task_set_thread_callbacks (GstTask *task, GstTaskThreadFunc enter_thread, GstTaskThreadFunc leave_thread, gpointer user_data, GDestroyNotify notify); Of course, even if you don't want to add a callback, there could be gst_task_set_thread_callbacks_full, or gst_task_set_thread_callbacks_with_foo, etc.
OK! commit b2aa56f4e3965d2a7e0bf1beaf8916631392b52f Author: Wim Taymans <wim.taymans@collabora.co.uk> Date: Wed Jun 20 11:59:09 2012 +0200 task: add separate methods to add enter/leave callback Remove the structure of callbacks and replace with separate methods to register each callback. This is much more binding friendly. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=677898