gsttoc.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /* GStreamer
  2. * (c) 2010, 2012 Alexander Saprykin <[email protected]>
  3. *
  4. * gsttoc.h: generic TOC API declaration
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Library General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  19. * Boston, MA 02110-1301, USA.
  20. */
  21. #ifndef __GST_TOC_H__
  22. #define __GST_TOC_H__
  23. #include <gst/gstconfig.h>
  24. #include <gst/gstminiobject.h>
  25. #include <gst/gststructure.h>
  26. #include <gst/gsttaglist.h>
  27. #include <gst/gstformat.h>
  28. G_BEGIN_DECLS
  29. GST_EXPORT GType _gst_toc_type;
  30. GST_EXPORT GType _gst_toc_entry_type;
  31. #define GST_TYPE_TOC (_gst_toc_type)
  32. #define GST_TYPE_TOC_ENTRY (_gst_toc_entry_type)
  33. typedef struct _GstTocEntry GstTocEntry;
  34. typedef struct _GstToc GstToc;
  35. /**
  36. * GstTocScope:
  37. * @GST_TOC_SCOPE_GLOBAL: global TOC representing all selectable options
  38. * (this is what applications are usually interested in)
  39. * @GST_TOC_SCOPE_CURRENT: TOC for the currently active/selected stream
  40. * (this is a TOC representing the current stream from start to EOS,
  41. * and is what a TOC writer / muxer is usually interested in; it will
  42. * usually be a subset of the global TOC, e.g. just the chapters of
  43. * the current title, or the chapters selected for playback from the
  44. * current title)
  45. *
  46. * The scope of a TOC.
  47. */
  48. typedef enum {
  49. GST_TOC_SCOPE_GLOBAL = 1,
  50. GST_TOC_SCOPE_CURRENT = 2
  51. } GstTocScope;
  52. /**
  53. * GstTocEntryType:
  54. * @GST_TOC_ENTRY_TYPE_ANGLE: entry is an angle (i.e. an alternative)
  55. * @GST_TOC_ENTRY_TYPE_VERSION: entry is a version (i.e. alternative)
  56. * @GST_TOC_ENTRY_TYPE_EDITION: entry is an edition (i.e. alternative)
  57. * @GST_TOC_ENTRY_TYPE_INVALID: invalid entry type value
  58. * @GST_TOC_ENTRY_TYPE_TITLE: entry is a title (i.e. a part of a sequence)
  59. * @GST_TOC_ENTRY_TYPE_TRACK: entry is a track (i.e. a part of a sequence)
  60. * @GST_TOC_ENTRY_TYPE_CHAPTER: entry is a chapter (i.e. a part of a sequence)
  61. *
  62. * The different types of TOC entries (see #GstTocEntry).
  63. *
  64. * There are two types of TOC entries: alternatives or parts in a sequence.
  65. */
  66. typedef enum {
  67. GST_TOC_ENTRY_TYPE_ANGLE = -3,
  68. GST_TOC_ENTRY_TYPE_VERSION = -2,
  69. GST_TOC_ENTRY_TYPE_EDITION = -1,
  70. GST_TOC_ENTRY_TYPE_INVALID = 0,
  71. GST_TOC_ENTRY_TYPE_TITLE = 1,
  72. GST_TOC_ENTRY_TYPE_TRACK = 2,
  73. GST_TOC_ENTRY_TYPE_CHAPTER = 3,
  74. } GstTocEntryType;
  75. /**
  76. * GST_TOC_ENTRY_TYPE_IS_ALTERNATIVE:
  77. * @entry_type: The #GstTocEntryType from a #GstTocEntry
  78. *
  79. * Checks if @entry_type indicates that its #GstTocEntry is an alternative.
  80. */
  81. #define GST_TOC_ENTRY_TYPE_IS_ALTERNATIVE(entry_type) (entry_type < 0)
  82. /**
  83. * GST_TOC_ENTRY_TYPE_IS_SEQUENCE:
  84. * @entry_type: The #GstTocEntryType from a #GstTocEntry
  85. *
  86. * Checks if @entry_type indicates that its #GstTocEntry is a sequence.
  87. */
  88. #define GST_TOC_ENTRY_TYPE_IS_SEQUENCE(entry_type) (entry_type > 0)
  89. /**
  90. * GstTocLoopType:
  91. * @GST_TOC_LOOP_NONE: single forward playback
  92. * @GST_TOC_LOOP_FORWARD: repeat forward
  93. * @GST_TOC_LOOP_REVERSE: repeat backward
  94. * @GST_TOC_LOOP_PING_PONG: repeat forward and backward
  95. *
  96. * How a #GstTocEntry should be repeated. By default, entries are played a
  97. * single time.
  98. *
  99. * Since: 1.4
  100. */
  101. typedef enum {
  102. GST_TOC_LOOP_NONE = 0,
  103. GST_TOC_LOOP_FORWARD,
  104. GST_TOC_LOOP_REVERSE,
  105. GST_TOC_LOOP_PING_PONG
  106. } GstTocLoopType;
  107. /**
  108. * GST_TOC_REPEAT_COUNT_INFINITE:
  109. *
  110. * Special value for the repeat_count set in gst_toc_entry_set_loop() or
  111. * returned by gst_toc_entry_set_loop() to indicate infinite looping.
  112. *
  113. * Since: 1.4
  114. */
  115. #define GST_TOC_REPEAT_COUNT_INFINITE (-1)
  116. /* functions to return type structures */
  117. GType gst_toc_get_type (void);
  118. GType gst_toc_entry_get_type (void);
  119. /* functions to create, ref and unref/free TOCs */
  120. GstToc * gst_toc_new (GstTocScope scope);
  121. GstTocScope gst_toc_get_scope (const GstToc *toc);
  122. void gst_toc_set_tags (GstToc *toc, GstTagList * tags);
  123. void gst_toc_merge_tags (GstToc *toc, GstTagList *tags, GstTagMergeMode mode);
  124. GstTagList * gst_toc_get_tags (const GstToc *toc);
  125. void gst_toc_append_entry (GstToc *toc, GstTocEntry *entry);
  126. GList * gst_toc_get_entries (const GstToc *toc);
  127. void gst_toc_dump (GstToc *toc);
  128. #define gst_toc_ref(toc) (GstToc*)gst_mini_object_ref(GST_MINI_OBJECT_CAST(toc))
  129. #define gst_toc_unref(toc) gst_mini_object_unref(GST_MINI_OBJECT_CAST(toc))
  130. #define gst_toc_copy(toc) (GstToc*)gst_mini_object_copy(GST_MINI_OBJECT_CAST(toc))
  131. #define gst_toc_make_writable(toc) (GstToc*)gst_mini_object_make_writable(GST_MINI_OBJECT_CAST(toc))
  132. /* functions to create, ref and unref/free TOC entries */
  133. GstTocEntry * gst_toc_entry_new (GstTocEntryType type, const gchar *uid);
  134. #define gst_toc_entry_ref(entry) (GstTocEntry*)gst_mini_object_ref(GST_MINI_OBJECT_CAST(entry))
  135. #define gst_toc_entry_unref(entry) gst_mini_object_unref(GST_MINI_OBJECT_CAST(entry))
  136. #define gst_toc_entry_copy(entry) (GstTocEntry*)gst_mini_object_copy(GST_MINI_OBJECT_CAST(entry))
  137. #define gst_toc_entry_make_writable(entry) (GstTocEntry*)gst_mini_object_make_writable(GST_MINI_OBJECT_CAST(entry))
  138. GstTocEntry * gst_toc_find_entry (const GstToc *toc, const gchar *uid);
  139. GstTocEntryType gst_toc_entry_get_entry_type (const GstTocEntry *entry);
  140. const gchar * gst_toc_entry_get_uid (const GstTocEntry *entry);
  141. void gst_toc_entry_append_sub_entry (GstTocEntry *entry, GstTocEntry *subentry);
  142. GList * gst_toc_entry_get_sub_entries (const GstTocEntry *entry);
  143. void gst_toc_entry_set_tags (GstTocEntry *entry, GstTagList *tags);
  144. void gst_toc_entry_merge_tags (GstTocEntry *entry, GstTagList *tags, GstTagMergeMode mode);
  145. GstTagList * gst_toc_entry_get_tags (const GstTocEntry *entry);
  146. gboolean gst_toc_entry_is_alternative (const GstTocEntry *entry);
  147. gboolean gst_toc_entry_is_sequence (const GstTocEntry *entry);
  148. void gst_toc_entry_set_start_stop_times (GstTocEntry *entry, gint64 start, gint64 stop);
  149. gboolean gst_toc_entry_get_start_stop_times (const GstTocEntry *entry, gint64 *start, gint64 *stop);
  150. void gst_toc_entry_set_loop (GstTocEntry *entry, GstTocLoopType loop_type, gint repeat_count);
  151. gboolean gst_toc_entry_get_loop (const GstTocEntry *entry, GstTocLoopType *loop_type, gint *repeat_count);
  152. GstToc * gst_toc_entry_get_toc (GstTocEntry *entry);
  153. GstTocEntry * gst_toc_entry_get_parent (GstTocEntry *entry);
  154. const gchar * gst_toc_entry_type_get_nick (GstTocEntryType type);
  155. G_END_DECLS
  156. #endif /* __GST_TOC_H__ */