1 some random ramblings about the event system:
3 Possible candidates for events
4 ------------------------------
13 Assumptions for events
14 ----------------------
16 - They are tied to a pad.
17 - get rid of gst_pad_set_*_function (except for the chain/get ones)
18 - occur async to dataflow. (need locking?)
19 - fixed set of events only for core features. (elements cannot abuse
20 events for doing dataflow)
25 limit the valid directions an event can travel in? ie. Can EOS only
26 travel downstream (left to right)?
28 eg. Seek travels upstream, but it makes sense to also make it travel
29 downstream (the case of a disksink, where we overwrite the header)
32 Setting an event function
33 -------------------------
35 void gst_pad_set_event_function (GstPad *pad, gint event_mask,
36 GstEventFunction *function);
42 GST_EVENT_EOS = (1 << 0),
43 GST_EVENT_QOS = (1 << 1),
44 GST_EVENT_SEEK = (1 << 2),
45 GST_EVENT_CAPS = (1 << 3),
53 GstEventMinorType minor;
54 guint64 timestamp; /* also sequence number ?? */
60 GstSeekType type; /* time, bytes, ... */
75 GST_EVENT_MINOR_OFFSET,
79 GST_EVENT_MINOR_CAPS_TRY,
80 GST_EVENT_MINOR_CAPS_START,
81 GST_EVENT_MINOR_CAPS_FINAL,
88 a sample GstEventFunction, the event functions returns TRUE if the event is handled,
92 gst_anelement_handle_event (GstPad *pad, GstEvent *event)
94 if (event->type == GST_EVENT_EOS) {
98 else if (event->type == GST_EVENT_CAPS) {
99 if (event->minor == GST_EVENT_CAPS_TRY) {
100 /* try using this caps structure */
101 return TRUE; /* return FALSE to proxy ???*/
108 Default event handler for pads
109 ------------------------------
112 gst_pad_handle_event (GstPad *pad, GstEvent *event)
117 gboolean result = TRUE;
118 GstPadDirection dir = GST_PAD_DIRECTION (pad);
120 g_return_val_if_fail (pad != NULL, FALSE);
121 g_return_val_if_fail (GST_IS_REAL_PAD(pad), FALSE); // NOTE the restriction
123 element = GST_ELEMENT (gst_object_get_parent (GST_OBJECT (pad)));
125 /* send out the events to all pad with opposite direction */
126 pads = gst_element_get_pad_list(element);
128 otherpad = GST_PAD(pads->data);
129 pads = g_list_next(pads);
131 if (gst_pad_get_direction(otherpad) != dir) {
132 result &= gst_pad_send_event (GST_REAL_PAD(otherpad), event);
136 /* result is combined result of all handlers? */