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 * Conversion parameters: 26 * inFile = gstreamer-GstToc.html 27 * outPack = gstreamer 28 * outFile = Toc 29 * strct = GstToc 30 * realStrct= 31 * ctorStrct= 32 * clss = Toc 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gst_toc_ 41 * omit structs: 42 * omit prefixes: 43 * - gst_toc_entry_ 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - glib.ListG 49 * - gstreamer.TagList 50 * - gstreamer.TocEntry 51 * structWrap: 52 * - GList* -> ListG 53 * - GstTagList* -> TagList 54 * - GstTocEntry* -> TocEntry 55 * module aliases: 56 * local aliases: 57 * overrides: 58 */ 59 60 module gstreamer.Toc; 61 62 public import gstreamerc.gstreamertypes; 63 64 private import gstreamerc.gstreamer; 65 private import glib.ConstructionException; 66 private import gobject.ObjectG; 67 68 private import glib.Str; 69 private import glib.ListG; 70 private import gstreamer.TagList; 71 private import gstreamer.TocEntry; 72 73 74 75 /** 76 * GstToc functions are used to create/free GstToc and GstTocEntry structures. 77 * Also they are used to convert GstToc into GstStructure and vice versa. 78 * 79 * GstToc lets you to inform other elements in pipeline or application that playing 80 * source has some kind of table of contents (TOC). These may be chapters, editions, 81 * angles or other types. For example: DVD chapters, Matroska chapters or cue sheet 82 * TOC. Such TOC will be useful for applications to display instead of just a 83 * playlist. 84 * 85 * Using TOC is very easy. Firstly, create GstToc structure which represents root 86 * contents of the source. You can also attach TOC-specific tags to it. Then fill 87 * it with GstTocEntry entries by appending them to the GstToc using 88 * gst_toc_append_entry(), and appending subentries to a GstTocEntry using 89 * gst_toc_entry_append_sub_entry(). 90 * 91 * Note that root level of the TOC can contain only either editions or chapters. You 92 * should not mix them together at the same level. Otherwise you will get serialization 93 * /deserialization errors. Make sure that no one of the entries has negative start and 94 * stop values. 95 * 96 * Use gst_event_new_toc() to create a new TOC GstEvent, and gst_event_parse_toc() to 97 * parse received TOC event. Use gst_event_new_toc_select() to create a new TOC select GstEvent, 98 * and gst_event_parse_toc_select() to parse received TOC select event. The same rule for 99 * the GstMessage: gst_message_new_toc() to create new TOC GstMessage, and 100 * gst_message_parse_toc() to parse received TOC message. 101 * 102 * TOCs can have global scope or current scope. Global scope TOCs contain 103 * all entries that can possibly be selected using a toc select event, and 104 * are what an application is usually interested in. TOCs with current scope 105 * only contain the parts of the TOC relevant to the currently selected/playing 106 * stream; the current scope TOC is used by downstream elements such as muxers 107 * to write correct TOC entries when transcoding files, for example. When 108 * playing a DVD, the global TOC would contain a hierarchy of all titles, 109 * chapters and angles, for example, while the current TOC would only contain 110 * the chapters for the currently playing title if playback of a specific 111 * title was requested. 112 * 113 * Applications and plugins should not rely on TOCs having a certain kind of 114 * structure, but should allow for different alternatives. For example, a 115 * simple CUE sheet embedded in a file may be presented as a flat list of 116 * track entries, or could have a top-level edition node (or some other 117 * alternative type entry) with track entries underneath that node; or even 118 * multiple top-level edition nodes (or some other alternative type entries) 119 * each with track entries underneath, in case the source file has extracted 120 * a track listing from different sources). 121 */ 122 public class Toc 123 { 124 125 /** the main Gtk struct */ 126 protected GstToc* gstToc; 127 128 129 /** Get the main Gtk struct */ 130 public GstToc* getTocStruct() 131 { 132 return gstToc; 133 } 134 135 136 /** the main Gtk struct as a void* */ 137 protected void* getStruct() 138 { 139 return cast(void*)gstToc; 140 } 141 142 /** 143 * Sets our main struct and passes it to the parent class 144 */ 145 public this (GstToc* gstToc) 146 { 147 this.gstToc = gstToc; 148 } 149 150 /** 151 */ 152 153 /** 154 * Create a new GstToc structure. 155 * Throws: ConstructionException GTK+ fails to create the object. 156 */ 157 public this (GstTocScope scop) 158 { 159 // GstToc * gst_toc_new (GstTocScope scope); 160 auto p = gst_toc_new(scop); 161 if(p is null) 162 { 163 throw new ConstructionException("null returned by gst_toc_new(scop)"); 164 } 165 this(cast(GstToc*) p); 166 } 167 168 /** 169 * Returns: scope of toc 170 */ 171 public GstTocScope getScope() 172 { 173 // GstTocScope gst_toc_get_scope (const GstToc *toc); 174 return gst_toc_get_scope(gstToc); 175 } 176 177 /** 178 * Gets the list of GstTocEntry of toc. 179 * Returns: A GList of GstTocEntry for entry. [transfer none][element-type Gst.TocEntry] 180 */ 181 public ListG getEntries() 182 { 183 // GList * gst_toc_get_entries (const GstToc *toc); 184 auto p = gst_toc_get_entries(gstToc); 185 186 if(p is null) 187 { 188 return null; 189 } 190 191 return ObjectG.getDObject!(ListG)(cast(GList*) p); 192 } 193 194 /** 195 * Appends the GstTocEntry entry to toc. 196 * Params: 197 * entry = A GstTocEntry. [transfer full] 198 */ 199 public void appendEntry(TocEntry entry) 200 { 201 // void gst_toc_append_entry (GstToc *toc, GstTocEntry *entry); 202 gst_toc_append_entry(gstToc, (entry is null) ? null : entry.getTocEntryStruct()); 203 } 204 205 /** 206 * Gets the tags for toc. 207 * Returns: A GstTagList for entry. [transfer none] 208 */ 209 public TagList getTags() 210 { 211 // GstTagList * gst_toc_get_tags (const GstToc *toc); 212 auto p = gst_toc_get_tags(gstToc); 213 214 if(p is null) 215 { 216 return null; 217 } 218 219 return ObjectG.getDObject!(TagList)(cast(GstTagList*) p); 220 } 221 222 /** 223 * Merge tags into the existing tags of toc using mode. 224 * Params: 225 * tags = A GstTagList or NULL. [allow-none] 226 * mode = A GstTagMergeMode 227 */ 228 public void mergeTags(TagList tags, GstTagMergeMode mode) 229 { 230 // void gst_toc_merge_tags (GstToc *toc, GstTagList *tags, GstTagMergeMode mode); 231 gst_toc_merge_tags(gstToc, (tags is null) ? null : tags.getTagListStruct(), mode); 232 } 233 234 /** 235 * Set a GstTagList with tags for the complete toc. 236 * Params: 237 * tags = A GstTagList or NULL. [allow-none][transfer full] 238 */ 239 public void setTags(TagList tags) 240 { 241 // void gst_toc_set_tags (GstToc *toc, GstTagList *tags); 242 gst_toc_set_tags(gstToc, (tags is null) ? null : tags.getTagListStruct()); 243 } 244 245 /** 246 */ 247 public void dump() 248 { 249 // void gst_toc_dump (GstToc *toc); 250 gst_toc_dump(gstToc); 251 } 252 253 /** 254 * Find GstTocEntry with given uid in the toc. 255 * Params: 256 * uid = UID to find GstTocEntry with. 257 * Returns: GstTocEntry with specified uid from the toc, or NULL if not found. [transfer none] 258 */ 259 public TocEntry findEntry(string uid) 260 { 261 // GstTocEntry * gst_toc_find_entry (const GstToc *toc, const gchar *uid); 262 auto p = gst_toc_find_entry(gstToc, Str.toStringz(uid)); 263 264 if(p is null) 265 { 266 return null; 267 } 268 269 return ObjectG.getDObject!(TocEntry)(cast(GstTocEntry*) p); 270 } 271 }