nlesource: When standalone consider object.duration==0 as not set

nleobject.duration defaults to 0, but this is pretty unintuitive for
end user in the case nlesource is use standalone, just consider
duration=0 equivalent to duration=GST_CLOCK_TIME_NONE as it makes
the element much simpler to use, we could actually forbid 0 as a value
in the future.

Also take into account potential CLOCK_TIME_NONE
This commit is contained in:
Thibault Saunier 2020-02-18 23:08:53 -03:00
parent 0be8bc9d98
commit b7c4171f31

View file

@ -535,12 +535,18 @@ nle_source_prepare (NleObject * object)
priv->ghostedpad = pad;
if (object->in_composition == FALSE) {
GstClockTime start =
GST_CLOCK_TIME_IS_VALID (object->inpoint) ? object->inpoint : 0;
GstClockTime stop = GST_CLOCK_TIME_NONE;
if (GST_CLOCK_TIME_IS_VALID (object->inpoint)
&& GST_CLOCK_TIME_IS_VALID (object->duration) && object->duration)
stop = object->inpoint + object->duration;
g_mutex_lock (&source->priv->seek_lock);
source->priv->seek_event =
gst_event_new_seek (1.0, GST_FORMAT_TIME,
source->priv->seek_event = gst_event_new_seek (1.0, GST_FORMAT_TIME,
GST_SEEK_FLAG_ACCURATE | GST_SEEK_FLAG_FLUSH,
GST_SEEK_TYPE_SET, object->inpoint, GST_SEEK_TYPE_SET,
object->inpoint + object->duration);
GST_SEEK_TYPE_SET, start, GST_SEEK_TYPE_SET, stop);
g_mutex_unlock (&source->priv->seek_lock);
GST_OBJECT_LOCK (source);
priv->probeid = gst_pad_add_probe (pad,