From: Tim-Philipp Müller Date: Thu, 19 Jan 2006 10:39:27 +0000 (+0000) Subject: docs/pwg/advanced-scheduling.xml: Update from 0.9.x to 0.10 API and make example... X-Git-Tag: RELEASE-0_10_3~68 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5fadea40de7f14daf7cdd028700e1a2be1ad360f;p=platform%2Fupstream%2Fgstreamer.git docs/pwg/advanced-scheduling.xml: Update from 0.9.x to 0.10 API and make example a bit clearer. Original commit message from CVS: * docs/pwg/advanced-scheduling.xml: Update from 0.9.x to 0.10 API and make example a bit clearer. --- diff --git a/ChangeLog b/ChangeLog index ea56db9..e7e0215 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-01-19 Tim-Philipp Müller + + * docs/pwg/advanced-scheduling.xml: + Update from 0.9.x to 0.10 API and make example a bit + clearer. + 2006-01-19 Jan Schmidt * docs/gst/gstreamer-sections.txt: diff --git a/docs/pwg/advanced-scheduling.xml b/docs/pwg/advanced-scheduling.xml index 2aab690..f24c492 100644 --- a/docs/pwg/advanced-scheduling.xml +++ b/docs/pwg/advanced-scheduling.xml @@ -254,24 +254,47 @@ gst_my_filter_activate_pull (GstPad *pad, static void gst_my_filter_loop (GstMyFilter * filter) { + GstFlowReturn ret; guint64 len; GstFormat fmt = GST_FORMAT_BYTES; GstBuffer *buf = NULL; - if (!gst_pad_query_position (filter->sinkpad, &fmt, NULL, &len)) { + if (!gst_pad_query_duration (filter->sinkpad, &fmt, &len)) { + GST_DEBUG_OBJECT (filter, "failed to query duration, pausing"); goto stop; - } else if (filter->offset >= len) { - gst_pad_push_event (filter->sinkpad, gst_event_new (GST_EVENT_EOS)); - } else if (gst_pad_pull_range (filter->sinkpad, filter->offset, - BLOCKSIZE, &buf) != GST_FLOW_OK || - gst_pad_push (filter->sinkpad, buf) != GST_FLOW_OK) { + } + + if (filter->offset >= len) { + GST_DEBUG_OBJECT (filter, "at end of input, sending EOS, pausing"); + gst_pad_push_event (filter->srcpad, gst_event_new_eos ()); + goto stop; + } + + /* now, read BLOCKSIZE bytes from byte offset filter->offset */ + ret = gst_pad_pull_range (filter->sinkpad, filter->offset, + BLOCKSIZE, &buf); + + if (ret != GST_FLOW_OK) { + GST_DEBUG_OBJECT (filter, "pull_range failed: %s", gst_flow_get_name (ret)); goto stop; - } else { - filter->offset += BLOCKSIZE; - return; } + /* now push buffer downstream */ + ret = gst_pad_push (filter->srcpad, buf); + + buf = NULL; /* gst_pad_push() took ownership of buffer */ + + if (ret != GST_FLOW_OK) { + GST_DEBUG_OBJECT (filter, "pad_push failed: %s", gst_flow_get_name (ret)); + goto stop; + } + + /* everything is fine, increase offset and wait for us to be called again */ + filter->offset += BLOCKSIZE; + return; + stop: + GST_DEBUG_OBJECT (filter, "pausing task"); gst_pad_pause_task (filter->sinkpad); }