So, a little more about managing GstToc. Use gst_toc_new() and gst_toc_unref()
to create/free it. GstTocEntry can be created using gst_toc_entry_new().
-While building GstToc you can set start and stop
-timestamps for each item using gst_toc_entry_set_start_stop().
+While building GstToc you can set start and stop timestamps for each item using
+gst_toc_entry_set_start_stop() and loop_type and repeat_count using
+gst_toc_entry_set_loop().
The best way to process already created GstToc is to recursively go through
the 'entries' and 'subentries' fields.
GstClockTime start, stop;
GList *subentries;
GstTagList *tags;
+ GstTocLoopType loop_type;
+ gint repeat_count;
};
struct _GstToc
/**
* gst_toc_entry_get_start_stop_times:
* @entry: #GstTocEntry to get values from.
- * @start: (out): the storage for the start value, leave #NULL if not need.
- * @stop: (out): the storage for the stop value, leave #NULL if not need.
+ * @start: (out): the storage for the start value, leave %NULL if not need.
+ * @stop: (out): the storage for the stop value, leave %NULL if not need.
*
- * Get start and stop values from the @entry and write them into appropriate storages.
+ * Get @start and @stop values from the @entry and write them into appropriate
+ * storages.
*
- * Returns: TRUE if all non-NULL storage pointers were filled with appropriate values,
- * FALSE otherwise.
+ * Returns: %TRUE if all non-%NULL storage pointers were filled with appropriate
+ * values, %FALSE otherwise.
*/
gboolean
gst_toc_entry_get_start_stop_times (const GstTocEntry * entry, gint64 * start,
gint64 * stop)
{
- gboolean ret = TRUE;
-
g_return_val_if_fail (entry != NULL, FALSE);
if (start != NULL)
if (stop != NULL)
*stop = entry->stop;
- return ret;
+ return TRUE;
+}
+
+/**
+ * gst_toc_entry_set_loop:
+ * @entry: #GstTocEntry to set values.
+ * @loop_type: loop_type value to set.
+ * @repeat_count: repeat_count value to set.
+ *
+ * Set @loop_type and @repeat_count values for the @entry.
+ *
+ * Since: 1.4
+ */
+void
+gst_toc_entry_set_loop (GstTocEntry * entry, GstTocLoopType loop_type,
+ gint repeat_count)
+{
+ g_return_if_fail (entry != NULL);
+
+ entry->loop_type = loop_type;
+ entry->repeat_count = repeat_count;
}
/**
+ * gst_toc_entry_get_loop:
+ * @entry: #GstTocEntry to get values from.
+ * @loop_type: (out): the storage for the loop_type value, leave %NULL if not
+ * need.
+ * @repeat_count: (out): the storage for the repeat_count value, leave %NULL if
+ * not need.
+ *
+ * Get @loop_type and @repeat_count values from the @entry and write them into
+ * appropriate storages. Loops are e.g. used by sampled instruments. GStreamer
+ * is not automatically applying the loop. The application can process this
+ * meta data and use it e.g. to send a seek-event to loop a section.
+ *
+ * Returns: %TRUE if all non-%NULL storage pointers were filled with appropriate
+ * values, %FALSE otherwise.
+ *
+ * Since: 1.4
+ */
+gboolean
+gst_toc_entry_get_loop (const GstTocEntry * entry, GstTocLoopType * loop_type,
+ gint * repeat_count)
+{
+ g_return_val_if_fail (entry != NULL, FALSE);
+
+ if (loop_type != NULL)
+ *loop_type = entry->loop_type;
+ if (repeat_count != NULL)
+ *repeat_count = entry->repeat_count;
+
+ return TRUE;
+}
+
+
+/**
* gst_toc_entry_type_get_nick:
* @type: a #GstTocEntryType.
*
#define GST_TOC_ENTRY_TYPE_IS_ALTERNATIVE(entry_type) (entry_type < 0)
#define GST_TOC_ENTRY_TYPE_IS_SEQUENCE(entry_type) (entry_type > 0)
+/**
+ * GstTocLoopType:
+ * @GST_TOC_LOOP_NONE: single forward playback
+ * @GST_TOC_LOOP_FORWARD: repeat forward
+ * @GST_TOC_LOOP_REVERSE: repeat backward
+ * @GST_TOC_LOOP_PING_PONG: repeat forward and backward
+ *
+ * How a #GstTocEntry should be repeated. By default, entries are played a
+ * single time.
+ *
+ * Since: 1.4
+ */
+typedef enum {
+ GST_TOC_LOOP_NONE = 0,
+ GST_TOC_LOOP_FORWARD,
+ GST_TOC_LOOP_REVERSE,
+ GST_TOC_LOOP_PING_PONG
+} GstTocLoopType;
+
+/**
+ * GST_TOC_REPEAT_COUNT_INFINITE:
+ *
+ * Special value for the repeat_count set in gst_toc_entry_set_loop() or
+ * returned by gst_toc_entry_set_loop() to indicate infinite looping.
+ *
+ * Since: 1.4
+ */
+#define GST_TOC_REPEAT_COUNT_INFINITE (-1)
+
/* functions to return type structures */
GType gst_toc_get_type (void);
GType gst_toc_entry_get_type (void);
void gst_toc_entry_set_start_stop_times (GstTocEntry *entry, gint64 start, gint64 stop);
gboolean gst_toc_entry_get_start_stop_times (const GstTocEntry *entry, gint64 *start, gint64 *stop);
+void gst_toc_entry_set_loop (GstTocEntry *entry, GstTocLoopType loop_type, gint repeat_count);
+gboolean gst_toc_entry_get_loop (const GstTocEntry *entry, GstTocLoopType *loop_type, gint *repeat_count);
+
GstToc * gst_toc_entry_get_toc (GstTocEntry *entry);
GstTocEntry * gst_toc_entry_get_parent (GstTocEntry *entry);