diff --git a/lib/gst/clapper/gstclapper.c b/lib/gst/clapper/gstclapper.c index 8b6e14c6..93708a1d 100644 --- a/lib/gst/clapper/gstclapper.c +++ b/lib/gst/clapper/gstclapper.c @@ -1066,6 +1066,8 @@ tick_cb (gpointer user_data) position_updated_dispatch, data, (GDestroyNotify) position_updated_signal_data_free); } + if (self->mpris) + gst_clapper_mpris_set_position (self->mpris, position); } return G_SOURCE_CONTINUE; @@ -3519,6 +3521,29 @@ gst_clapper_seek (GstClapper * self, GstClockTime position) g_mutex_unlock (&self->lock); } +/** + * gst_clapper_seek_offset: + * @clapper: #GstClapper instance + * @offset: offset from current position to seek to in nanoseconds + * + * Seeks the currently-playing stream to the @offset time + * in nanoseconds. + */ +void +gst_clapper_seek_offset (GstClapper * self, GstClockTime offset) +{ + GstClockTime position; + + g_return_if_fail (GST_IS_CLAPPER (self)); + g_return_if_fail (GST_CLOCK_TIME_IS_VALID (offset)); + + position = gst_clapper_get_position (self); + + /* TODO: Prevent negative values */ + + gst_clapper_seek (self, position + offset); +} + static void remove_seek_source (GstClapper * self) { diff --git a/lib/gst/clapper/gstclapper.h b/lib/gst/clapper/gstclapper.h index 1150060f..35895109 100644 --- a/lib/gst/clapper/gstclapper.h +++ b/lib/gst/clapper/gstclapper.h @@ -172,6 +172,9 @@ void gst_clapper_stop (GstClapper *clapper GST_CLAPPER_API void gst_clapper_seek (GstClapper *clapper, GstClockTime position); +GST_CLAPPER_API +void gst_clapper_seek_offset (GstClapper *clapper, GstClockTime offset); + GST_CLAPPER_API GstClapperState gst_clapper_get_state (GstClapper *clapper);