![]() |
![]() |
![]() |
GStreamer 1.0 Core Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <gst/gst.h> GstToc; enum GstTocScope; GstTocEntry; enum GstTocEntryType; GstToc * gst_toc_new (GstTocScope scope
); #define gst_toc_ref (toc) #define gst_toc_unref (toc) #define gst_toc_copy (toc) #define gst_toc_make_writable (toc) GstTocScope gst_toc_get_scope (const GstToc *toc
); GList * gst_toc_get_entries (const GstToc *toc
); void gst_toc_append_entry (GstToc *toc
,GstTocEntry *entry
); GstTagList * gst_toc_get_tags (const GstToc *toc
); void gst_toc_merge_tags (GstToc *toc
,GstTagList *tags
,GstTagMergeMode mode
); void gst_toc_set_tags (GstToc *toc
,GstTagList *tags
); void gst_toc_dump (GstToc *toc
); GstTocEntry * gst_toc_entry_new (GstTocEntryType type
,const gchar *uid
); #define gst_toc_entry_ref (entry) #define gst_toc_entry_unref (entry) #define gst_toc_entry_copy (entry) #define gst_toc_entry_make_writable (entry) GstTocEntry * gst_toc_find_entry (const GstToc *toc
,const gchar *uid
); GstToc * gst_toc_entry_get_toc (GstTocEntry *entry
); const gchar * gst_toc_entry_get_uid (const GstTocEntry *entry
); GstTocEntry * gst_toc_entry_get_parent (GstTocEntry *entry
); GList * gst_toc_entry_get_sub_entries (const GstTocEntry *entry
); void gst_toc_entry_append_sub_entry (GstTocEntry *entry
,GstTocEntry *subentry
); gboolean gst_toc_entry_get_start_stop_times (const GstTocEntry *entry
,gint64 *start
,gint64 *stop
); void gst_toc_entry_set_start_stop_times (GstTocEntry *entry
,gint64 start
,gint64 stop
); GstTagList * gst_toc_entry_get_tags (const GstTocEntry *entry
); void gst_toc_entry_merge_tags (GstTocEntry *entry
,GstTagList *tags
,GstTagMergeMode mode
); void gst_toc_entry_set_tags (GstTocEntry *entry
,GstTagList *tags
); const gchar * gst_toc_entry_type_get_nick (GstTocEntryType type
); GstTocEntryType gst_toc_entry_get_entry_type (const GstTocEntry *entry
); gboolean gst_toc_entry_is_alternative (const GstTocEntry *entry
); gboolean gst_toc_entry_is_sequence (const GstTocEntry *entry
); #define GST_TOC_ENTRY_TYPE_IS_ALTERNATIVE (entry_type) #define GST_TOC_ENTRY_TYPE_IS_SEQUENCE (entry_type)
GstToc functions are used to create/free GstToc and GstTocEntry structures. Also they are used to convert GstToc into GstStructure and vice versa.
GstToc lets you to inform other elements in pipeline or application that playing source has some kind of table of contents (TOC). These may be chapters, editions, angles or other types. For example: DVD chapters, Matroska chapters or cue sheet TOC. Such TOC will be useful for applications to display instead of just a playlist.
Using TOC is very easy. Firstly, create GstToc structure which represents root contents of the source. You can also attach TOC-specific tags to it. Then fill it with GstTocEntry entries by appending them to GstToc.entries GstTocEntry.subentries lists. You should use GST_TOC_ENTRY_TYPE_CHAPTER for generic TOC entry and GST_TOC_ENTRY_TYPE_EDITION for the entries which are considered to be alternatives (like DVD angles, Matroska editions and so on).
Note that root level of the TOC can contain only either editions or chapters. You should not mix them together at the same level. Otherwise you will get serialization /deserialization errors. Make sure that no one of the entries has negative start and stop values.
Please, use GstToc.info and GstTocEntry.info fields in that way: create a GstStructure, put all info related to your element there and put this structure into the info field under the name of your element. Some fields in the info structure can be used for internal purposes, so you should use it in the way described above to not to overwrite already existent fields.
Use gst_event_new_toc()
to create a new TOC GstEvent, and gst_event_parse_toc()
to
parse received TOC event. Use gst_event_new_toc_select()
to create a new TOC select GstEvent,
and gst_event_parse_toc_select()
to parse received TOC select event. The same rule for
the GstMessage: gst_message_new_toc()
to create new TOC GstMessage, and
gst_message_parse_toc()
to parse received TOC message. Also you can create a new TOC query
with gst_query_new_toc()
, set it with gst_query_set_toc()
and parse it with
gst_query_parse_toc()
.
typedef enum { GST_TOC_SCOPE_GLOBAL = 1, GST_TOC_SCOPE_CURRENT = 2 } GstTocScope;
The scope of a TOC.
global TOC representing all selectable options (this is what applications are usually interested in) | |
TOC for the currently active/selected stream (this is a TOC representing the current stream from start to EOS, and is what a TOC writer / muxer is usually interested in; it will usually be a subset of the global TOC, e.g. just the chapters of the current title, or the chapters selected for playback from the current title) |
typedef enum { 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;
The different types of TOC entries (see GstTocEntry).
There are two types of TOC entries: alternatives or parts in a sequence.
entry is an angle (i.e. an alternative) | |
entry is a version (i.e. alternative) | |
entry is an edition (i.e. alternative) | |
invalid entry type value | |
entry is a title (i.e. a part of a sequence) | |
entry is a track (i.e. a part of a sequence) | |
entry is a chapter (i.e. a part of a sequence) |
GstToc * gst_toc_new (GstTocScope scope
);
Create a new GstToc structure.
|
scope of this TOC |
Returns : |
newly allocated GstToc structure, free it
with gst_toc_unref() . [transfer full]
|
#define gst_toc_copy(toc) (GstToc*)gst_mini_object_copy(GST_MINI_OBJECT_CAST(toc))
Copy GstToc with all subentries (deep copy).
#define gst_toc_make_writable(toc) (GstToc*)gst_mini_object_make_writable(GST_MINI_OBJECT_CAST(toc))
GstTocScope gst_toc_get_scope (const GstToc *toc
);
|
a GstToc instance |
Returns : |
scope of toc
|
GList * gst_toc_get_entries (const GstToc *toc
);
Gets the list of GstTocEntry of toc
.
|
A GstToc instance |
Returns : |
A GList of GstTocEntry for entry . [transfer none][element-type Gst.TocEntry]
|
void gst_toc_append_entry (GstToc *toc
,GstTocEntry *entry
);
Appends the GstTocEntry entry
to toc
.
|
A GstToc instance |
|
A GstTocEntry. [transfer full] |
GstTagList * gst_toc_get_tags (const GstToc *toc
);
Gets the tags for toc
.
|
A GstToc instance |
Returns : |
A GstTagList for entry . [transfer none]
|
void gst_toc_merge_tags (GstToc *toc
,GstTagList *tags
,GstTagMergeMode mode
);
Merge tags
into the existing tags of toc
using mode
.
|
A GstToc instance |
|
A GstTagList or NULL . [allow-none]
|
|
A GstTagMergeMode |
void gst_toc_set_tags (GstToc *toc
,GstTagList *tags
);
Set a GstTagList with tags for the complete toc
.
|
A GstToc instance |
|
A GstTagList or NULL . [allow-none][transfer full]
|
GstTocEntry * gst_toc_entry_new (GstTocEntryType type
,const gchar *uid
);
Create new GstTocEntry structure.
|
entry type. |
|
unique ID (UID) in the whole TOC. |
Returns : |
newly allocated GstTocEntry structure, free it with gst_toc_entry_unref() . |
#define gst_toc_entry_ref(entry) (GstTocEntry*)gst_mini_object_ref(GST_MINI_OBJECT_CAST(entry))
#define gst_toc_entry_unref(entry) gst_mini_object_unref(GST_MINI_OBJECT_CAST(entry))
#define gst_toc_entry_copy(entry) (GstTocEntry*)gst_mini_object_copy(GST_MINI_OBJECT_CAST(entry))
Copy GstTocEntry with all subentries (deep copy).
|
GstTocEntry to copy. |
Returns : |
newly allocated GstTocEntry in case of success, NULL otherwise;
free it when done with gst_toc_entry_unref() . |
#define gst_toc_entry_make_writable(entry) (GstTocEntry*)gst_mini_object_make_writable(GST_MINI_OBJECT_CAST(entry))
GstTocEntry * gst_toc_find_entry (const GstToc *toc
,const gchar *uid
);
Find GstTocEntry with given uid
in the toc
.
|
GstToc to search in. |
|
UID to find GstTocEntry with. |
Returns : |
GstTocEntry with specified uid from the toc , or NULL if not found. [transfer none]
|
GstToc * gst_toc_entry_get_toc (GstTocEntry *entry
);
Gets the parent GstToc of entry
.
|
A GstTocEntry instance |
Returns : |
The parent GstToc of entry . [transfer none]
|
const gchar * gst_toc_entry_get_uid (const GstTocEntry *entry
);
Gets the sub-entries of entry
.
|
A GstTocEntry instance |
Returns : |
A GList of GstTocEntry of entry . [transfer none][element-type Gst.TocEntry]
|
GstTocEntry * gst_toc_entry_get_parent (GstTocEntry *entry
);
Gets the parent GstTocEntry of entry
.
|
A GstTocEntry instance |
Returns : |
The parent GstTocEntry of entry . [transfer none]
|
void gst_toc_entry_append_sub_entry (GstTocEntry *entry
,GstTocEntry *subentry
);
Appends the GstTocEntry subentry
to entry
.
|
A GstTocEntry instance |
|
A GstTocEntry. [transfer full] |
gboolean gst_toc_entry_get_start_stop_times (const GstTocEntry *entry
,gint64 *start
,gint64 *stop
);
Get start and stop values from the entry
and write them into appropriate storages.
|
GstTocEntry to get values from. |
|
the storage for the start value, leave NULL if not need. [out] |
|
the storage for the stop value, leave NULL if not need. [out] |
Returns : |
TRUE if all non-NULL storage pointers were filled with appropriate values, FALSE otherwise. |
void gst_toc_entry_set_start_stop_times (GstTocEntry *entry
,gint64 start
,gint64 stop
);
Set start
and stop
values for the entry
.
|
GstTocEntry to set values. |
|
start value to set. |
|
stop value to set. |
GstTagList * gst_toc_entry_get_tags (const GstTocEntry *entry
);
Gets the tags for entry
.
|
A GstTocEntry instance |
Returns : |
A GstTagList for entry . [transfer none]
|
void gst_toc_entry_merge_tags (GstTocEntry *entry
,GstTagList *tags
,GstTagMergeMode mode
);
Merge tags
into the existing tags of entry
using mode
.
|
A GstTocEntry instance |
|
A GstTagList or NULL . [allow-none]
|
|
A GstTagMergeMode |
void gst_toc_entry_set_tags (GstTocEntry *entry
,GstTagList *tags
);
Set a GstTagList with tags for the complete entry
.
|
A GstTocEntry instance |
|
A GstTagList or NULL . [allow-none][transfer full]
|
const gchar * gst_toc_entry_type_get_nick (GstTocEntryType type
);
Converts type
to a string representation.
|
a GstTocEntryType. |
Returns : |
Returns a human-readable string for type . This string is
only for debugging purpose and should not be displayed in a user
interface. |
GstTocEntryType gst_toc_entry_get_entry_type (const GstTocEntry *entry
);
|
a GstTocEntry |
Returns : |
entry 's entry type |
gboolean gst_toc_entry_is_alternative (const GstTocEntry *entry
);
|
a GstTocEntry |
Returns : |
TRUE if entry 's type is an alternative type, otherwise FALSE
|
gboolean gst_toc_entry_is_sequence (const GstTocEntry *entry
);
|
a GstTocEntry |
Returns : |
TRUE if entry 's type is a sequence type, otherwise FALSE
|
#define GST_TOC_ENTRY_TYPE_IS_ALTERNATIVE(entry_type) (entry_type < 0)