From 0e3917b9c0d7f4d75042c35a3e6d2bad1fb906f0 Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Fri, 20 Dec 2013 18:12:53 +0100 Subject: [PATCH] modplug: small seeking code reshuffle Put the code that checks stop values together. Don't clamp a cur value of -1 to 0 (should not happen right now). --- ext/modplug/gstmodplug.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/modplug/gstmodplug.cc b/ext/modplug/gstmodplug.cc index a968c4a48a..1f7115ef6c 100644 --- a/ext/modplug/gstmodplug.cc +++ b/ext/modplug/gstmodplug.cc @@ -345,8 +345,8 @@ gst_modplug_do_seek (GstModPlug * modplug, GstEvent * event) modplug->frequency); #endif - gst_event_parse_seek (event, &rate, &format, &flags, - &cur_type, &cur, &stop_type, &stop); + gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur, + &stop_type, &stop); if (format != GST_FORMAT_TIME) goto no_time; @@ -357,8 +357,10 @@ gst_modplug_do_seek (GstModPlug * modplug, GstEvent * event) if (stop_type == GST_SEEK_TYPE_NONE) stop = GST_CLOCK_TIME_NONE; + if (!GST_CLOCK_TIME_IS_VALID (stop) && modplug->song_length > 0) + stop = modplug->song_length; - cur = CLAMP (cur, 0, modplug->song_length); + cur = CLAMP (cur, -1, modplug->song_length); GST_DEBUG_OBJECT (modplug, "seek to %" GST_TIME_FORMAT, GST_TIME_ARGS ((guint64) cur)); @@ -379,8 +381,6 @@ gst_modplug_do_seek (GstModPlug * modplug, GstEvent * event) gst_element_post_message (GST_ELEMENT (modplug), gst_message_new_segment_start (GST_OBJECT (modplug), format, cur)); } - if (stop == -1 && modplug->song_length > 0) - stop = modplug->song_length; if (flush) { gst_pad_push_event (modplug->srcpad, gst_event_new_flush_stop (TRUE));