ext/ffmpeg/gstffmpegdec.c: Next try at using pad_alloc_buffer (#300923).

Original commit message from CVS:
Reviewed by:  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame):
Next try at using pad_alloc_buffer (#300923).
This commit is contained in:
Ronald S. Bultje 2005-04-18 09:51:44 +00:00
parent 735b7d7bb9
commit fa496b82c7
2 changed files with 18 additions and 6 deletions

View file

@ -1,3 +1,10 @@
2005-04-18 Luca Ognibene <luogni@tin.it>
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame):
Next try at using pad_alloc_buffer (#300923).
2005-04-16 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame):

View file

@ -645,7 +645,11 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
ffmpegdec->context->width, ffmpegdec->context->height);
ffmpegdec->waiting_for_key = FALSE;
outbuf = gst_buffer_new_and_alloc (fsize);
if (!gst_ffmpegdec_negotiate (ffmpegdec))
return -1;
outbuf = gst_pad_alloc_buffer (ffmpegdec->srcpad, GST_BUFFER_OFFSET_NONE, fsize);
/* original ffmpeg code does not handle odd sizes correctly.
* This patched up version does */
@ -719,6 +723,12 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
"Decode audio: len=%d, have_data=%d", len, have_data);
if (len >= 0 && have_data > 0) {
if (!gst_ffmpegdec_negotiate (ffmpegdec)) {
gst_buffer_unref (outbuf);
return -1;
}
GST_BUFFER_SIZE (outbuf) = have_data;
if (GST_CLOCK_TIME_IS_VALID (*in_ts)) {
ffmpegdec->next_ts = *in_ts;
@ -756,11 +766,6 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
GST_DEBUG_OBJECT (ffmpegdec, "Decoded data, now pushing (%"
GST_TIME_FORMAT ")", GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)));
if (!gst_ffmpegdec_negotiate (ffmpegdec)) {
gst_buffer_unref (outbuf);
return -1;
}
if (GST_PAD_IS_USABLE (ffmpegdec->srcpad))
gst_pad_push (ffmpegdec->srcpad, GST_DATA (outbuf));
else