pad: Make the size parameter of gst_pad_alloc_buffer() unsigned

Internally guints were used everywhere already.
This commit is contained in:
Sebastian Dröge 2011-04-18 10:47:26 +02:00
parent 9b2a8b8480
commit 6e41a3cf2f
2 changed files with 11 additions and 16 deletions

View file

@ -2823,7 +2823,7 @@ no_peer:
/* calls the buffer_alloc function on the given pad */ /* calls the buffer_alloc function on the given pad */
static GstFlowReturn static GstFlowReturn
gst_pad_buffer_alloc_unchecked (GstPad * pad, guint64 offset, gint size, gst_pad_buffer_alloc_unchecked (GstPad * pad, guint64 offset, guint size,
GstCaps * caps, GstBuffer ** buf) GstCaps * caps, GstBuffer ** buf)
{ {
GstFlowReturn ret; GstFlowReturn ret;
@ -2838,11 +2838,11 @@ gst_pad_buffer_alloc_unchecked (GstPad * pad, guint64 offset, gint size,
if (offset == GST_BUFFER_OFFSET_NONE) { if (offset == GST_BUFFER_OFFSET_NONE) {
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
"calling bufferallocfunc &%s (@%p) for size %d offset NONE", "calling bufferallocfunc &%s (@%p) for size %u offset NONE",
GST_DEBUG_FUNCPTR_NAME (bufferallocfunc), bufferallocfunc, size); GST_DEBUG_FUNCPTR_NAME (bufferallocfunc), bufferallocfunc, size);
} else { } else {
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
"calling bufferallocfunc &%s (@%p) of for size %d offset %" "calling bufferallocfunc &%s (@%p) of for size %u offset %"
G_GUINT64_FORMAT, GST_DEBUG_FUNCPTR_NAME (bufferallocfunc), G_GUINT64_FORMAT, GST_DEBUG_FUNCPTR_NAME (bufferallocfunc),
bufferallocfunc, size, offset); bufferallocfunc, size, offset);
} }
@ -2896,15 +2896,14 @@ fallback:
return GST_FLOW_OK; return GST_FLOW_OK;
} else { } else {
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
"out of memory allocating %d bytes", size); "out of memory allocating %u bytes", size);
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
} }
} }
/* FIXME 0.11: size should be unsigned */
static GstFlowReturn static GstFlowReturn
gst_pad_alloc_buffer_full (GstPad * pad, guint64 offset, gint size, gst_pad_alloc_buffer_full (GstPad * pad, guint64 offset, guint size,
GstCaps * caps, GstBuffer ** buf, gboolean setcaps) GstCaps * caps, GstBuffer ** buf, gboolean setcaps)
{ {
GstPad *peer; GstPad *peer;
@ -2915,9 +2914,8 @@ gst_pad_alloc_buffer_full (GstPad * pad, guint64 offset, gint size,
g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR); g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
g_return_val_if_fail (GST_PAD_IS_SRC (pad), GST_FLOW_ERROR); g_return_val_if_fail (GST_PAD_IS_SRC (pad), GST_FLOW_ERROR);
g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR); g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
g_return_val_if_fail (size >= 0, GST_FLOW_ERROR);
GST_DEBUG_OBJECT (pad, "offset %" G_GUINT64_FORMAT ", size %d, caps %" GST_DEBUG_OBJECT (pad, "offset %" G_GUINT64_FORMAT ", size %u, caps %"
GST_PTR_FORMAT, offset, size, caps); GST_PTR_FORMAT, offset, size, caps);
GST_OBJECT_LOCK (pad); GST_OBJECT_LOCK (pad);
@ -2995,7 +2993,7 @@ not_negotiated:
wrong_size_fallback: wrong_size_fallback:
{ {
GST_CAT_ERROR_OBJECT (GST_CAT_PADS, pad, "buffer returned by alloc " GST_CAT_ERROR_OBJECT (GST_CAT_PADS, pad, "buffer returned by alloc "
"function is too small (%u < %d), doing fallback buffer alloc", "function is too small (%u < %u), doing fallback buffer alloc",
gst_buffer_get_size (*buf), size); gst_buffer_get_size (*buf), size);
gst_buffer_unref (*buf); gst_buffer_unref (*buf);
@ -3038,9 +3036,8 @@ wrong_size_fallback:
* MT safe. * MT safe.
*/ */
/* FIXME 0.11: size should be unsigned */
GstFlowReturn GstFlowReturn
gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size, GstCaps * caps, gst_pad_alloc_buffer (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
GstBuffer ** buf) GstBuffer ** buf)
{ {
return gst_pad_alloc_buffer_full (pad, offset, size, caps, buf, FALSE); return gst_pad_alloc_buffer_full (pad, offset, size, caps, buf, FALSE);
@ -3070,10 +3067,8 @@ gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size, GstCaps * caps,
* *
* MT safe. * MT safe.
*/ */
/* FIXME 0.11: size should be unsigned */
GstFlowReturn GstFlowReturn
gst_pad_alloc_buffer_and_set_caps (GstPad * pad, guint64 offset, gint size, gst_pad_alloc_buffer_and_set_caps (GstPad * pad, guint64 offset, guint size,
GstCaps * caps, GstBuffer ** buf) GstCaps * caps, GstBuffer ** buf)
{ {
return gst_pad_alloc_buffer_full (pad, offset, size, caps, buf, TRUE); return gst_pad_alloc_buffer_full (pad, offset, size, caps, buf, TRUE);

View file

@ -848,9 +848,9 @@ gpointer gst_pad_get_element_private (GstPad *pad);
GstPadTemplate* gst_pad_get_pad_template (GstPad *pad); GstPadTemplate* gst_pad_get_pad_template (GstPad *pad);
void gst_pad_set_bufferalloc_function (GstPad *pad, GstPadBufferAllocFunction bufalloc); void gst_pad_set_bufferalloc_function (GstPad *pad, GstPadBufferAllocFunction bufalloc);
GstFlowReturn gst_pad_alloc_buffer (GstPad *pad, guint64 offset, gint size, GstFlowReturn gst_pad_alloc_buffer (GstPad *pad, guint64 offset, guint size,
GstCaps *caps, GstBuffer **buf); GstCaps *caps, GstBuffer **buf);
GstFlowReturn gst_pad_alloc_buffer_and_set_caps (GstPad *pad, guint64 offset, gint size, GstFlowReturn gst_pad_alloc_buffer_and_set_caps (GstPad *pad, guint64 offset, guint size,
GstCaps *caps, GstBuffer **buf); GstCaps *caps, GstBuffer **buf);
/* data passing setup functions */ /* data passing setup functions */