Debian Codegraph @

gstreamer/src/toc.hg

raw
1 /* gstreamermm - a C++ wrapper for gstreamer
2 *
3 * Copyright 2008-2016 The gstreamermm Development Team
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include <gst/gst.h>
21 #include <gstreamermm/miniobject.h>
22 #include <gstreamermm/taglist.h>
23
24 _DEFS(gstreamermm,gst)
25
26 namespace Gst
27 {
28 class TocEntry;
29
30 _WRAP_ENUM(TocScope, GstTocScope)
31 _WRAP_ENUM(TocEntryType, GstTocEntryType)
32 _WRAP_ENUM(TocLoopType, GstTocLoopType)
33
34 /** Gst::Toc lets you to inform other elements in pipeline or application that playing
35 * source has some kind of table of contents (TOC). These may be chapters, editions,
36 * angles or other types. For example: DVD chapters, Matroska chapters or cue sheet
37 * TOC. Such TOC will be useful for applications to display instead of just a
38 * playlist.
39 *
40 * Using TOC is very easy. Firstly, create Gst::Toc structure which represents root
41 * contents of the source. You can also attach TOC-specific tags to it. Then fill
42 * it with Gst::TocEntry entries by appending them to the Gst::Toc using
43 * append_entry(), and appending subentries to a Gst::TocEntry using
44 * append_sub_entry().
45 *
46 * Note that root level of the TOC can contain only either editions or chapters. You
47 * should not mix them together at the same level. Otherwise you will get serialization
48 * /deserialization errors. Make sure that no one of the entries has negative start and
49 * stop values.
50 *
51 * Use Gst::EventToc class to create TOC event, and parse_toc() to
52 * parse received TOC event. Use Gst::EventTocSelect to create a new TOC select event,
53 * and parse_toc_select() to parse received TOC select event. The same rule for
54 * the messages: MessageToc to create new TOC message, and
55 * parse() to parse received TOC message.
56 *
57 * TOCs can have global scope or current scope. Global scope TOCs contain
58 * all entries that can possibly be selected using a toc select event, and
59 * are what an application is usually interested in. TOCs with current scope
60 * only contain the parts of the TOC relevant to the currently selected/playing
61 * stream; the current scope TOC is used by downstream elements such as muxers
62 * to write correct TOC entries when transcoding files, for example. When
63 * playing a DVD, the global TOC would contain a hierarchy of all titles,
64 * chapters and angles, for example, while the current TOC would only contain
65 * the chapters for the currently playing title if playback of a specific
66 * title was requested.
67 *
68 * Applications and plugins should not rely on TOCs having a certain kind of
69 * structure, but should allow for different alternatives. For example, a
70 * simple CUE sheet embedded in a file may be presented as a flat list of
71 * track entries, or could have a top-level edition node (or some other
72 * alternative type entry) with track entries underneath that node; or even
73 * multiple top-level edition nodes (or some other alternative type entries)
74 * each with track entries underneath, in case the source file has extracted
75 * a track listing from different sources).
76 */
77 class Toc : public MiniObject
78 {
79 _CLASS_OPAQUE_REFCOUNTED(Toc, GstToc, NONE, gst_toc_ref, gst_toc_unref)
80 public:
81 _WRAP_METHOD(void append_entry(Glib::RefPtr<Gst::TocEntry> entry), gst_toc_append_entry)
82 _WRAP_METHOD(void dump(), gst_toc_dump)
83 _WRAP_METHOD(void dump() const, gst_toc_dump, constversion)
84
85 _WRAP_METHOD(void set_tags(const Gst::TagList& tags), gst_toc_set_tags)
86 #m4 _CONVERSION(`GstTagList*',`Gst::TagList',`Glib::wrap_taglist(const_cast<GstTagList*>($3), true)')
87 _WRAP_METHOD(Gst::TagList get_tags() const, gst_toc_get_tags)
88
89 _WRAP_METHOD(Gst::TocScope get_scope() const, gst_toc_get_scope)
90 _WRAP_METHOD(Glib::RefPtr<Gst::TocEntry> find_entry(const Glib::ustring& uid) const, gst_toc_find_entry)
91 };
92
93 class TocEntry : public MiniObject
94 {
95 _CLASS_OPAQUE_REFCOUNTED(TocEntry, GstTocEntry, NONE, gst_toc_entry_ref, gst_toc_entry_unref)
96 public:
97 _WRAP_METHOD(TocEntryType get_entry_type(), gst_toc_entry_get_entry_type)
98 _WRAP_METHOD(Glib::ustring get_uid(), gst_toc_entry_get_uid)
99 _WRAP_METHOD(void append_sub_entry(Glib::RefPtr<Gst::TocEntry> entry), gst_toc_entry_append_sub_entry)
100
101 _WRAP_METHOD(bool is_alternative(), gst_toc_entry_is_alternative)
102 _WRAP_METHOD(bool is_alternative() const, gst_toc_entry_is_alternative, constversion)
103
104 _WRAP_METHOD(bool is_sequence(), gst_toc_entry_is_sequence)
105 _WRAP_METHOD(bool is_sequence() const, gst_toc_entry_is_sequence, constversion)
106
107 _WRAP_METHOD(Glib::RefPtr<Gst::TocEntry> get_parent(), gst_toc_entry_get_parent)
108 _WRAP_METHOD(void set_start_stop_times(gint64 start, gint64 stop), gst_toc_entry_set_start_stop_times)
109
110 _WRAP_METHOD(bool get_start_stop_times(gint64& start, gint64& stop), gst_toc_entry_get_start_stop_times)
111 _WRAP_METHOD(bool get_start_stop_times(gint64& start, gint64& stop) const, gst_toc_entry_get_start_stop_times, constversion)
112
113 _WRAP_METHOD(bool get_loop(Gst::TocLoopType& loop_type, gint& repeat_count) const, gst_toc_entry_get_loop)
114 _WRAP_METHOD(void set_loop(Gst::TocLoopType loop_type, gint repeat_count), gst_toc_entry_set_loop)
115
116 _WRAP_METHOD(Glib::RefPtr<Gst::Toc> get_toc() const, gst_toc_entry_get_toc)
117 };
118
119
120 }