4 some random ramblings about the event system:
6 Possible candidates for events
7 ------------------------------
16 Assumptions for events
17 ----------------------
19 - They are tied to a pad.
20 - get rid of gst_pad_set_*_function (except for the chain/get ones)
21 - occur async to dataflow. (need locking?)
22 - fixed set of events only for core features. (elements cannot abuse
23 events for doing dataflow)
28 limit the valid directions an event can travel in? ie. Can EOS only
29 travel downstream (left to right)?
31 eg. Seek travels upstream, but it makes sense to also make it travel
32 downstream (the case of a disksink, where we overwrite the header)
35 Setting an event function
36 -------------------------
38 void gst_pad_set_event_function (GstPad *pad, gint event_mask,
39 GstEventFunction *function);
45 GST_EVENT_EOS = (1 << 0),
46 GST_EVENT_QOS = (1 << 1),
47 GST_EVENT_SEEK = (1 << 2),
48 GST_EVENT_CAPS = (1 << 3),
56 GstEventMinorType minor;
57 guint64 timestamp; /* also sequence number ?? */
63 GstSeekType type; /* time, bytes, ... */
78 GST_EVENT_MINOR_OFFSET,
82 GST_EVENT_MINOR_CAPS_TRY,
83 GST_EVENT_MINOR_CAPS_START,
84 GST_EVENT_MINOR_CAPS_FINAL,
91 a sample GstEventFunction, the event functions returns TRUE if the event is handled,
95 gst_anelement_handle_event (GstPad *pad, GstEvent *event)
97 if (event->type == GST_EVENT_EOS) {
101 else if (event->type == GST_EVENT_CAPS) {
102 if (event->minor == GST_EVENT_CAPS_TRY) {
103 /* try using this caps structure */
104 return TRUE; /* return FALSE to proxy ???*/
111 Default event handler for pads
112 ------------------------------
115 gst_pad_handle_event (GstPad *pad, GstEvent *event)
120 gboolean result = TRUE;
121 GstPadDirection dir = GST_PAD_DIRECTION (pad);
123 g_return_val_if_fail (pad != NULL, FALSE);
124 g_return_val_if_fail (GST_IS_REAL_PAD(pad), FALSE); // NOTE the restriction
126 element = GST_ELEMENT (gst_object_get_parent (GST_OBJECT (pad)));
128 /* send out the events to all pad with opposite direction */
129 pads = gst_element_get_pad_list(element);
131 otherpad = GST_PAD(pads->data);
132 pads = g_list_next(pads);
134 if (gst_pad_get_direction(otherpad) != dir) {
135 result &= gst_pad_send_event (GST_REAL_PAD(otherpad), event);
139 /* result is combined result of all handlers? */