const guint8 *data;
GstBuffer *buf = NULL;
- ret = gst_pad_alloc_buffer_and_set_caps (demux->srcpad,
- GST_BUFFER_OFFSET_NONE, unit_size, GST_PAD_CAPS (demux->srcpad), &buf);
-
- if (ret != GST_FLOW_OK) {
- GST_DEBUG_OBJECT (demux, "pad_alloc flow: %s", gst_flow_get_name (ret));
- break;
- }
+ buf = gst_buffer_new_and_alloc (unit_size);
+ gst_buffer_set_caps (buf, GST_PAD_CAPS (demux->srcpad));
data = gst_adapter_peek (demux->adapter, unit_size);
memcpy (GST_BUFFER_DATA (buf), data, unit_size);
GST_LOG ("packet_size = %u, leaf_size = %u, height= %u", packet_size,
leaf_size, height);
- ret = gst_pad_alloc_buffer_and_set_caps (stream->pad,
- GST_BUFFER_OFFSET_NONE, height * packet_size,
- GST_PAD_CAPS (stream->pad), &outbuf);
-
- if (ret != GST_FLOW_OK)
- goto done;
+ outbuf = gst_buffer_new_and_alloc (height * packet_size);
+ gst_buffer_set_caps (outbuf, GST_PAD_CAPS (stream->pad));
for (p = 0; p < height; ++p) {
GstBuffer *b = g_ptr_array_index (stream->subpackets, p);
gst_buffer_unref (outbuf);
-done:
-
gst_rmdemux_stream_clear_cached_subpackets (rmdemux, stream);
return ret;
GST_LOG ("packet_size = %u, leaf_size = %u, height= %u", packet_size,
stream->leaf_size, height);
- ret = gst_pad_alloc_buffer_and_set_caps (stream->pad,
- GST_BUFFER_OFFSET_NONE, height * packet_size,
- GST_PAD_CAPS (stream->pad), &outbuf);
-
- if (ret != GST_FLOW_OK)
- goto done;
+ outbuf = gst_buffer_new_and_alloc (height * packet_size);
+ gst_buffer_set_caps (outbuf, GST_PAD_CAPS (stream->pad));
for (p = 0; p < height; ++p) {
GstBuffer *b = g_ptr_array_index (stream->subpackets, p);
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (stream->pad));
ret = gst_pad_push (stream->pad, outbuf);
-done:
-
gst_rmdemux_stream_clear_cached_subpackets (rmdemux, stream);
return ret;
GstBuffer * in, guint offset, guint16 version,
GstClockTime timestamp, gboolean key)
{
- GstFlowReturn ret, cret;
+ GstFlowReturn ret;
GstBuffer *buffer;
const guint8 *data;
guint size;
data = GST_BUFFER_DATA (in) + offset;
size = GST_BUFFER_SIZE (in) - offset;
- ret = gst_pad_alloc_buffer_and_set_caps (stream->pad,
- GST_BUFFER_OFFSET_NONE, size, GST_PAD_CAPS (stream->pad), &buffer);
-
- cret = gst_rmdemux_combine_flows (rmdemux, stream, ret);
- if (ret != GST_FLOW_OK)
- goto alloc_failed;
+ buffer = gst_buffer_new_and_alloc (size);
+ gst_buffer_set_caps (buffer, GST_PAD_CAPS (stream->pad));
memcpy (GST_BUFFER_DATA (buffer), (guint8 *) data, size);
gst_buffer_unref (in);
return ret;
-
- /* ERRORS */
-alloc_failed:
- {
- GST_DEBUG_OBJECT (rmdemux, "pad alloc returned %d", ret);
- gst_buffer_unref (in);
- return cret;
- }
}
static GstFlowReturn