1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD 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 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gstreamer.Toc; 26 27 private import glib.ConstructionException; 28 private import glib.ListG; 29 private import glib.Str; 30 private import gobject.ObjectG; 31 private import gstreamer.TagList; 32 private import gstreamer.TocEntry; 33 private import gstreamerc.gstreamer; 34 public import gstreamerc.gstreamertypes; 35 36 37 /** 38 * #GstToc functions are used to create/free #GstToc and #GstTocEntry structures. 39 * Also they are used to convert #GstToc into #GstStructure and vice versa. 40 * 41 * #GstToc lets you to inform other elements in pipeline or application that playing 42 * source has some kind of table of contents (TOC). These may be chapters, editions, 43 * angles or other types. For example: DVD chapters, Matroska chapters or cue sheet 44 * TOC. Such TOC will be useful for applications to display instead of just a 45 * playlist. 46 * 47 * Using TOC is very easy. Firstly, create #GstToc structure which represents root 48 * contents of the source. You can also attach TOC-specific tags to it. Then fill 49 * it with #GstTocEntry entries by appending them to the #GstToc using 50 * gst_toc_append_entry(), and appending subentries to a #GstTocEntry using 51 * gst_toc_entry_append_sub_entry(). 52 * 53 * Note that root level of the TOC can contain only either editions or chapters. You 54 * should not mix them together at the same level. Otherwise you will get serialization 55 * /deserialization errors. Make sure that no one of the entries has negative start and 56 * stop values. 57 * 58 * Use gst_event_new_toc() to create a new TOC #GstEvent, and gst_event_parse_toc() to 59 * parse received TOC event. Use gst_event_new_toc_select() to create a new TOC select #GstEvent, 60 * and gst_event_parse_toc_select() to parse received TOC select event. The same rule for 61 * the #GstMessage: gst_message_new_toc() to create new TOC #GstMessage, and 62 * gst_message_parse_toc() to parse received TOC message. 63 * 64 * TOCs can have global scope or current scope. Global scope TOCs contain 65 * all entries that can possibly be selected using a toc select event, and 66 * are what an application is usually interested in. TOCs with current scope 67 * only contain the parts of the TOC relevant to the currently selected/playing 68 * stream; the current scope TOC is used by downstream elements such as muxers 69 * to write correct TOC entries when transcoding files, for example. When 70 * playing a DVD, the global TOC would contain a hierarchy of all titles, 71 * chapters and angles, for example, while the current TOC would only contain 72 * the chapters for the currently playing title if playback of a specific 73 * title was requested. 74 * 75 * Applications and plugins should not rely on TOCs having a certain kind of 76 * structure, but should allow for different alternatives. For example, a 77 * simple CUE sheet embedded in a file may be presented as a flat list of 78 * track entries, or could have a top-level edition node (or some other 79 * alternative type entry) with track entries underneath that node; or even 80 * multiple top-level edition nodes (or some other alternative type entries) 81 * each with track entries underneath, in case the source file has extracted 82 * a track listing from different sources). 83 */ 84 public class Toc 85 { 86 /** the main Gtk struct */ 87 protected GstToc* gstToc; 88 protected bool ownedRef; 89 90 /** Get the main Gtk struct */ 91 public GstToc* getTocStruct() 92 { 93 return gstToc; 94 } 95 96 /** the main Gtk struct as a void* */ 97 protected void* getStruct() 98 { 99 return cast(void*)gstToc; 100 } 101 102 /** 103 * Sets our main struct and passes it to the parent class. 104 */ 105 public this (GstToc* gstToc, bool ownedRef = false) 106 { 107 this.gstToc = gstToc; 108 this.ownedRef = ownedRef; 109 } 110 111 112 /** */ 113 public static GType getType() 114 { 115 return gst_toc_get_type(); 116 } 117 118 /** 119 * Create a new #GstToc structure. 120 * 121 * Params: 122 * scop = scope of this TOC 123 * 124 * Return: newly allocated #GstToc structure, free it 125 * with gst_toc_unref(). 126 * 127 * Throws: ConstructionException GTK+ fails to create the object. 128 */ 129 public this(GstTocScope scop) 130 { 131 auto p = gst_toc_new(scop); 132 133 if(p is null) 134 { 135 throw new ConstructionException("null returned by new"); 136 } 137 138 this(cast(GstToc*) p); 139 } 140 141 /** 142 * Appends the #GstTocEntry @entry to @toc. 143 * 144 * Params: 145 * entry = A #GstTocEntry 146 */ 147 public void appendEntry(TocEntry entry) 148 { 149 gst_toc_append_entry(gstToc, (entry is null) ? null : entry.getTocEntryStruct()); 150 } 151 152 /** */ 153 public void dump() 154 { 155 gst_toc_dump(gstToc); 156 } 157 158 /** 159 * Find #GstTocEntry with given @uid in the @toc. 160 * 161 * Params: 162 * uid = UID to find #GstTocEntry with. 163 * 164 * Return: #GstTocEntry with specified 165 * @uid from the @toc, or %NULL if not found. 166 */ 167 public TocEntry findEntry(string uid) 168 { 169 auto p = gst_toc_find_entry(gstToc, Str.toStringz(uid)); 170 171 if(p is null) 172 { 173 return null; 174 } 175 176 return ObjectG.getDObject!(TocEntry)(cast(GstTocEntry*) p); 177 } 178 179 /** 180 * Gets the list of #GstTocEntry of @toc. 181 * 182 * Return: A #GList of #GstTocEntry for @entry 183 */ 184 public ListG getEntries() 185 { 186 auto p = gst_toc_get_entries(gstToc); 187 188 if(p is null) 189 { 190 return null; 191 } 192 193 return new ListG(cast(GList*) p); 194 } 195 196 /** 197 * Return: scope of @toc 198 */ 199 public GstTocScope getScope() 200 { 201 return gst_toc_get_scope(gstToc); 202 } 203 204 /** 205 * Gets the tags for @toc. 206 * 207 * Return: A #GstTagList for @entry 208 */ 209 public TagList getTags() 210 { 211 auto p = gst_toc_get_tags(gstToc); 212 213 if(p is null) 214 { 215 return null; 216 } 217 218 return ObjectG.getDObject!(TagList)(cast(GstTagList*) p); 219 } 220 221 /** 222 * Merge @tags into the existing tags of @toc using @mode. 223 * 224 * Params: 225 * tags = A #GstTagList or %NULL 226 * mode = A #GstTagMergeMode 227 */ 228 public void mergeTags(TagList tags, GstTagMergeMode mode) 229 { 230 gst_toc_merge_tags(gstToc, (tags is null) ? null : tags.getTagListStruct(), mode); 231 } 232 233 /** 234 * Set a #GstTagList with tags for the complete @toc. 235 * 236 * Params: 237 * tags = A #GstTagList or %NULL 238 */ 239 public void setTags(TagList tags) 240 { 241 gst_toc_set_tags(gstToc, (tags is null) ? null : tags.getTagListStruct()); 242 } 243 }