omega at temple-baptist.com
Sat Aug 11 09:33:17 CEST 2001
I just added gst_buffer_span() and gst_buffer_merge(), which will be used
by the new mp3parse element I'm writing to test out the new TimeCache and
seek event handling code I'm working on.
gst_buffer_span(buf1,offset,buf2,len) will take two buffers and construct
a new buffer of a given offset and length within the conceptual range of
the two concatenated buffers. Of course, only an idiot (or lunatic) would
use this on two non-contiguous buffers.... gst_buffer_merge() is a
specific case that supplies 0 for the offset and the sum of the two buffer
sizes as the length (append, basically).
The reason this is useful is that there's a special case: if the two
buffers are both sub-buffers with the same parent, *and* contiguous
within that buffer, a new sub-buffer of the shared parent can be created
to span the sub-buffers, with basically zero cost. If those two
conditions can't be met, a pair of memcpy()'s will take place.
This will be most useful when I get around to writing the rest of the new
disksrc, which will more intelligently use mmap() to avoid cache-thrashing
and the continual "my gstreamer app is using 1GB of RAM!" confusion that
comes from the mmap'd file being added to the process space's total.
This disksrc will spit out buffers that are always sub-buffers of a
meta-buffer created internally that corresponds to each mmap()'d region of
the file (probably 4MB chunks or something). This leads to contiguous
buffers with the same parent, which is exactly what the gst_buffer_span()
routine is designed to optimize for... ;-)
Now, there's the matter of gst_buffer_append(), which itself is
conceptually a special case of gst_buffer_merge(), in that it free()'s the
two source buffers. I haven't touchd it yet, because there is some
unusual code in there I need to analyze first, but chances are it'll just
be a call to gst_buffer_merge(buf1,buf2) and two calls to
Erik Walthinsen <omega at temple-baptist.com> - System Administrator
/ \ GStreamer - The only way to stream!
| | M E G A ***** http://gstreamer.net/ *****
More information about the gstreamer-devel