* an EOS message to be posted on the pipeline's bus. Once this EOS message is
* received, it may safely shut down the entire pipeline.
*
- * The old behaviour for controlled shutdown introduced since GStreamer 0.10.3
- * is still available but deprecated as it is dangerous and less flexible.
- *
* Last reviewed on 2007-12-19 (0.10.16)
* </para>
* </refsect2>
struct _GstBaseSrcPrivate
{
- gboolean last_sent_eos; /* last thing we did was send an EOS (we set this
- * to avoid the sending of two EOS in some cases) */
gboolean discont;
gboolean flushing;
if (G_UNLIKELY (src->priv->flushing))
goto flushing;
- src->priv->last_sent_eos = FALSE;
-
blocksize = src->blocksize;
/* if we operate in bytes, we can calculate an offset */
event = gst_event_new_eos ();
gst_event_set_seqnum (event, src->priv->seqnum);
gst_pad_push_event (pad, event);
- src->priv->last_sent_eos = TRUE;
}
} else if (ret == GST_FLOW_NOT_LINKED || ret <= GST_FLOW_UNEXPECTED) {
event = gst_event_new_eos ();
(_("Internal data flow error.")),
("streaming task paused, reason %s (%d)", reason, ret));
gst_pad_push_event (pad, event);
- src->priv->last_sent_eos = TRUE;
}
goto done;
}
if (G_UNLIKELY (!gst_base_src_start (basesrc)))
goto error_start;
- basesrc->priv->last_sent_eos = FALSE;
basesrc->priv->discont = TRUE;
gst_base_src_set_flushing (basesrc, FALSE, FALSE, FALSE, NULL);
/* flush all, there is no task to stop */
gst_base_src_set_flushing (basesrc, TRUE, FALSE, TRUE, NULL);
- /* don't send EOS when going from PAUSED => READY when in pull mode */
- basesrc->priv->last_sent_eos = TRUE;
-
if (G_UNLIKELY (!gst_base_src_stop (basesrc)))
goto error_stop;
}
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
{
- GstEvent **event_p, *event;
+ GstEvent **event_p;
/* we don't need to unblock anything here, the pad deactivation code
* already did this */
-
- /* FIXME, deprecate this behaviour, it is very dangerous.
- * the prefered way of sending EOS downstream is by sending
- * the EOS event to the element */
- if (!basesrc->priv->last_sent_eos) {
- GST_DEBUG_OBJECT (basesrc, "Sending EOS event");
- event = gst_event_new_eos ();
- gst_event_set_seqnum (event, basesrc->priv->seqnum);
- gst_pad_push_event (basesrc->srcpad, event);
- basesrc->priv->last_sent_eos = TRUE;
- }
g_atomic_int_set (&basesrc->priv->pending_eos, FALSE);
event_p = &basesrc->pending_seek;
gst_event_replace (event_p, NULL);
/* wait a second, then do controlled shutdown */
g_usleep (GST_USECOND * 1);
- /* shut down source only (should send EOS event) ... */
- gst_element_set_state (src, GST_STATE_NULL);
- state_ret = gst_element_get_state (src, NULL, NULL, -1);
- fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS);
-
- fail_unless (gst_element_set_locked_state (src, TRUE) == TRUE);
+ /* shut down pipeline (should send EOS message) ... */
+ gst_element_send_event (pipe, gst_event_new_eos ());
/* ... and wait for the EOS message from the sink */
msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1);
GST_END_TEST;
+
+
/* basesrc_eos_events_push:
* - make sure source only sends one EOS when operating in push-mode,
* reaching the max number of buffers, and is then shut down.
/* wait a second, then do controlled shutdown */
g_usleep (GST_USECOND * 1);
- /* shut down source only (should send EOS event) ... */
- gst_element_set_state (src, GST_STATE_NULL);
- state_ret = gst_element_get_state (src, NULL, NULL, -1);
- fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS);
-
- fail_unless (gst_element_set_locked_state (src, TRUE) == TRUE);
+ /* shut down pipeline only (should send EOS message) ... */
+ gst_element_send_event (pipe, gst_event_new_eos ());
/* ... and wait for the EOS message from the sink */
msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1);