[gst-devel] CAPS branch
David Schleef
ds at schleef.org
Tue Nov 11 12:02:02 CET 2003
This is just a heads-up to let you know that I started a CAPS
branch in gstreamer (but not in gst-plugins). This is for the
replacement implementation of GstCaps, which is currently called
GstCaps2 (and gst_caps2_*() etc.). This is only temporary, and
before the branch is merged, it will be called GstCaps again.
I originally intended to make the transition completely seamless,
using both GstCaps and GstCaps2 code simultaneously until all
plugins had been ported. However, that turned out to be a bit
too complicated. Anyway, calling it GstCaps2 (for now) has the
side benefit that plugins using the old interface won't compile,
thus showing immediately which plugins have not been updated.
I'm still working on the core code, so I don't need any help
migrating plugins yet. But here are some interesting details
about the new code:
- no longer reference counted. You either own the caps, or
you don't, in which case it is read-only. This is effectively
what we had before, but it's actually enforced now by the
usage of (const GstCaps2 *) in function prototypes.
- the new GstStructure is like a C structure, which contains
field/value pairs, except that it has dynamic fields. So
you could think of it as a group of key/GValue tuples. This
is the container for much of the information previously in
GstProps (and a bit of what was in GstCaps).
- GstCaps2 is a single structure that contains a number of
GstStructures. This is different from GstCaps, which is
the head of a linked list.
- Using GValues in GstStructures (and thus, in GstCaps2) means
that we are no longer limited to the 5 field types (int,
boolean, float, string, fourcc) in GstCaps. New field types
can be dynamically registered. Intersection, union, and
comparison functions can also be registered.
- A new GstStaticCaps2, which can replace a lot of the GST_CAPS_NEW()
code.
Problems with the existing GstCaps/GstProps:
- NULL is used for "caps don't exist" (for pads), "any caps"
(many places), or "no caps" (result of intersection code).
This is unfixable with the current GstCaps.
- GstProps uses malloc *heavily*.
- Much code assumes that GstCaps are not chained, without
checking.
- Since GstCaps is a singly-linked list, there's no way to tell
if a GstCaps is actually part of someone else's linked list.
This is a common bug.
- Most plugins don't handle the caps structures correctly,
leading to leakage and strange caps bugs. This is effectively
unfixable with the current GstCaps.
- There's a lot of code that calls gst_caps_set() (and similar
functions) without checking if they own the caps, or checking
the return code. This is effectively unfixable with the
current GstCaps.
- The GstCaps/GstProps division is arbitrary and incorrect, which
makes the code much more complicated than it needs to be.
dave...
More information about the gstreamer-devel
mailing list