[gst-devel] gst/gststructure.[ch] gst/gstvalue.[ch]
in7y118 at public.uni-hamburg.de
in7y118 at public.uni-hamburg.de
Thu Nov 20 07:46:04 CET 2003
Hi there.
Since it's a recent addition to the core and you probably don't know much
about it, I thought I'd give you a short rundown about what GstStructure is
and what we are going to use it for.
David describes GstStructure as a runtime-defined equivalent to the C struct.
GstStructure is a list of values associated with names. You just use
gst_structure_set (structure, "something", G_TYPE_INT, 15, NULL); to associate
an integer with value 15 with the name "something". After that you can get
this value with g_value_get_int (structure, "something", &some_int);
This is supposed to work for any GType you can think of.
Every GstStructure has a name. you can use gst_structure_{get|set}_name for
this. To keep up with the C struct example, this would be the name of that
structure.
Internally, GstStructure stores quarks and GValues so it is as flexible as
that system is.
A really nice thing about GstStructure is the ability to convert a structure
to/from strings. gst_structure_to_string (structure) will give you a nice
representation that you can use when debugging - at least if you don't use
totally weird GTypes that don't support string transformations. And
serialization obviously allows you to send GstStructures via simpe IPC
echanisms, via UDP or whatever you can imagine.
Now what will GStreamer use this for?
The idea that lead to the invention of GstStructure was the caps system and
its usage of GstProps. David rewrites the caps system with GstStructure
instead of GstProps. There are some extensions for GValues required to achieve
this (unions, intersections and some additional GValues for ranges, fourccs
etc) that reside in gstvalue.[ch].
So the new caps system will wrap GstStructure.
After David created this thing, I found it tremendously useful for the tag
system. So I rewrote the tag system once again. It now completely wraps
GstStructure, with some tag specific extensions.
The third thing where GstStructure should be really useful is the event
system. I plan to (hopefully before feature freeze) replace the whole event
union mess with GstStructures. This buys us serializable events (think events
via network) that can be user defined. And we (or you) can define them just
like we can now define new mime types.
Hm, I hope this wasn't too short and you're now even more clueless than you
were before.
Ask away if something is still unclear :)
Benjamin
More information about the gstreamer-devel
mailing list