/**
* SECTION:gstsegment
+ * @title: GstSegment
* @short_description: Structure describing the configured region of interest
* in a media file.
* @see_also: #GstEvent
* interest in a media file, called a segment.
*
* The structure can be used for two purposes:
- * <itemizedlist>
- * <listitem><para>performing seeks (handling seek events)</para></listitem>
- * <listitem><para>tracking playback regions (handling newsegment events)</para></listitem>
- * </itemizedlist>
+ *
+ * * performing seeks (handling seek events)
+ * * tracking playback regions (handling newsegment events)
*
* The segment is usually configured by the application with a seek event which
* is propagated upstream and eventually handled by an element that performs the seek.
* info to stream time (which is always between 0 and the duration of the stream).
*/
+/* FIXME 2.0: remove unused format parameter.
+ * Most of the methods in gstsegment.c take and extra GstFormat format, just to
+ * verify segment->format == format.
+ * See https://bugzilla.gnome.org/show_bug.cgi?id=788979
+ */
+
/**
* gst_segment_copy:
* @segment: (transfer none): a #GstSegment
* @start: the seek start value
* @stop_type: the seek method
* @stop: the seek stop value
- * @update: boolean holding whether position was updated.
+ * @update: (out) (allow-none): boolean holding whether position was updated.
*
* Update the segment structure with the field values of a seek event (see
* gst_event_new_seek()).
* @segment: a #GstSegment structure.
* @format: the format of the segment.
* @position: the position in the segment
- * @stream_time: result stream-time
+ * @stream_time: (out): result stream-time
*
* Translate @position to the total stream time using the currently configured
* segment. Compared to gst_segment_to_stream_time() this function can return
if (gst_segment_to_stream_time_full (segment, format, position, &result) == 1)
return result;
- return 0;
+ return -1;
}
/**
* @segment: a #GstSegment structure.
* @format: the format of the segment.
* @stream_time: the stream-time
- * @position: the resulting position in the segment
+ * @position: (out): the resulting position in the segment
*
* Translate @stream_time to the segment position using the currently configured
* segment. Compared to gst_segment_position_from_stream_time() this function can
* @segment: a #GstSegment structure.
* @format: the format of the segment.
* @position: the position in the segment
- * @running_time: result running-time
+ * @running_time: (out) (allow-none): result running-time
*
* Translate @position to the total running time using the currently configured
* segment. Compared to gst_segment_to_running_time() this function can return
g_return_val_if_fail (segment->format == format, FALSE);
/* if we have a stop position and a valid start and start is bigger,
- * we're outside of the segment */
- if (G_UNLIKELY (segment->stop != -1 && start != -1 && start >= segment->stop))
+ * we're outside of the segment. (Special case) segment start and
+ * segment stop can be identical. In this case, if start is also identical,
+ * it's inside of segment */
+ if (G_UNLIKELY (segment->stop != -1 && start != -1 && (start > segment->stop
+ || (segment->start != segment->stop && start == segment->stop))))
return FALSE;
/* if a stop position is given and is before the segment start,
gst_segment_position_from_running_time_full (segment, format,
running_time, &position);
- if (res != 1) {
- g_print
- ("here with start %lu stop %lu base %lu rate %f offset %lu running_time %lu position %lu\n",
- segment->start, segment->stop, segment->base, segment->rate,
- segment->offset, running_time, position);
+ if (res != 1)
return -1;
- }
/* before the segment boundary */
if (G_UNLIKELY (position < segment->start)) {
* @segment: a #GstSegment structure.
* @format: the format of the segment.
* @running_time: the running-time
- * @position: the resulting position in the segment
+ * @position: (out): the resulting position in the segment
*
* Translate @running_time to the segment position using the currently configured
* segment. Compared to gst_segment_position_from_running_time() this function can
* Returns: the position in the segment for @running_time. This function returns
* -1 when @running_time is -1 or when it is not inside @segment.
*
- * Deprecated. Use gst_segment_position_from_running_time() instead.
+ * Deprecated: Use gst_segment_position_from_running_time() instead.
*/
#ifndef GST_REMOVE_DEPRECATED
-#ifdef GST_DISABLE_DEPRECATED
-guint64 gst_segment_to_position (const GstSegment * segment, GstFormat format,
- guint64 running_time);
-#endif
guint64
gst_segment_to_position (const GstSegment * segment, GstFormat format,
guint64 running_time)