GNOME Bugzilla – Bug 607771
[API] Add gst_byte_writer_fill
Last modified: 2010-02-12 20:32:28 UTC
Adds a function to be able to do memsets in GstByteWriter. "gst_byte_writer_put_padding (GstByteWriter, guint8 value, guint size)" writes @size bytes with @value. Useful (as the name already says) for adding padding to buffers. Patches following.
Created attachment 152012 [details] [review] adds the function and docs
Created attachment 152013 [details] [review] adds test
Created attachment 152014 [details] [review] updates .refs
Looks good to me but maybe the function's name could be changed because it's not exactly padding what this function does but writing n-times a specific byte... liboil for example calls this oil_splat_u8_ns().
I agree that the name is mostly one of the use cases that it might contemplate. But I couldn't find a better one.
Thoughts and minor nitpicks: - the 'update .defs' commit should be merged with the initial commit that adds the API IMHO - commit message: the 'API' marker should be in the message body not the first line (that's how we mostly do it, with one or two exceptions), e.g.: bytewriter: add _put_padding function Adds a new function to GstByteWriter.... API: gst_byte_writer_put_padding() - I think it should either be called _put_padding() with the value argument removed (does anyone ever want to add non-0 padding bytes?), or one should rename it to something else (don't ask me what though, something with 'fill' maybe or 'memset' or 'set'?)
gst_byte_writer_fill looks good to me :)
> gst_byte_writer_fill looks good to me :) Worksforme
Forgot to add the bug number, but here they are. Module: gstreamer Branch: master Commit: bfff7a1b4ece0c0b5ca30dd93392707fc097f7a9 URL: http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=bfff7a1b4ece0c0b5ca30dd93392707fc097f7a9 Author: Thiago Santos <thiago.sousa.santos@collabora.co.uk> Date: Fri Jan 22 09:19:31 2010 -0300 bytewriter: add _fill function Adds a new function to GstByteWriter that writes a constant value to a memory area (aka memset). Useful for adding padding to buffers. Also updates .def file and docs. API: gst_byte_writer_fill() Module: gstreamer Branch: master Commit: aad80a10530fdd0ee8a943c1ea34bbf821db5bb5 URL: http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=aad80a10530fdd0ee8a943c1ea34bbf821db5bb5 Author: Thiago Santos <thiago.sousa.santos@collabora.co.uk> Date: Fri Jan 22 11:38:59 2010 -0300 bytewriter: Adds a test for _fill