media: possibility to override range time conversion

Make it possible to override the conversion from GstRTSPTimeRange to
GstClockTimes, that is done before seeking on the media
pipeline. Overriding can be useful for UTC ranges, where the default
conversion gives nanoseconds since 1900.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=701191
This commit is contained in:
David Svensson Fors 2013-05-29 13:45:00 +02:00 committed by Wim Taymans
parent c5b3066c33
commit 7efa871c1f
2 changed files with 19 additions and 1 deletions

View file

@ -123,6 +123,8 @@ 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 guint gst_rtsp_media_signals[SIGNAL_LAST] = { 0 };
@ -211,6 +213,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;
}
static void
@ -1124,14 +1127,18 @@ not_prepared:
gboolean
gst_rtsp_media_seek (GstRTSPMedia * media, GstRTSPTimeRange * range)
{
GstRTSPMediaClass *klass;
GstRTSPMediaPrivate *priv;
GstSeekFlags flags;
gboolean res;
GstClockTime start, stop;
GstSeekType start_type, stop_type;
klass = GST_RTSP_MEDIA_GET_CLASS (media);
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);
priv = media->priv;
@ -1148,7 +1155,7 @@ gst_rtsp_media_seek (GstRTSPMedia * media, GstRTSPTimeRange * range)
start_type = stop_type = GST_SEEK_TYPE_NONE;
if (!gst_rtsp_range_get_times (range, &start, &stop))
if (!klass->get_range_times (media, range, &start, &stop))
goto not_supported;
GST_INFO ("got %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT,
@ -2043,3 +2050,11 @@ not_prepared:
return FALSE;
}
}
/* called with state-lock */
static gboolean
default_get_range_times (GstRTSPMedia * media,
const GstRTSPTimeRange * range, GstClockTime * min, GstClockTime * max)
{
return gst_rtsp_range_get_times (range, min, max);
}

View file

@ -100,6 +100,9 @@ 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);
/* signals */
void (*new_stream) (GstRTSPMedia *media, GstRTSPStream * stream);