mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
toc: add more entry types
Make entry types less abstract. https://bugzilla.gnome.org/show_bug.cgi?id=678742
This commit is contained in:
parent
f79d398c61
commit
e11f38b98b
4 changed files with 96 additions and 12 deletions
|
@ -2726,6 +2726,11 @@ gst_toc_find_entry
|
|||
gst_toc_entry_get_start_stop
|
||||
gst_toc_entry_set_start_stop
|
||||
gst_toc_entry_type_get_nick
|
||||
gst_toc_entry_get_entry_type
|
||||
gst_toc_entry_is_alternative
|
||||
gst_toc_entry_is_sequence
|
||||
GST_TOC_ENTRY_TYPE_IS_ALTERNATIVE
|
||||
GST_TOC_ENTRY_TYPE_IS_SEQUENCE
|
||||
<SUBSECTION Standard>
|
||||
GST_TYPE_TOC
|
||||
GST_TYPE_TOC_ENTRY
|
||||
|
|
70
gst/gsttoc.c
70
gst/gsttoc.c
|
@ -880,18 +880,74 @@ gst_toc_entry_get_start_stop (const GstTocEntry * entry, gint64 * start,
|
|||
*
|
||||
* Converts @type to a string representation.
|
||||
*
|
||||
* Returns: Returns the human-readable @type. Can be NULL if an error occurred.
|
||||
* Since: 0.11.92
|
||||
* Returns: Returns a human-readable string for @type. This string is
|
||||
* only for debugging purpose and should not be displayed in a user
|
||||
* interface.
|
||||
*/
|
||||
const gchar *
|
||||
gst_toc_entry_type_get_nick (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];
|
||||
switch (type) {
|
||||
case GST_TOC_ENTRY_TYPE_ANGLE:
|
||||
return "angle";
|
||||
case GST_TOC_ENTRY_TYPE_VERSION:
|
||||
return "version";
|
||||
case GST_TOC_ENTRY_TYPE_EDITION:
|
||||
return "edition";
|
||||
case GST_TOC_ENTRY_TYPE_TITLE:
|
||||
return "title";
|
||||
case GST_TOC_ENTRY_TYPE_TRACK:
|
||||
return "track";
|
||||
case GST_TOC_ENTRY_TYPE_CHAPTER:
|
||||
return "chapter";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "invalid";
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_toc_entry_get_entry_type:
|
||||
* @entry: a #GstTocEntry
|
||||
*
|
||||
* Returns: @entry's entry type
|
||||
*/
|
||||
GstTocEntryType
|
||||
gst_toc_entry_get_entry_type (GstTocEntry * entry)
|
||||
{
|
||||
g_return_val_if_fail (entry != NULL, GST_TOC_ENTRY_TYPE_INVALID);
|
||||
|
||||
return entry->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_toc_entry_is_alternative:
|
||||
* @entry: a #GstTocEntry
|
||||
*
|
||||
* Returns: %TRUE if @entry's type is an alternative type, otherwise %FALSE
|
||||
*/
|
||||
gboolean
|
||||
gst_toc_entry_is_alternative (GstTocEntry * entry)
|
||||
{
|
||||
g_return_val_if_fail (entry != NULL, FALSE);
|
||||
|
||||
return GST_TOC_ENTRY_TYPE_IS_ALTERNATIVE (entry->type);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_toc_entry_is_sequence:
|
||||
* @entry: a #GstTocEntry
|
||||
*
|
||||
* Returns: %TRUE if @entry's type is a sequence type, otherwise %FALSE
|
||||
*/
|
||||
gboolean
|
||||
gst_toc_entry_is_sequence (GstTocEntry * entry)
|
||||
{
|
||||
g_return_val_if_fail (entry != NULL, FALSE);
|
||||
|
||||
return GST_TOC_ENTRY_TYPE_IS_SEQUENCE (entry->type);
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
__gst_toc_structure_get_updated (const GstStructure * toc)
|
||||
|
|
30
gst/gsttoc.h
30
gst/gsttoc.h
|
@ -38,16 +38,31 @@ typedef struct _GstToc GstToc;
|
|||
|
||||
/**
|
||||
* GstTocEntryType:
|
||||
* @GST_TOC_ENTRY_TYPE_CHAPTER: a chapter type entry.
|
||||
* @GST_TOC_ENTRY_TYPE_EDITION: an edition entry (angle or alternative in other terms).
|
||||
* @GST_TOC_ENTRY_TYPE_ANGLE: entry is an angle (i.e. an alternative)
|
||||
* @GST_TOC_ENTRY_TYPE_VERSION: entry is a version (i.e. alternative)
|
||||
* @GST_TOC_ENTRY_TYPE_EDITION: entry is an edition (i.e. alternative)
|
||||
* @GST_TOC_ENTRY_TYPE_INVALID: invalid entry type value
|
||||
* @GST_TOC_ENTRY_TYPE_TITLE: entry is a title (i.e. a part of a sequence)
|
||||
* @GST_TOC_ENTRY_TYPE_TRACK: entry is a track (i.e. a part of a sequence)
|
||||
* @GST_TOC_ENTRY_TYPE_CHAPTER: entry is a chapter (i.e. a part of a sequence)
|
||||
*
|
||||
* The different types of TOC entry.
|
||||
* The different types of TOC entries (see #GstTocEntry).
|
||||
*
|
||||
* There are two types of TOC entries: alternatives or parts in a sequence.
|
||||
*/
|
||||
typedef enum {
|
||||
GST_TOC_ENTRY_TYPE_CHAPTER = 0,
|
||||
GST_TOC_ENTRY_TYPE_EDITION = 1
|
||||
GST_TOC_ENTRY_TYPE_ANGLE = -3,
|
||||
GST_TOC_ENTRY_TYPE_VERSION = -2,
|
||||
GST_TOC_ENTRY_TYPE_EDITION = -1,
|
||||
GST_TOC_ENTRY_TYPE_INVALID = 0,
|
||||
GST_TOC_ENTRY_TYPE_TITLE = 1,
|
||||
GST_TOC_ENTRY_TYPE_TRACK = 2,
|
||||
GST_TOC_ENTRY_TYPE_CHAPTER = 3,
|
||||
} 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)
|
||||
|
||||
/**
|
||||
* GstTocEntry:
|
||||
* @uid: unique (for a whole TOC) id of the entry. This value should be persistent and
|
||||
|
@ -124,6 +139,11 @@ GstTocEntry * gst_toc_entry_new_with_pad (GstTocEntryType type, const gch
|
|||
|
||||
GstTocEntry * gst_toc_find_entry (const GstToc *toc, const gchar *uid);
|
||||
|
||||
GstTocEntryType gst_toc_entry_get_entry_type (GstTocEntry * entry);
|
||||
|
||||
gboolean gst_toc_entry_is_alternative (GstTocEntry * entry);
|
||||
gboolean gst_toc_entry_is_sequence (GstTocEntry * entry);
|
||||
|
||||
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_get_nick (GstTocEntryType type);
|
||||
|
|
|
@ -1128,8 +1128,11 @@ EXPORTS
|
|||
gst_task_start
|
||||
gst_task_state_get_type
|
||||
gst_task_stop
|
||||
gst_toc_entry_get_entry_type
|
||||
gst_toc_entry_get_start_stop
|
||||
gst_toc_entry_get_type
|
||||
gst_toc_entry_is_alternative
|
||||
gst_toc_entry_is_sequence
|
||||
gst_toc_entry_new
|
||||
gst_toc_entry_new_with_pad
|
||||
gst_toc_entry_set_start_stop
|
||||
|
|
Loading…
Reference in a new issue