[gst-devel] Docs/RFC: GstData

David I. Lehn dlehn at vt.edu
Thu Apr 18 02:22:03 CEST 2002


* Ronald Bultje <rbultje at ronald.bitfreak.net> [20020418 04:56]:
> Isn't that exactly why they are all a GstData? For the sake of calling
> them events, you could rename GstData to GstEvent or so. But now, we
> have GstDate, every GstData is (assuming the division between in/out
> event isn't needed) a GstEvent and every event/buffer is a GstEvent...

I think omega wanted GstData to just be simple refcounting and useful
for other container purposes.


> And every type of event has its own class... I'd rather see something
> simple like:
> 
> GstData
>   GstBuffer
>   GstEvent
> 
> This seems to make life a lot easier... Just use something like GstProps
> or so to make different kind of events, but making separate event
> classes for each type of event seems rather awkward to me...

The above is sort of broken.  I think it's what the current code does
too.  I think we still have lots of code that accepts a GstBuffer* and
does a GST_IS_EVENT() check then casts the GstBuffer* to a GstEvent*.
This is broken OO semantics.  GstBuffer is not a GstEvent.  You can't
cast a class to a siblilng class.  Only to parent classes or child
classes when the type is known.  In the above would have to move the buf
or event flag up to GstData and pass GstData* to all the chain functions
and so on instead of GstBuffer*.

That's why I liked the following with type in GstEvent and all funcs
that accept buffers or other events use GstEvent* and funcs that just
use buffers can take just GstBuffer*:

GstData
  GstEvent
    GstBuffer
    GstEOSEvent
    ...

And break up the event type since some events have more extra fields
than others and no need to waste space.  However dubious that may be in
the context of performance increases by means of event instance pools or
whatever to avoid alloc issues.  I guess would need multiple pools.
Premature optimization going on here.  I'd rather see a solid design
first and then bench and profile it.

-dave
-- 
David I. Lehn <dlehn at vt.edu>  | http://crib.lehn.org:8080/~dlehn/
Computer Engineering Graduate @ Virginia Tech in sunny Blacksburg, VA




More information about the gstreamer-devel mailing list