Commit 3a81f04d authored by Ronald S. Bultje's avatar Ronald S. Bultje

ext/ffmpeg/gstffmpegdec.c: Handle return values of gst_pad_push().

Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame),
(gst_ffmpegdec_sink_event), (gst_ffmpegdec_chain):
Handle return values of gst_pad_push().
parent e175b7ab
2005-08-16 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame),
(gst_ffmpegdec_sink_event), (gst_ffmpegdec_chain):
Handle return values of gst_pad_push().
2005-08-15 Ronald S. Bultje <rbultje@ronald.bitfreak.net> 2005-08-15 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps): * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps):
......
common @ 8ff526a3
Subproject commit 856fbbfa88621ab67df141ead8d4d3df32c5c176 Subproject commit 8ff526a316f9b576e727b8e32cba0a53cdec07a6
...@@ -684,13 +684,13 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec) ...@@ -684,13 +684,13 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec)
static gint static gint
gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec, gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
guint8 * data, guint size, gint * got_data, guint64 * in_ts) guint8 * data, guint size, gint * got_data, guint64 * in_ts,
GstFlowReturn * ret)
{ {
GstFFMpegDecClass *oclass = GstFFMpegDecClass *oclass =
(GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec)); (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
GstBuffer *outbuf = NULL; GstBuffer *outbuf = NULL;
gint have_data = 0, len = 0; gint have_data = 0, len = 0;
GstFlowReturn ret;
ffmpegdec->context->frame_number++; ffmpegdec->context->frame_number++;
...@@ -762,8 +762,8 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec, ...@@ -762,8 +762,8 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
if (!gst_ffmpegdec_negotiate (ffmpegdec)) if (!gst_ffmpegdec_negotiate (ffmpegdec))
return -1; return -1;
if ((ret = gst_pad_alloc_buffer (ffmpegdec->srcpad, GST_BUFFER_OFFSET_NONE, fsize, GST_PAD_CAPS (ffmpegdec->srcpad), &outbuf)) != GST_FLOW_OK) if ((*ret = gst_pad_alloc_buffer (ffmpegdec->srcpad, GST_BUFFER_OFFSET_NONE, fsize, GST_PAD_CAPS (ffmpegdec->srcpad), &outbuf)) != GST_FLOW_OK)
return ret; return -1;
/* original ffmpeg code does not handle odd sizes correctly. /* original ffmpeg code does not handle odd sizes correctly.
* This patched up version does */ * This patched up version does */
...@@ -888,7 +888,7 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec, ...@@ -888,7 +888,7 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
GST_TIME_FORMAT ")", GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf))); GST_TIME_FORMAT ")", GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)));
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (ffmpegdec->srcpad)); gst_buffer_set_caps (outbuf, GST_PAD_CAPS (ffmpegdec->srcpad));
gst_pad_push (ffmpegdec->srcpad, outbuf); *ret = gst_pad_push (ffmpegdec->srcpad, outbuf);
} }
return len; return len;
...@@ -909,8 +909,9 @@ gst_ffmpegdec_sink_event (GstPad * pad, GstEvent * event) ...@@ -909,8 +909,9 @@ gst_ffmpegdec_sink_event (GstPad * pad, GstEvent * event)
if (oclass->in_plugin->capabilities & CODEC_CAP_DELAY) { if (oclass->in_plugin->capabilities & CODEC_CAP_DELAY) {
gint have_data, len, try = 0; gint have_data, len, try = 0;
do { do {
GstFlowReturn ret;
len = gst_ffmpegdec_frame (ffmpegdec, NULL, 0, &have_data, len = gst_ffmpegdec_frame (ffmpegdec, NULL, 0, &have_data,
&ffmpegdec->next_ts); &ffmpegdec->next_ts, &ret);
if (len < 0 || have_data == 0) if (len < 0 || have_data == 0)
break; break;
} while (try++ < 10); } while (try++ < 10);
...@@ -975,6 +976,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf) ...@@ -975,6 +976,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf)
guint8 *bdata, *data; guint8 *bdata, *data;
gint bsize, size, len, have_data; gint bsize, size, len, have_data;
guint64 in_ts = GST_BUFFER_TIMESTAMP (inbuf); guint64 in_ts = GST_BUFFER_TIMESTAMP (inbuf);
GstFlowReturn ret = GST_FLOW_OK;
if (!ffmpegdec->opened) if (!ffmpegdec->opened)
goto not_negotiated; goto not_negotiated;
...@@ -1033,7 +1035,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf) ...@@ -1033,7 +1035,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf)
} }
if ((len = gst_ffmpegdec_frame (ffmpegdec, data, size, if ((len = gst_ffmpegdec_frame (ffmpegdec, data, size,
&have_data, &in_ts)) < 0) &have_data, &in_ts, &ret)) < 0 || ret != GST_FLOW_OK)
break; break;
if (!ffmpegdec->pctx) { if (!ffmpegdec->pctx) {
...@@ -1057,7 +1059,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf) ...@@ -1057,7 +1059,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf)
} }
gst_buffer_unref (inbuf); gst_buffer_unref (inbuf);
return GST_FLOW_OK; return ret;
/* ERRORS */ /* ERRORS */
not_negotiated: not_negotiated:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment