* @media: a #GstRTSPMedia
* @play: for the PLAY request
*
- * Get the current range as a string.
+ * Get the current range as a string. @media must be prepared with
+ * gst_rtsp_media_prepare ().
*
* Returns: The range as a string, g_free() after usage.
*/
gchar *result;
GstRTSPTimeRange range;
+ g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), NULL);
+
+ g_rec_mutex_lock (&media->state_lock);
+ if (media->status != GST_RTSP_MEDIA_STATUS_PREPARED)
+ goto not_prepared;
+
g_mutex_lock (&media->lock);
/* make copy */
range = media->range;
range.min.seconds = -1;
}
g_mutex_unlock (&media->lock);
+ g_rec_mutex_unlock (&media->state_lock);
result = gst_rtsp_range_to_string (&range);
return result;
+
+ /* ERRORS */
+not_prepared:
+ {
+ GST_WARNING ("media %p was not prepared", media);
+ g_rec_mutex_unlock (&media->state_lock);
+ return NULL;
+ }
}
/**
* @media: a #GstRTSPMedia
* @range: a #GstRTSPTimeRange
*
- * Seek the pipeline to @range.
+ * Seek the pipeline of @media to @range. @media must be prepared with
+ * gst_rtsp_media_prepare().
*
* Returns: %TRUE on success.
*/
g_return_val_if_fail (range != NULL, FALSE);
g_rec_mutex_lock (&media->state_lock);
+ if (media->status != GST_RTSP_MEDIA_STATUS_PREPARED)
+ goto not_prepared;
+
if (!media->seekable)
goto not_seekable;
return res;
/* ERRORS */
+not_prepared:
+ {
+ g_rec_mutex_unlock (&media->state_lock);
+ GST_INFO ("media %p is not prepared", media);
+ return FALSE;
+ }
not_seekable:
{
g_rec_mutex_unlock (&media->state_lock);
GstBus *bus;
GList *walk;
+ g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), FALSE);
+
g_rec_mutex_lock (&media->state_lock);
if (media->status == GST_RTSP_MEDIA_STATUS_PREPARED)
goto was_prepared;
{
gboolean success;
+ g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), FALSE);
+
g_rec_mutex_lock (&media->state_lock);
if (media->status == GST_RTSP_MEDIA_STATUS_UNPREPARED)
goto was_unprepared;
*
* Set the state of @media to @state and for the transports in @transports.
*
+ * @media must be prepared with gst_rtsp_media_prepare();
+ *
* Returns: %TRUE on success.
*/
gboolean
g_return_val_if_fail (transports != NULL, FALSE);
g_rec_mutex_lock (&media->state_lock);
+ if (media->status != GST_RTSP_MEDIA_STATUS_PREPARED)
+ goto not_prepared;
/* NULL and READY are the same */
if (state == GST_STATE_READY)
g_rec_mutex_unlock (&media->state_lock);
return TRUE;
+
+ /* ERRORS */
+not_prepared:
+ {
+ GST_WARNING ("media %p was not prepared", media);
+ g_rec_mutex_unlock (&media->state_lock);
+ return FALSE;
+ }
}