appsink: Use a class handler callback instead of vfunc for propose-allocation

There would otherwise be no padding left in the class struct anymore and
we might need it for something else in the future.

A class handler callback can be overridden by subclasses via
`g_signal_override_class_handler()` and chained up via
`g_signal_chain_from_overridden_handler()`.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2422

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4356>
This commit is contained in:
Sebastian Dröge 2023-04-06 14:19:28 +03:00 committed by GStreamer Marge Bot
parent f3ab697d2a
commit 8ed0b03c78
2 changed files with 4 additions and 13 deletions

View file

@ -351,10 +351,9 @@ gst_app_sink_class_init (GstAppSinkClass * klass)
* Since: 1.24
*/
gst_app_sink_signals[SIGNAL_PROPOSE_ALLOCATION] =
g_signal_new ("propose-allocation", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstAppSinkClass, propose_allocation),
NULL, NULL, NULL, G_TYPE_BOOLEAN, 1,
GST_TYPE_QUERY | G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_new_class_handler ("propose-allocation",
G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, NULL, NULL, NULL, NULL,
G_TYPE_BOOLEAN, 1, GST_TYPE_QUERY | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* GstAppSink::new-serialized-event:
* @appsink: the appsink element that emitted the signal

View file

@ -123,16 +123,8 @@ struct _GstAppSinkClass
*/
GstMiniObject * (*try_pull_object) (GstAppSink *appsink, GstClockTime timeout);
/**
* GstAppSinkClass::propose_allocation:
*
* See #GstAppSink::propose-allocation: signal.
*
* Since: 1.24
*/
gboolean (*propose_allocation) (GstAppSink *appsink, GstQuery *query);
/*< private >*/
gpointer _gst_reserved[GST_PADDING - 4];
gpointer _gst_reserved[GST_PADDING - 3];
};
GST_APP_API