From 71d1af2b66e887916aa32cde5ea74e4e0c0df5b4 Mon Sep 17 00:00:00 2001 From: Anton Belka Date: Tue, 15 May 2012 14:48:35 +0300 Subject: [PATCH] toc: API: Add gst_toc_entry_type_to_string() --- docs/gst/gstreamer-sections.txt | 1 + gst/gsttoc.c | 19 +++++++++++++++++++ gst/gsttoc.h | 1 + win32/common/libgstreamer.def | 1 + 4 files changed, 22 insertions(+) diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 8e7ebfbadd..d9cb95fe0e 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -2702,6 +2702,7 @@ gst_toc_copy gst_toc_find_entry gst_toc_entry_get_start_stop gst_toc_entry_set_start_stop +gst_toc_entry_type_to_string GST_TYPE_TOC_ENTRY_TYPE diff --git a/gst/gsttoc.c b/gst/gsttoc.c index 0ea0f33f0a..b5c092f9e0 100644 --- a/gst/gsttoc.c +++ b/gst/gsttoc.c @@ -977,6 +977,25 @@ gst_toc_entry_get_start_stop (const GstTocEntry * entry, gint64 * start, return ret; } +/** + * gst_toc_entry_type_to_string: + * @type: a #GstTocEntryType. + * + * Converts @type to a string representation. + * + * Returns: Returns the human-readable @type. Can be NULL if an error occurred. + * Since: 0.11.92 + */ +const gchar * +gst_toc_entry_type_to_string (GstTocEntryType type) +{ + const gchar *entry_types[] = { "chapter", "edition" }; + + g_return_val_if_fail ((gint) type >= 0 + && (gint) type < G_N_ELEMENTS (entry_types), NULL); + return entry_types[type]; +} + gboolean __gst_toc_structure_get_updated (const GstStructure * toc) { diff --git a/gst/gsttoc.h b/gst/gsttoc.h index a1a7b8cf2f..60bb28a4a4 100644 --- a/gst/gsttoc.h +++ b/gst/gsttoc.h @@ -105,6 +105,7 @@ GstToc * gst_toc_copy (const GstToc *toc); void gst_toc_entry_set_start_stop (GstTocEntry *entry, gint64 start, gint64 stop); gboolean gst_toc_entry_get_start_stop (const GstTocEntry *entry, gint64 *start, gint64 *stop); +const gchar * gst_toc_entry_type_to_string (GstTocEntryType type); G_END_DECLS diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def index 3823726707..7a3824975c 100644 --- a/win32/common/libgstreamer.def +++ b/win32/common/libgstreamer.def @@ -1128,6 +1128,7 @@ EXPORTS gst_toc_entry_new_with_pad gst_toc_entry_set_start_stop gst_toc_entry_type_get_type + gst_toc_entry_type_to_string gst_toc_find_entry gst_toc_free gst_toc_new