GNOME Bugzilla – Bug 583187
[API] add gst_adapter_masked_scan_uint32() and gst_adapter_get_buffer()
Last modified: 2009-05-19 22:41:08 UTC
Found those in the new video base classes in libgstvideo in -base. We should move them to GstAdapter though IMHO. Attached a half-finished patch.
Created attachment 134922 [details] [review] proposed new API - needs more work
Ah cool, scan functions for adapter are something I wanted too.
gst_adapter_get_buffer() is a hack to get some sort of timestamps out of an adapter in BaseVideoDecoder. The BVD code doesn't work correctly, and a proper implementation won't use gst_adapter_get_buffer(). It would be nice to have some method of getting timestamps and buffer metadata for certain bytes in the adapter, but I don't think get_buffer() is the right API for that.
there is code in adapter right now to get the last known timestamp for the current adapter byte and the offset since that timestamp. I don't know your use case but I found that to be a good way to get timestamps for libvisual and ffmpeg.
The get_buffer() call is not so nice and could not return anything useful when buffers were merged. <random idea>I was thinking of gst_adapter_push_meta(GQuark) that would track a generic metadata struct that can be retrieved with the quark again</random idea>
commit 270723c85c66c5232c45e0a8fa15f4a4630813c0 Author: Wim Taymans <wim.taymans@collabora.co.uk> Date: Wed May 20 00:37:53 2009 +0200 adapter: add _masked_scan_uint32 Add a reasonably optimized new gst_adapter_masked_scan_uint32() function to scan the adapter for a pattern after applying a mask. Add some unit tests. API: GstAdapter::gst_adapter_masked_scan_uint32() Fixes #583187