[gstreamer-bugs] [Bug 590669] [API] need GstByteWriter or GstChunkWriter

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Sun Oct 4 03:55:57 PDT 2009


https://bugzilla.gnome.org/show_bug.cgi?id=590669
  GStreamer | gstreamer (core) | git

--- Comment #8 from Tim-Philipp Müller <t.i.m at zen.co.uk> 2009-10-04 10:55:56 UTC ---
> #define GST_BYTE_WRITER(writer) ((GstByteWriter *) writer)

Not that I can really think of a plausible case where this would matter, but
shouldn't it be (writer) ?


> GstByteWriter * gst_byte_writer_new_with_data (guint8 *data, guint size);
>
> #define GST_BYTE_WRITER_INIT_WITH_DATA (data, sized) \
>    { {data, size, 0}, TRUE, size }
> #define GST_BYTE_WRITER_INIT_WITH_BUFFER (buffer) \
>    GST_BYTE_WRITER_INIT_WITH_DATA (GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE(buffer))

I thought of this API more as in "write to, but don't realloc or free the
memory provided", not as in "GstByteWriter takes ownership of the memory
passed".

I think we need a second flag to signal if the writer owns the memory, so it
knows whether to free/return or _dup() it when freeing the writer.


> #define GST_BYTE_WRITER_INIT_WITH_SIZE (size, fixed) \
>    { {g_malloc (GST_BYTE_READER_MIN_SIZE), 0, 0}, fixed, GST_BYTE_READER_MIN_SIZE }

shouldn't that be 'size' here instead of _MIN_SIZE? I don't think _MIN_SIZE
should be in the headers btw, the implementation should handle an initial value
of 0 find and then re-alloc to MIN_SIZE internally as needed IMO. Not sure I
really like the g_malloc here.

Not sure we really need any of the _INIT_WITH* macros, esp. if we have inlined
init functions.


As for the nested chunk writing: might be better to do this with a separate API
on top of GstByteWriter.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.



More information about the Gstreamer-bugs mailing list