[gst-devel] event system
David I. Lehn
dlehn at vt.edu
Thu Jun 14 23:31:41 CEST 2001
* Wim Taymans <wim.taymans at chello.be> [20010614 15:57]:
> On 14 Jun 2001 15:09:17 +0200, Thomas Vander Stichele wrote:
> > 2) Most events will need to send a little, but not much, extra data. I
> > think all of them could use only one variable, and work in the same way as
> > the current gtk arguments. If not, they could work with a simple struct.
>
> I was thinking about a union with a field for the event type and then a
> set of extra values.
>
Why not just use a GtkValue? That has all the API to store any type,
pointers, objects, whatever.
> A little example of a possible API to send events:
>
> GstEvent *ev = gst_event_new (GST_EVENT_SEEK);
> GST_EVENT_SEEK_TYPE (ev) = GST_EVENT_SEEK_OFFSET;
> GST_EVENT_SEEK_POSITION (ev) = 1000;
>
Is there some reason for this ugly spelling? GstBuffer has it too and I
still don't know why. It's more uniform and exactly the same to write
it functional like everything else:
gst_event_set_seek_type(ev, GST_EVENT_SEEK_OFFSET);
gst_event_set_seek_position(ev, 1000);
and associated:
aType = gst_event_seek_type(ev);
aPostion = gst_event_seek_position(ev);
I think all the GST_BUFFER_* macros should change to look like this too.
Any reason not to do this?
> gint
> gst_disksrc_handle_event (GstPad *pad, GstEvent *ev)
> {
> if (GST_EVENT_TYPE (ev) == GST_EVENT_SEEK) {
> disksrc->offset = GST_EVENT_POSITION (ev);
> return true; // we handled the event
> }
> return false; // we did not handle the event.
> }
>
nit picking the pseudo-code: return a gboolean and use TRUE and FALSE ;)
-dave
--
David I. Lehn <dlehn at vt.edu> | http://www.lehn.org/~dlehn/
Computer Engineering Graduate @ Virginia Tech in sunny Blacksburg, VA
More information about the gstreamer-devel
mailing list