Original commit message from CVS:
* ext/theora/theoraenc.c (theora_buffer_from_packet, theora_enc_chain):
Don't use pad_alloc_buffer_and_set_caps to create a small header
packet, or, worse, to create a big temporary video buffer using the
src pad.
+2007-04-15 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * ext/theora/theoraenc.c (theora_buffer_from_packet, theora_enc_chain):
+ Don't use pad_alloc_buffer_and_set_caps to create a small header
+ packet, or, worse, to create a big temporary video buffer using the
+ src pad.
+
2007-04-14 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/gdp/gstgdppay.c (gst_gdp_pay_chain):
2007-04-14 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/gdp/gstgdppay.c (gst_gdp_pay_chain):
GstClockTime timestamp, GstClockTime duration, GstBuffer ** buffer)
{
GstBuffer *buf;
GstClockTime timestamp, GstClockTime duration, GstBuffer ** buffer)
{
GstBuffer *buf;
+ GstFlowReturn ret = GST_FLOW_OK;
- ret = gst_pad_alloc_buffer_and_set_caps (enc->srcpad,
- GST_BUFFER_OFFSET_NONE, packet->bytes, GST_PAD_CAPS (enc->srcpad), &buf);
- if (ret != GST_FLOW_OK)
- goto no_buffer;
+ buf = gst_buffer_new_and_alloc (packet->bytes);
+ if (!buf) {
+ GST_WARNING_OBJECT (enc, "Could not allocate buffer");
+ ret = GST_FLOW_ERROR;
+ goto done;
+ }
memcpy (GST_BUFFER_DATA (buf), packet->packet, packet->bytes);
memcpy (GST_BUFFER_DATA (buf), packet->packet, packet->bytes);
+ gst_buffer_set_caps (buf, GST_PAD_CAPS (enc->srcpad));
/* see ext/ogg/README; OFFSET_END takes "our" granulepos, OFFSET its
* time representation */
GST_BUFFER_OFFSET_END (buf) =
/* see ext/ogg/README; OFFSET_END takes "our" granulepos, OFFSET its
* time representation */
GST_BUFFER_OFFSET_END (buf) =
*buffer = buf;
return ret;
*buffer = buf;
return ret;
-
-no_buffer:
- {
- *buffer = NULL;
- return ret;
- }
}
/* push out the buffer and do internal bookkeeping */
}
/* push out the buffer and do internal bookkeeping */
in_time = GST_BUFFER_TIMESTAMP (buffer);
in_time = GST_BUFFER_TIMESTAMP (buffer);
- /* no packets written yet, setup headers */
if (enc->packetno == 0) {
if (enc->packetno == 0) {
+ /* no packets written yet, setup headers */
GstCaps *caps;
GstBuffer *buf1, *buf2, *buf3;
enc->granulepos_offset = 0;
enc->timestamp_offset = 0;
GstCaps *caps;
GstBuffer *buf1, *buf2, *buf3;
enc->granulepos_offset = 0;
enc->timestamp_offset = 0;
+ GST_DEBUG_OBJECT (enc, "output headers");
/* Theora streams begin with three headers; the initial header (with
most of the codec setup parameters) which is mandated by the Ogg
bitstream spec. The second header holds any comment fields. The
/* Theora streams begin with three headers; the initial header (with
most of the codec setup parameters) which is mandated by the Ogg
bitstream spec. The second header holds any comment fields. The
y_size = enc->info_width * enc->info_height;
if (enc->width == enc->info_width && enc->height == enc->info_height) {
y_size = enc->info_width * enc->info_height;
if (enc->width == enc->info_width && enc->height == enc->info_height) {
+ GST_LOG_OBJECT (enc, "no cropping/conversion needed");
/* easy case, no cropping/conversion needed */
pixels = GST_BUFFER_DATA (buffer);
/* easy case, no cropping/conversion needed */
pixels = GST_BUFFER_DATA (buffer);
gint cwidth, cheight;
gint offset_x, right_x, right_border;
gint cwidth, cheight;
gint offset_x, right_x, right_border;
+ GST_LOG_OBJECT (enc, "cropping/conversion needed for strides");
/* source width/height */
width = enc->width;
height = enc->height;
/* source width/height */
width = enc->width;
height = enc->height;
dst_y_stride = enc->info_width;
dst_uv_stride = enc->info_width / 2;
dst_y_stride = enc->info_width;
dst_uv_stride = enc->info_width / 2;
- ret = gst_pad_alloc_buffer_and_set_caps (enc->srcpad,
- GST_BUFFER_OFFSET_NONE, y_size * 3 / 2, GST_PAD_CAPS (enc->srcpad),
- &newbuf);
- if (ret != GST_FLOW_OK)
+ newbuf = gst_buffer_new_and_alloc (y_size * 3 / 2);
+ if (!newbuf) {
+ ret = GST_FLOW_ERROR;
+ }
+ GST_BUFFER_OFFSET (newbuf) = GST_BUFFER_OFFSET_NONE;
+ gst_buffer_set_caps (newbuf, GST_PAD_CAPS (enc->srcpad));
dest_y = yuv.y = GST_BUFFER_DATA (newbuf);
dest_u = yuv.u = yuv.y + y_size;
dest_y = yuv.y = GST_BUFFER_DATA (newbuf);
dest_u = yuv.u = yuv.y + y_size;
- gst_buffer_unref (buffer);