+ return TRUE;
+
+ /* ERRORS */
+no_create_rtpbin:
+ {
+ GST_ERROR ("no create_rtpbin function");
+ g_critical ("no create_rtpbin vmethod function set");
+ return FALSE;
+ }
+no_rtpbin:
+ {
+ GST_WARNING ("no rtpbin element");
+ g_warning ("failed to create element 'rtpbin', check your installation");
+ return FALSE;
+ }
+}
+
+/**
+ * gst_rtsp_media_prepare:
+ * @media: a #GstRTSPMedia
+ * @thread: (transfer full) (allow-none): a #GstRTSPThread to run the
+ * bus handler or %NULL
+ *
+ * Prepare @media for streaming. This function will create the objects
+ * to manage the streaming. A pipeline must have been set on @media with
+ * gst_rtsp_media_take_pipeline().
+ *
+ * It will preroll the pipeline and collect vital information about the streams
+ * such as the duration.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+gst_rtsp_media_prepare (GstRTSPMedia * media, GstRTSPThread * thread)
+{
+ GstRTSPMediaPrivate *priv;
+ GstRTSPMediaClass *klass;
+
+ g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), FALSE);
+
+ priv = media->priv;
+
+ g_rec_mutex_lock (&priv->state_lock);
+ priv->prepare_count++;
+
+ if (priv->status == GST_RTSP_MEDIA_STATUS_PREPARED ||
+ priv->status == GST_RTSP_MEDIA_STATUS_SUSPENDED)
+ goto was_prepared;
+
+ if (priv->status == GST_RTSP_MEDIA_STATUS_PREPARING)
+ goto is_preparing;
+
+ if (priv->status != GST_RTSP_MEDIA_STATUS_UNPREPARED)
+ goto not_unprepared;
+
+ if (!priv->reusable && priv->reused)
+ goto is_reused;
+
+ GST_INFO ("preparing media %p", media);
+
+ /* reset some variables */
+ priv->is_live = FALSE;
+ priv->seekable = FALSE;
+ priv->buffering = FALSE;
+
+ /* we're preparing now */
+ gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARING);
+
+ klass = GST_RTSP_MEDIA_GET_CLASS (media);
+ if (klass->prepare) {
+ if (!klass->prepare (media, thread))
+ goto prepare_failed;
+ }
+