mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 04:31:06 +00:00
media: convert_range replaces get_range_times
get_range_times worked for handling UTC ranges for seeks, but we also need to convert back from NPT to the requested unit in get_range_string. convert_range is now used for both. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=702084
This commit is contained in:
parent
3dbe0e17d4
commit
6151072a2e
3 changed files with 26 additions and 14 deletions
|
@ -882,8 +882,8 @@ handle_play_request (GstRTSPClient * client, GstRTSPClientState * state)
|
|||
if (res == GST_RTSP_OK) {
|
||||
if (gst_rtsp_range_parse (str, &range) == GST_RTSP_OK) {
|
||||
/* we have a range, seek to the position */
|
||||
gst_rtsp_media_seek (gst_rtsp_session_media_get_media (media), range);
|
||||
unit = range->unit;
|
||||
gst_rtsp_media_seek (gst_rtsp_session_media_get_media (media), range);
|
||||
gst_rtsp_range_free (range);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,8 +123,9 @@ static gboolean default_handle_message (GstRTSPMedia * media,
|
|||
GstMessage * message);
|
||||
static void finish_unprepare (GstRTSPMedia * media);
|
||||
static gboolean default_unprepare (GstRTSPMedia * media);
|
||||
static gboolean default_get_range_times (GstRTSPMedia * media,
|
||||
const GstRTSPTimeRange * range, GstClockTime * min, GstClockTime * max);
|
||||
static gboolean
|
||||
default_convert_range (GstRTSPMedia * media, GstRTSPTimeRange * range,
|
||||
GstRTSPRangeUnit unit);
|
||||
|
||||
static guint gst_rtsp_media_signals[SIGNAL_LAST] = { 0 };
|
||||
|
||||
|
@ -213,7 +214,7 @@ gst_rtsp_media_class_init (GstRTSPMediaClass * klass)
|
|||
|
||||
klass->handle_message = default_handle_message;
|
||||
klass->unprepare = default_unprepare;
|
||||
klass->get_range_times = default_get_range_times;
|
||||
klass->convert_range = default_convert_range;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1076,11 +1077,14 @@ gchar *
|
|||
gst_rtsp_media_get_range_string (GstRTSPMedia * media, gboolean play,
|
||||
GstRTSPRangeUnit unit)
|
||||
{
|
||||
GstRTSPMediaClass *klass;
|
||||
GstRTSPMediaPrivate *priv;
|
||||
gchar *result;
|
||||
GstRTSPTimeRange range;
|
||||
|
||||
klass = GST_RTSP_MEDIA_GET_CLASS (media);
|
||||
g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), NULL);
|
||||
g_return_val_if_fail (klass->convert_range != NULL, FALSE);
|
||||
|
||||
priv = media->priv;
|
||||
|
||||
|
@ -1099,7 +1103,9 @@ gst_rtsp_media_get_range_string (GstRTSPMedia * media, gboolean play,
|
|||
g_mutex_unlock (&priv->lock);
|
||||
g_rec_mutex_unlock (&priv->state_lock);
|
||||
|
||||
gst_rtsp_range_convert_units (&range, unit);
|
||||
if (!klass->convert_range (media, &range, unit)) {
|
||||
goto conversion_failed;
|
||||
}
|
||||
|
||||
result = gst_rtsp_range_to_string (&range);
|
||||
|
||||
|
@ -1112,6 +1118,12 @@ not_prepared:
|
|||
g_rec_mutex_unlock (&priv->state_lock);
|
||||
return NULL;
|
||||
}
|
||||
conversion_failed:
|
||||
{
|
||||
GST_WARNING ("range conversion to unit %d failed", unit);
|
||||
g_rec_mutex_unlock (&priv->state_lock);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1138,7 +1150,7 @@ gst_rtsp_media_seek (GstRTSPMedia * media, GstRTSPTimeRange * range)
|
|||
|
||||
g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), FALSE);
|
||||
g_return_val_if_fail (range != NULL, FALSE);
|
||||
g_return_val_if_fail (klass->get_range_times != NULL, FALSE);
|
||||
g_return_val_if_fail (klass->convert_range != NULL, FALSE);
|
||||
|
||||
priv = media->priv;
|
||||
|
||||
|
@ -1155,8 +1167,9 @@ gst_rtsp_media_seek (GstRTSPMedia * media, GstRTSPTimeRange * range)
|
|||
|
||||
start_type = stop_type = GST_SEEK_TYPE_NONE;
|
||||
|
||||
if (!klass->get_range_times (media, range, &start, &stop))
|
||||
if (!klass->convert_range (media, range, GST_RTSP_RANGE_NPT))
|
||||
goto not_supported;
|
||||
gst_rtsp_range_get_times (range, &start, &stop);
|
||||
|
||||
GST_INFO ("got %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (start), GST_TIME_ARGS (stop));
|
||||
|
@ -1210,7 +1223,7 @@ not_seekable:
|
|||
not_supported:
|
||||
{
|
||||
g_rec_mutex_unlock (&priv->state_lock);
|
||||
GST_WARNING ("seek unit %d not supported", range->unit);
|
||||
GST_WARNING ("conversion to npt not supported");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -2053,8 +2066,8 @@ not_prepared:
|
|||
|
||||
/* called with state-lock */
|
||||
static gboolean
|
||||
default_get_range_times (GstRTSPMedia * media,
|
||||
const GstRTSPTimeRange * range, GstClockTime * min, GstClockTime * max)
|
||||
default_convert_range (GstRTSPMedia * media, GstRTSPTimeRange * range,
|
||||
GstRTSPRangeUnit unit)
|
||||
{
|
||||
return gst_rtsp_range_get_times (range, min, max);
|
||||
return gst_rtsp_range_convert_units (range, unit);
|
||||
}
|
||||
|
|
|
@ -100,9 +100,8 @@ struct _GstRTSPMediaClass {
|
|||
/* vmethods */
|
||||
gboolean (*handle_message) (GstRTSPMedia *media, GstMessage *message);
|
||||
gboolean (*unprepare) (GstRTSPMedia *media);
|
||||
gboolean (*get_range_times) (GstRTSPMedia *media,
|
||||
const GstRTSPTimeRange * range,
|
||||
GstClockTime * min, GstClockTime * max);
|
||||
gboolean (*convert_range) (GstRTSPMedia *media, GstRTSPTimeRange *range,
|
||||
GstRTSPRangeUnit unit);
|
||||
|
||||
/* signals */
|
||||
void (*new_stream) (GstRTSPMedia *media, GstRTSPStream * stream);
|
||||
|
|
Loading…
Reference in a new issue