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-GstEvent.html 27 * outPack = gstreamer 28 * outFile = Event 29 * strct = GstEvent 30 * realStrct= 31 * ctorStrct= 32 * clss = Event 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gst_event_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * - gst_event_new_eos 45 * - gst_event_new_flush_start 46 * - gst_event_new_toc_select 47 * omit signals: 48 * imports: 49 * - glib.Str 50 * - gstreamer.Caps 51 * - gstreamer.Message 52 * - gstreamer.Segment 53 * - gstreamer.Structure 54 * - gstreamer.TagList 55 * - gstreamer.Toc 56 * structWrap: 57 * - GstCaps* -> Caps 58 * - GstEvent* -> Event 59 * - GstMessage* -> Message 60 * - GstSegment* -> Segment 61 * - GstStructure* -> Structure 62 * - GstTagList* -> TagList 63 * - GstToc* -> Toc 64 * module aliases: 65 * local aliases: 66 * overrides: 67 */ 68 69 module gstreamer.Event; 70 71 public import gstreamerc.gstreamertypes; 72 73 private import gstreamerc.gstreamer; 74 private import glib.ConstructionException; 75 private import gobject.ObjectG; 76 77 private import glib.Str; 78 private import gstreamer.Caps; 79 private import gstreamer.Message; 80 private import gstreamer.Segment; 81 private import gstreamer.Structure; 82 private import gstreamer.TagList; 83 private import gstreamer.Toc; 84 85 86 87 /** 88 * The event class provides factory methods to construct events for sending 89 * and functions to query (parse) received events. 90 * 91 * Events are usually created with gst_event_new_*() which takes event-type 92 * specific parameters as arguments. 93 * To send an event application will usually use gst_element_send_event() and 94 * elements will use gst_pad_send_event() or gst_pad_push_event(). 95 * The event should be unreffed with gst_event_unref() if it has not been sent. 96 * 97 * Events that have been received can be parsed with their respective 98 * gst_event_parse_*() functions. It is valid to pass NULL for unwanted details. 99 * 100 * Events are passed between elements in parallel to the data stream. Some events 101 * are serialized with buffers, others are not. Some events only travel downstream, 102 * others only upstream. Some events can travel both upstream and downstream. 103 * 104 * The events are used to signal special conditions in the datastream such as 105 * EOS (end of stream) or the start of a new stream-segment. 106 * Events are also used to flush the pipeline of any pending data. 107 * 108 * Most of the event API is used inside plugins. Applications usually only 109 * construct and use seek events. 110 * To do that gst_event_new_seek() is used to create a seek event. It takes 111 * the needed parameters to specify seeking time and mode. 112 * 113 * $(DDOC_COMMENT example) 114 * 115 * Last reviewed on 2012-03-28 (0.11.3) 116 */ 117 public class Event 118 { 119 120 /** the main Gtk struct */ 121 protected GstEvent* gstEvent; 122 123 124 /** Get the main Gtk struct */ 125 public GstEvent* getEventStruct() 126 { 127 return gstEvent; 128 } 129 130 131 /** the main Gtk struct as a void* */ 132 protected void* getStruct() 133 { 134 return cast(void*)gstEvent; 135 } 136 137 /** 138 * Sets our main struct and passes it to the parent class 139 */ 140 public this (GstEvent* gstEvent) 141 { 142 this.gstEvent = gstEvent; 143 } 144 145 /** 146 * Create a new EOS event. The eos event can only travel downstream 147 * synchronized with the buffer flow. Elements that receive the EOS 148 * event on a pad can return UNEXPECTED as a GstFlowReturn when data 149 * after the EOS event arrives. 150 * The EOS event will travel down to the sink elements in the pipeline 151 * which will then post the GST_MESSAGE_EOS on the bus after they have 152 * finished playing any buffered data. 153 * When all sinks have posted an EOS message, the EOS message is 154 * forwarded to the application. 155 * Returns: 156 * The new EOS event. 157 */ 158 public static Event newEOS() 159 { 160 // GstEvent* gst_event_new_eos (void); 161 auto p = gst_event_new_eos(); 162 163 if(p is null) 164 { 165 throw new ConstructionException("null returned by gst_event_new_eos"); 166 } 167 168 return new Event(cast(GstEvent*)p ); 169 } /** 170 * Allocate a new flush start event. The flush start event can be send 171 * upstream and downstream and travels out-of-bounds with the dataflow. 172 * It marks pads as being in a WRONG_STATE to process more data. 173 * Elements unlock and blocking functions and exit their streaming functions 174 * as fast as possible. 175 * This event is typically generated after a seek to minimize the latency 176 * after the seek. 177 * Returns: 178 * A new flush start event. 179 */ 180 public static Event newFlushStart() 181 { 182 // GstEvent* gst_event_new_flush_start (void); 183 auto p = gst_event_new_flush_start(); 184 185 if(p is null) 186 { 187 throw new ConstructionException("null returned by gst_event_new_flush_start"); 188 } 189 190 return new Event(cast(GstEvent*)p ); 191 } /** 192 * Generate a TOC select event with the given uid. The purpose of the 193 * TOC select event is to start playback based on the TOC's entry with 194 * the given uid. 195 */ 196 public static Event newTocSelect(string uid) 197 { 198 // GstEvent* gst_event_new_toc_select (const gchar *uid); 199 auto p = gst_event_new_toc_select(cast(char*)uid.ptr); 200 201 if(p is null) 202 { 203 throw new ConstructionException("null returned by gst_event_new_toc_select"); 204 } 205 206 return new Event(cast(GstEvent*)p ); 207 } 208 209 /** 210 */ 211 212 /** 213 * Gets the GstEventTypeFlags associated with type. 214 * Params: 215 * type = a GstEventType 216 * Returns: a GstEventTypeFlags. 217 */ 218 public static GstEventTypeFlags typeGetFlags(GstEventType type) 219 { 220 // GstEventTypeFlags gst_event_type_get_flags (GstEventType type); 221 return gst_event_type_get_flags(type); 222 } 223 224 /** 225 * Get a printable name for the given event type. Do not modify or free. 226 * Params: 227 * type = the event type 228 * Returns: a reference to the static name of the event. 229 */ 230 public static string typeGetName(GstEventType type) 231 { 232 // const gchar * gst_event_type_get_name (GstEventType type); 233 return Str.toString(gst_event_type_get_name(type)); 234 } 235 236 /** 237 * Get the unique quark for the given event type. 238 * Params: 239 * type = the event type 240 * Returns: the quark associated with the event type 241 */ 242 public static GQuark typeToQuark(GstEventType type) 243 { 244 // GQuark gst_event_type_to_quark (GstEventType type); 245 return gst_event_type_to_quark(type); 246 } 247 248 /** 249 * Increase the refcount of this event. 250 * Returns: event (for convenience when doing assignments). [transfer full] 251 */ 252 public Event doref() 253 { 254 // GstEvent * gst_event_ref (GstEvent *event); 255 auto p = gst_event_ref(gstEvent); 256 257 if(p is null) 258 { 259 return null; 260 } 261 262 return ObjectG.getDObject!(Event)(cast(GstEvent*) p); 263 } 264 265 /** 266 * Decrease the refcount of an event, freeing it if the refcount reaches 0. 267 */ 268 public void unref() 269 { 270 // void gst_event_unref (GstEvent *event); 271 gst_event_unref(gstEvent); 272 } 273 274 /** 275 * Modifies a pointer to a GstEvent to point to a different GstEvent. The 276 * modification is done atomically (so this is useful for ensuring thread safety 277 * in some cases), and the reference counts are updated appropriately (the old 278 * event is unreffed, the new one is reffed). 279 * Either new_event or the GstEvent pointed to by old_event may be NULL. 280 * Params: 281 * oldEvent = pointer to a pointer to a GstEvent 282 * to be replaced. [inout][transfer full] 283 * newEvent = pointer to a GstEvent that will 284 * replace the event pointed to by old_event. [allow-none][transfer none] 285 * Returns: TRUE if new_event was different from old_event 286 */ 287 public static int replace(ref Event oldEvent, Event newEvent) 288 { 289 // gboolean gst_event_replace (GstEvent **old_event, GstEvent *new_event); 290 GstEvent* outoldEvent = (oldEvent is null) ? null : oldEvent.getEventStruct(); 291 292 auto p = gst_event_replace(&outoldEvent, (newEvent is null) ? null : newEvent.getEventStruct()); 293 294 oldEvent = ObjectG.getDObject!(Event)(outoldEvent); 295 return p; 296 } 297 298 /** 299 * Copy the event using the event specific copy function. 300 * Returns: the new event. [transfer full] 301 */ 302 public Event copy() 303 { 304 // GstEvent * gst_event_copy (const GstEvent *event); 305 auto p = gst_event_copy(gstEvent); 306 307 if(p is null) 308 { 309 return null; 310 } 311 312 return ObjectG.getDObject!(Event)(cast(GstEvent*) p); 313 } 314 315 /** 316 * Atomically replace the GstEvent pointed to by old_event with NULL and 317 * return the original event. 318 * Params: 319 * oldEvent = pointer to a pointer to a GstEvent 320 * to be stolen. [inout][transfer full] 321 * Returns: the GstEvent that was in old_event 322 */ 323 public static Event steal(ref Event oldEvent) 324 { 325 // GstEvent * gst_event_steal (GstEvent **old_event); 326 GstEvent* outoldEvent = (oldEvent is null) ? null : oldEvent.getEventStruct(); 327 328 auto p = gst_event_steal(&outoldEvent); 329 330 oldEvent = ObjectG.getDObject!(Event)(outoldEvent); 331 332 if(p is null) 333 { 334 return null; 335 } 336 337 return ObjectG.getDObject!(Event)(cast(GstEvent*) p); 338 } 339 340 /** 341 * Modifies a pointer to a GstEvent to point to a different GstEvent. This 342 * function is similar to gst_event_replace() except that it takes ownership of 343 * new_event. 344 * Either new_event or the GstEvent pointed to by old_event may be NULL. 345 * Params: 346 * oldEvent = pointer to a pointer to a GstEvent 347 * to be stolen. [inout][transfer full] 348 * newEvent = pointer to a GstEvent that will 349 * replace the event pointed to by old_event. [allow-none][transfer full] 350 * Returns: TRUE if new_event was different from old_event 351 */ 352 public static int take(ref Event oldEvent, Event newEvent) 353 { 354 // gboolean gst_event_take (GstEvent **old_event, GstEvent *new_event); 355 GstEvent* outoldEvent = (oldEvent is null) ? null : oldEvent.getEventStruct(); 356 357 auto p = gst_event_take(&outoldEvent, (newEvent is null) ? null : newEvent.getEventStruct()); 358 359 oldEvent = ObjectG.getDObject!(Event)(outoldEvent); 360 return p; 361 } 362 363 /** 364 * Get a writable version of the structure. 365 * Returns: The structure of the event. The structure is still owned by the event, which means that you should not free it and that the pointer becomes invalid when you free the event. This function checks if event is writable and will never return NULL. MT safe. 366 */ 367 public Structure writableStructure() 368 { 369 // GstStructure * gst_event_writable_structure (GstEvent *event); 370 auto p = gst_event_writable_structure(gstEvent); 371 372 if(p is null) 373 { 374 return null; 375 } 376 377 return ObjectG.getDObject!(Structure)(cast(GstStructure*) p); 378 } 379 380 /** 381 * Create a new custom-typed event. This can be used for anything not 382 * handled by other event-specific functions to pass an event to another 383 * element. 384 * Make sure to allocate an event type with the GST_EVENT_MAKE_TYPE macro, 385 * assigning a free number and filling in the correct direction and 386 * serialization flags. 387 * New custom events can also be created by subclassing the event type if 388 * needed. 389 * Params: 390 * type = The type of the new event 391 * structure = the structure for the event. The event will 392 * take ownership of the structure. [transfer full] 393 * Throws: ConstructionException GTK+ fails to create the object. 394 */ 395 public this (GstEventType type, Structure structure) 396 { 397 // GstEvent * gst_event_new_custom (GstEventType type, GstStructure *structure); 398 auto p = gst_event_new_custom(type, (structure is null) ? null : structure.getStructureStruct()); 399 if(p is null) 400 { 401 throw new ConstructionException("null returned by gst_event_new_custom(type, (structure is null) ? null : structure.getStructureStruct())"); 402 } 403 this(cast(GstEvent*) p); 404 } 405 406 /** 407 * Access the structure of the event. 408 * Returns: The structure of the event. The structure is still owned by the event, which means that you should not free it and that the pointer becomes invalid when you free the event. MT safe. 409 */ 410 public Structure getStructure() 411 { 412 // const GstStructure * gst_event_get_structure (GstEvent *event); 413 auto p = gst_event_get_structure(gstEvent); 414 415 if(p is null) 416 { 417 return null; 418 } 419 420 return ObjectG.getDObject!(Structure)(cast(GstStructure*) p); 421 } 422 423 /** 424 * Checks if event has the given name. This function is usually used to 425 * check the name of a custom event. 426 * Params: 427 * name = name to check 428 * Returns: TRUE if name matches the name of the event structure. 429 */ 430 public int hasName(string name) 431 { 432 // gboolean gst_event_has_name (GstEvent *event, const gchar *name); 433 return gst_event_has_name(gstEvent, Str.toStringz(name)); 434 } 435 436 /** 437 * Retrieve the sequence number of a event. 438 * Events have ever-incrementing sequence numbers, which may also be set 439 * explicitly via gst_event_set_seqnum(). Sequence numbers are typically used to 440 * indicate that a event corresponds to some other set of events or messages, 441 * for example an EOS event corresponding to a SEEK event. It is considered good 442 * practice to make this correspondence when possible, though it is not 443 * required. 444 * Note that events and messages share the same sequence number incrementor; 445 * two events or messages will never have the same sequence number unless 446 * that correspondence was made explicitly. 447 * Returns: The event's sequence number. MT safe. 448 */ 449 public uint getSeqnum() 450 { 451 // guint32 gst_event_get_seqnum (GstEvent *event); 452 return gst_event_get_seqnum(gstEvent); 453 } 454 455 /** 456 * Set the sequence number of a event. 457 * This function might be called by the creator of a event to indicate that the 458 * event relates to other events or messages. See gst_event_get_seqnum() for 459 * more information. 460 * MT safe. 461 * Params: 462 * seqnum = A sequence number. 463 */ 464 public void setSeqnum(uint seqnum) 465 { 466 // void gst_event_set_seqnum (GstEvent *event, guint32 seqnum); 467 gst_event_set_seqnum(gstEvent, seqnum); 468 } 469 470 /** 471 * Allocate a new flush stop event. The flush stop event can be sent 472 * upstream and downstream and travels serialized with the dataflow. 473 * It is typically sent after sending a FLUSH_START event to make the 474 * pads accept data again. 475 * Elements can process this event synchronized with the dataflow since 476 * the preceeding FLUSH_START event stopped the dataflow. 477 * This event is typically generated to complete a seek and to resume 478 * dataflow. 479 * Params: 480 * resetTime = if time should be reset 481 * Throws: ConstructionException GTK+ fails to create the object. 482 */ 483 public this (int resetTime) 484 { 485 // GstEvent * gst_event_new_flush_stop (gboolean reset_time); 486 auto p = gst_event_new_flush_stop(resetTime); 487 if(p is null) 488 { 489 throw new ConstructionException("null returned by gst_event_new_flush_stop(resetTime)"); 490 } 491 this(cast(GstEvent*) p); 492 } 493 494 /** 495 * Parse the FLUSH_STOP event and retrieve the reset_time member. 496 * Params: 497 * resetTime = if time should be reset. [out] 498 */ 499 public void parseFlushStop(out int resetTime) 500 { 501 // void gst_event_parse_flush_stop (GstEvent *event, gboolean *reset_time); 502 gst_event_parse_flush_stop(gstEvent, &resetTime); 503 } 504 505 /** 506 * Create a new GAP event. A gap event can be thought of as conceptually 507 * equivalent to a buffer to signal that there is no data for a certain 508 * amount of time. This is useful to signal a gap to downstream elements 509 * which may wait for data, such as muxers or mixers or overlays, especially 510 * for sparse streams such as subtitle streams. 511 * Params: 512 * timestamp = the start time (pts) of the gap 513 * duration = the duration of the gap 514 * Throws: ConstructionException GTK+ fails to create the object. 515 */ 516 public this (GstClockTime timestamp, GstClockTime duration) 517 { 518 // GstEvent * gst_event_new_gap (GstClockTime timestamp, GstClockTime duration); 519 auto p = gst_event_new_gap(timestamp, duration); 520 if(p is null) 521 { 522 throw new ConstructionException("null returned by gst_event_new_gap(timestamp, duration)"); 523 } 524 this(cast(GstEvent*) p); 525 } 526 527 /** 528 * Extract timestamp and duration from a new GAP event. 529 * Params: 530 * timestamp = location where to store the 531 * start time (pts) of the gap, or NULL. [out][allow-none] 532 * duration = location where to store the duration of 533 * the gap, or NULL. [out][allow-none] 534 */ 535 public void parseGap(out GstClockTime timestamp, out GstClockTime duration) 536 { 537 // void gst_event_parse_gap (GstEvent *event, GstClockTime *timestamp, GstClockTime *duration); 538 gst_event_parse_gap(gstEvent, ×tamp, &duration); 539 } 540 541 /** 542 * Create a new STREAM_START event. The stream start event can only 543 * travel downstream synchronized with the buffer flow. It is expected 544 * to be the first event that is sent for a new stream. 545 * Source elements, demuxers and other elements that create new streams 546 * are supposed to send this event as the first event of a new stream. It 547 * should not be send after a flushing seek or in similar situations 548 * and is used to mark the beginning of a new logical stream. Elements 549 * combining multiple streams must ensure that this event is only forwarded 550 * downstream once and not for every single input stream. 551 * The stream_id should be a unique string that consists of the upstream 552 * stream-id, / as separator and a unique stream-id for this specific 553 * stream. A new stream-id should only be created for a stream if the upstream 554 * stream is split into (potentially) multiple new streams, e.g. in a demuxer, 555 * but not for every single element in the pipeline. 556 * gst_pad_create_stream_id() or gst_pad_create_stream_id_printf() can be 557 * used to create a stream-id. 558 * Params: 559 * streamId = Identifier for this stream 560 * Throws: ConstructionException GTK+ fails to create the object. 561 */ 562 public this (string streamId) 563 { 564 // GstEvent * gst_event_new_stream_start (const gchar *stream_id); 565 auto p = gst_event_new_stream_start(Str.toStringz(streamId)); 566 if(p is null) 567 { 568 throw new ConstructionException("null returned by gst_event_new_stream_start(Str.toStringz(streamId))"); 569 } 570 this(cast(GstEvent*) p); 571 } 572 573 /** 574 * Parse a stream-id event and store the result in the given stream_id 575 * location. The string stored in stream_id must not be modified and will 576 * remain valid only until event gets freed. Make a copy if you want to 577 * modify it or store it for later use. 578 * Params: 579 * streamId = pointer to store the stream-id. [out][transfer none] 580 */ 581 public void parseStreamStart(out string streamId) 582 { 583 // void gst_event_parse_stream_start (GstEvent *event, const gchar **stream_id); 584 char* outstreamId = null; 585 586 gst_event_parse_stream_start(gstEvent, &outstreamId); 587 588 streamId = Str.toString(outstreamId); 589 } 590 591 /** 592 * Since 1.2 593 * Params: 594 * flags = the stream flags to set 595 */ 596 public void setStreamFlags(GstStreamFlags flags) 597 { 598 // void gst_event_set_stream_flags (GstEvent *event, GstStreamFlags flags); 599 gst_event_set_stream_flags(gstEvent, flags); 600 } 601 602 /** 603 * Since 1.2 604 * Params: 605 * flags = address of variable where to store the stream flags. [out] 606 */ 607 public void parseStreamFlags(out GstStreamFlags flags) 608 { 609 // void gst_event_parse_stream_flags (GstEvent *event, GstStreamFlags *flags); 610 gst_event_parse_stream_flags(gstEvent, &flags); 611 } 612 613 /** 614 * All streams that have the same group id are supposed to be played 615 * together, i.e. all streams inside a container file should have the 616 * same group id but different stream ids. The group id should change 617 * each time the stream is started, resulting in different group ids 618 * each time a file is played for example. 619 * Use gst_util_group_id_next() to get a new group id. 620 * Since 1.2 621 * Params: 622 * groupId = the group id to set 623 */ 624 public void setGroupId(uint groupId) 625 { 626 // void gst_event_set_group_id (GstEvent *event, guint group_id); 627 gst_event_set_group_id(gstEvent, groupId); 628 } 629 630 /** 631 * Since 1.2 632 * Params: 633 * groupId = address of variable where to store the group id. [out] 634 * Returns: TRUE if a group id was set on the event and could be parsed, FALSE otherwise. 635 */ 636 public int parseGroupId(out uint groupId) 637 { 638 // gboolean gst_event_parse_group_id (GstEvent *event, guint *group_id); 639 return gst_event_parse_group_id(gstEvent, &groupId); 640 } 641 642 /** 643 * Create a new SEGMENT event for segment. The segment event can only travel 644 * downstream synchronized with the buffer flow and contains timing information 645 * and playback properties for the buffers that will follow. 646 * The newsegment event marks the range of buffers to be processed. All 647 * data not within the segment range is not to be processed. This can be 648 * used intelligently by plugins to apply more efficient methods of skipping 649 * unneeded data. The valid range is expressed with the start and stop 650 * values. 651 * The time value of the segment is used in conjunction with the start 652 * value to convert the buffer timestamps into the stream time. This is 653 * usually done in sinks to report the current stream_time. 654 * time represents the stream_time of a buffer carrying a timestamp of 655 * start. time cannot be -1. 656 * start cannot be -1, stop can be -1. If there 657 * is a valid stop given, it must be greater or equal the start, including 658 * when the indicated playback rate is < 0. 659 * The applied_rate value provides information about any rate adjustment that 660 * has already been made to the timestamps and content on the buffers of the 661 * stream. (rate * applied_rate) should always equal the rate that has been 662 * requested for playback. For example, if an element has an input segment 663 * with intended playback rate of 2.0 and applied_rate of 1.0, it can adjust 664 * incoming timestamps and buffer content by half and output a newsegment event 665 * with rate of 1.0 and applied_rate of 2.0 666 * Params: 667 * segment = a GstSegment. [transfer none] 668 * Throws: ConstructionException GTK+ fails to create the object. 669 */ 670 public this (Segment segment) 671 { 672 // GstEvent * gst_event_new_segment (const GstSegment *segment); 673 auto p = gst_event_new_segment((segment is null) ? null : segment.getSegmentStruct()); 674 if(p is null) 675 { 676 throw new ConstructionException("null returned by gst_event_new_segment((segment is null) ? null : segment.getSegmentStruct())"); 677 } 678 this(cast(GstEvent*) p); 679 } 680 681 /** 682 * Parses a segment event and stores the result in the given segment location. 683 * segment remains valid only until the event is freed. Don't modify the segment 684 * and make a copy if you want to modify it or store it for later use. 685 * Params: 686 * segment = a pointer to a GstSegment. [out][transfer none] 687 */ 688 public void parseSegment(out Segment segment) 689 { 690 // void gst_event_parse_segment (GstEvent *event, const GstSegment **segment); 691 GstSegment* outsegment = null; 692 693 gst_event_parse_segment(gstEvent, &outsegment); 694 695 segment = ObjectG.getDObject!(Segment)(outsegment); 696 } 697 698 /** 699 * Parses a segment event and copies the GstSegment into the location 700 * given by segment. 701 * Params: 702 * segment = a pointer to a GstSegment 703 */ 704 public void copySegment(Segment segment) 705 { 706 // void gst_event_copy_segment (GstEvent *event, GstSegment *segment); 707 gst_event_copy_segment(gstEvent, (segment is null) ? null : segment.getSegmentStruct()); 708 } 709 710 /** 711 * Generates a metadata tag event from the given taglist. 712 * The scope of the taglist specifies if the taglist applies to the 713 * complete medium or only to this specific stream. As the tag event 714 * is a sticky event, elements should merge tags received from 715 * upstream with a given scope with their own tags with the same 716 * scope and create a new tag event from it. 717 * Params: 718 * taglist = metadata list. The event will take ownership 719 * of the taglist. [transfer full] 720 * Throws: ConstructionException GTK+ fails to create the object. 721 */ 722 public this (TagList taglist) 723 { 724 // GstEvent * gst_event_new_tag (GstTagList *taglist); 725 auto p = gst_event_new_tag((taglist is null) ? null : taglist.getTagListStruct()); 726 if(p is null) 727 { 728 throw new ConstructionException("null returned by gst_event_new_tag((taglist is null) ? null : taglist.getTagListStruct())"); 729 } 730 this(cast(GstEvent*) p); 731 } 732 733 /** 734 * Parses a tag event and stores the results in the given taglist location. 735 * No reference to the taglist will be returned, it remains valid only until 736 * the event is freed. Don't modify or free the taglist, make a copy if you 737 * want to modify it or store it for later use. 738 * Params: 739 * taglist = pointer to metadata list. [out][transfer none] 740 */ 741 public void parseTag(out TagList taglist) 742 { 743 // void gst_event_parse_tag (GstEvent *event, GstTagList **taglist); 744 GstTagList* outtaglist = null; 745 746 gst_event_parse_tag(gstEvent, &outtaglist); 747 748 taglist = ObjectG.getDObject!(TagList)(outtaglist); 749 } 750 751 /** 752 * Create a new buffersize event. The event is sent downstream and notifies 753 * elements that they should provide a buffer of the specified dimensions. 754 * When the async flag is set, a thread boundary is preferred. 755 * Params: 756 * format = buffer format 757 * minsize = minimum buffer size 758 * maxsize = maximum buffer size 759 * async = thread behavior 760 * Throws: ConstructionException GTK+ fails to create the object. 761 */ 762 public this (GstFormat format, long minsize, long maxsize, int async) 763 { 764 // GstEvent * gst_event_new_buffer_size (GstFormat format, gint64 minsize, gint64 maxsize, gboolean async); 765 auto p = gst_event_new_buffer_size(format, minsize, maxsize, async); 766 if(p is null) 767 { 768 throw new ConstructionException("null returned by gst_event_new_buffer_size(format, minsize, maxsize, async)"); 769 } 770 this(cast(GstEvent*) p); 771 } 772 773 /** 774 * Get the format, minsize, maxsize and async-flag in the buffersize event. 775 * Params: 776 * format = A pointer to store the format in. [out] 777 * minsize = A pointer to store the minsize in. [out] 778 * maxsize = A pointer to store the maxsize in. [out] 779 * async = A pointer to store the async-flag in. [out] 780 */ 781 public void parseBufferSize(out GstFormat format, out long minsize, out long maxsize, out int async) 782 { 783 // void gst_event_parse_buffer_size (GstEvent *event, GstFormat *format, gint64 *minsize, gint64 *maxsize, gboolean *async); 784 gst_event_parse_buffer_size(gstEvent, &format, &minsize, &maxsize, &async); 785 } 786 787 /** 788 * Allocate a new qos event with the given values. 789 * The QOS event is generated in an element that wants an upstream 790 * element to either reduce or increase its rate because of 791 * high/low CPU load or other resource usage such as network performance or 792 * throttling. Typically sinks generate these events for each buffer 793 * they receive. 794 * type indicates the reason for the QoS event. GST_QOS_TYPE_OVERFLOW is 795 * used when a buffer arrived in time or when the sink cannot keep up with 796 * the upstream datarate. GST_QOS_TYPE_UNDERFLOW is when the sink is not 797 * receiving buffers fast enough and thus has to drop late buffers. 798 * GST_QOS_TYPE_THROTTLE is used when the datarate is artificially limited 799 * by the application, for example to reduce power consumption. 800 * proportion indicates the real-time performance of the streaming in the 801 * element that generated the QoS event (usually the sink). The value is 802 * generally computed based on more long term statistics about the streams 803 * timestamps compared to the clock. 804 * A value < 1.0 indicates that the upstream element is producing data faster 805 * than real-time. A value > 1.0 indicates that the upstream element is not 806 * producing data fast enough. 1.0 is the ideal proportion value. The 807 * proportion value can safely be used to lower or increase the quality of 808 * the element. 809 * diff is the difference against the clock in running time of the last 810 * buffer that caused the element to generate the QOS event. A negative value 811 * means that the buffer with timestamp arrived in time. A positive value 812 * indicates how late the buffer with timestamp was. When throttling is 813 * enabled, diff will be set to the requested throttling interval. 814 * timestamp is the timestamp of the last buffer that cause the element 815 * to generate the QOS event. It is expressed in running time and thus an ever 816 * increasing value. 817 * The upstream element can use the diff and timestamp values to decide 818 * whether to process more buffers. For possitive diff, all buffers with 819 * timestamp <= timestamp + diff will certainly arrive late in the sink 820 * as well. A (negative) diff value so that timestamp + diff would yield a 821 * result smaller than 0 is not allowed. 822 * The application can use general event probes to intercept the QoS 823 * event and implement custom application specific QoS handling. 824 * Params: 825 * type = the QoS type 826 * proportion = the proportion of the qos message 827 * diff = The time difference of the last Clock sync 828 * timestamp = The timestamp of the buffer 829 * Throws: ConstructionException GTK+ fails to create the object. 830 */ 831 public this (GstQOSType type, double proportion, GstClockTimeDiff diff, GstClockTime timestamp) 832 { 833 // GstEvent * gst_event_new_qos (GstQOSType type, gdouble proportion, GstClockTimeDiff diff, GstClockTime timestamp); 834 auto p = gst_event_new_qos(type, proportion, diff, timestamp); 835 if(p is null) 836 { 837 throw new ConstructionException("null returned by gst_event_new_qos(type, proportion, diff, timestamp)"); 838 } 839 this(cast(GstEvent*) p); 840 } 841 842 /** 843 * Get the type, proportion, diff and timestamp in the qos event. See 844 * gst_event_new_qos() for more information about the different QoS values. 845 * Params: 846 * type = A pointer to store the QoS type in. [out] 847 * proportion = A pointer to store the proportion in. [out] 848 * diff = A pointer to store the diff in. [out] 849 * timestamp = A pointer to store the timestamp in. [out] 850 */ 851 public void parseQos(out GstQOSType type, out double proportion, out GstClockTimeDiff diff, out GstClockTime timestamp) 852 { 853 // void gst_event_parse_qos (GstEvent *event, GstQOSType *type, gdouble *proportion, GstClockTimeDiff *diff, GstClockTime *timestamp); 854 gst_event_parse_qos(gstEvent, &type, &proportion, &diff, ×tamp); 855 } 856 857 /** 858 * Allocate a new seek event with the given parameters. 859 * The seek event configures playback of the pipeline between start to stop 860 * at the speed given in rate, also called a playback segment. 861 * The start and stop values are expressed in format. 862 * A rate of 1.0 means normal playback rate, 2.0 means double speed. 863 * Negatives values means backwards playback. A value of 0.0 for the 864 * rate is not allowed and should be accomplished instead by PAUSING the 865 * pipeline. 866 * A pipeline has a default playback segment configured with a start 867 * position of 0, a stop position of -1 and a rate of 1.0. The currently 868 * configured playback segment can be queried with GST_QUERY_SEGMENT. 869 * start_type and stop_type specify how to adjust the currently configured 870 * start and stop fields in playback segment. Adjustments can be made relative 871 * or absolute to the last configured values. A type of GST_SEEK_TYPE_NONE 872 * means that the position should not be updated. 873 * When the rate is positive and start has been updated, playback will start 874 * from the newly configured start position. 875 * For negative rates, playback will start from the newly configured stop 876 * position (if any). If the stop position is updated, it must be different from 877 * -1 (GST_CLOCK_TIME_NONE) for negative rates. 878 * It is not possible to seek relative to the current playback position, to do 879 * this, PAUSE the pipeline, query the current playback position with 880 * GST_QUERY_POSITION and update the playback segment current position with a 881 * GST_SEEK_TYPE_SET to the desired position. 882 * Params: 883 * rate = The new playback rate 884 * format = The format of the seek values 885 * flags = The optional seek flags 886 * startType = The type and flags for the new start position 887 * start = The value of the new start position 888 * stopType = The type and flags for the new stop position 889 * stop = The value of the new stop position 890 * Throws: ConstructionException GTK+ fails to create the object. 891 */ 892 public this (double rate, GstFormat format, GstSeekFlags flags, GstSeekType startType, long start, GstSeekType stopType, long stop) 893 { 894 // GstEvent * gst_event_new_seek (gdouble rate, GstFormat format, GstSeekFlags flags, GstSeekType start_type, gint64 start, GstSeekType stop_type, gint64 stop); 895 auto p = gst_event_new_seek(rate, format, flags, startType, start, stopType, stop); 896 if(p is null) 897 { 898 throw new ConstructionException("null returned by gst_event_new_seek(rate, format, flags, startType, start, stopType, stop)"); 899 } 900 this(cast(GstEvent*) p); 901 } 902 903 /** 904 * Parses a seek event and stores the results in the given result locations. 905 * Params: 906 * rate = result location for the rate. [out] 907 * format = result location for the stream format. [out] 908 * flags = result location for the GstSeekFlags. [out] 909 * startType = result location for the GstSeekType of the start position. [out] 910 * start = result location for the start postion expressed in format. [out] 911 * stopType = result location for the GstSeekType of the stop position. [out] 912 * stop = result location for the stop postion expressed in format. [out] 913 */ 914 public void parseSeek(out double rate, out GstFormat format, out GstSeekFlags flags, out GstSeekType startType, out long start, out GstSeekType stopType, out long stop) 915 { 916 // void gst_event_parse_seek (GstEvent *event, gdouble *rate, GstFormat *format, GstSeekFlags *flags, GstSeekType *start_type, gint64 *start, GstSeekType *stop_type, gint64 *stop); 917 gst_event_parse_seek(gstEvent, &rate, &format, &flags, &startType, &start, &stopType, &stop); 918 } 919 920 /** 921 * Create a new navigation event from the given description. 922 * Params: 923 * structure = description of the event. The event will take 924 * ownership of the structure. [transfer full] 925 * Throws: ConstructionException GTK+ fails to create the object. 926 */ 927 public this (Structure structure) 928 { 929 // GstEvent * gst_event_new_navigation (GstStructure *structure); 930 auto p = gst_event_new_navigation((structure is null) ? null : structure.getStructureStruct()); 931 if(p is null) 932 { 933 throw new ConstructionException("null returned by gst_event_new_navigation((structure is null) ? null : structure.getStructureStruct())"); 934 } 935 this(cast(GstEvent*) p); 936 } 937 938 /** 939 * Create a new latency event. The event is sent upstream from the sinks and 940 * notifies elements that they should add an additional latency to the 941 * running time before synchronising against the clock. 942 * The latency is mostly used in live sinks and is always expressed in 943 * the time format. 944 * Params: 945 * latency = the new latency value 946 * Throws: ConstructionException GTK+ fails to create the object. 947 */ 948 public this (GstClockTime latency) 949 { 950 // GstEvent * gst_event_new_latency (GstClockTime latency); 951 auto p = gst_event_new_latency(latency); 952 if(p is null) 953 { 954 throw new ConstructionException("null returned by gst_event_new_latency(latency)"); 955 } 956 this(cast(GstEvent*) p); 957 } 958 959 /** 960 * Get the latency in the latency event. 961 * Params: 962 * latency = A pointer to store the latency in. [out] 963 */ 964 public void parseLatency(ref GstClockTime latency) 965 { 966 // void gst_event_parse_latency (GstEvent *event, GstClockTime *latency); 967 gst_event_parse_latency(gstEvent, &latency); 968 } 969 970 /** 971 * Create a new step event. The purpose of the step event is to instruct a sink 972 * to skip amount (expressed in format) of media. It can be used to implement 973 * stepping through the video frame by frame or for doing fast trick modes. 974 * A rate of <= 0.0 is not allowed. Pause the pipeline, for the effect of rate 975 * = 0.0 or first reverse the direction of playback using a seek event to get 976 * the same effect as rate < 0.0. 977 * The flush flag will clear any pending data in the pipeline before starting 978 * the step operation. 979 * The intermediate flag instructs the pipeline that this step operation is 980 * part of a larger step operation. 981 * Params: 982 * format = the format of amount 983 * amount = the amount of data to step 984 * rate = the step rate 985 * flush = flushing steps 986 * intermediate = intermediate steps 987 * Throws: ConstructionException GTK+ fails to create the object. 988 */ 989 public this (GstFormat format, ulong amount, double rate, int flush, int intermediate) 990 { 991 // GstEvent * gst_event_new_step (GstFormat format, guint64 amount, gdouble rate, gboolean flush, gboolean intermediate); 992 auto p = gst_event_new_step(format, amount, rate, flush, intermediate); 993 if(p is null) 994 { 995 throw new ConstructionException("null returned by gst_event_new_step(format, amount, rate, flush, intermediate)"); 996 } 997 this(cast(GstEvent*) p); 998 } 999 1000 /** 1001 * Parse the step event. 1002 * Params: 1003 * format = a pointer to store the format in. [out][allow-none] 1004 * amount = a pointer to store the amount in. [out][allow-none] 1005 * rate = a pointer to store the rate in. [out][allow-none] 1006 * flush = a pointer to store the flush boolean in. [out][allow-none] 1007 * intermediate = a pointer to store the intermediate 1008 * boolean in. [out][allow-none] 1009 */ 1010 public void parseStep(out GstFormat format, out ulong amount, out double rate, out int flush, out int intermediate) 1011 { 1012 // void gst_event_parse_step (GstEvent *event, GstFormat *format, guint64 *amount, gdouble *rate, gboolean *flush, gboolean *intermediate); 1013 gst_event_parse_step(gstEvent, &format, &amount, &rate, &flush, &intermediate); 1014 } 1015 1016 /** 1017 * Create a new sink-message event. The purpose of the sink-message event is 1018 * to instruct a sink to post the message contained in the event synchronized 1019 * with the stream. 1020 * name is used to store multiple sticky events on one pad. 1021 * Params: 1022 * name = a name for the event 1023 * msg = the GstMessage to be posted. [transfer none] 1024 * Throws: ConstructionException GTK+ fails to create the object. 1025 */ 1026 public this (string name, Message msg) 1027 { 1028 // GstEvent * gst_event_new_sink_message (const gchar *name, GstMessage *msg); 1029 auto p = gst_event_new_sink_message(Str.toStringz(name), (msg is null) ? null : msg.getMessageStruct()); 1030 if(p is null) 1031 { 1032 throw new ConstructionException("null returned by gst_event_new_sink_message(Str.toStringz(name), (msg is null) ? null : msg.getMessageStruct())"); 1033 } 1034 this(cast(GstEvent*) p); 1035 } 1036 1037 /** 1038 * Parse the sink-message event. Unref msg after usage. 1039 * Params: 1040 * msg = a pointer to store the GstMessage in. [out][transfer full] 1041 */ 1042 public void parseSinkMessage(out Message msg) 1043 { 1044 // void gst_event_parse_sink_message (GstEvent *event, GstMessage **msg); 1045 GstMessage* outmsg = null; 1046 1047 gst_event_parse_sink_message(gstEvent, &outmsg); 1048 1049 msg = ObjectG.getDObject!(Message)(outmsg); 1050 } 1051 1052 /** 1053 * Create a new reconfigure event. The purpose of the reconfingure event is 1054 * to travel upstream and make elements renegotiate their caps or reconfigure 1055 * their buffer pools. This is useful when changing properties on elements 1056 * or changing the topology of the pipeline. 1057 * Throws: ConstructionException GTK+ fails to create the object. 1058 */ 1059 public this () 1060 { 1061 // GstEvent * gst_event_new_reconfigure (void); 1062 auto p = gst_event_new_reconfigure(); 1063 if(p is null) 1064 { 1065 throw new ConstructionException("null returned by gst_event_new_reconfigure()"); 1066 } 1067 this(cast(GstEvent*) p); 1068 } 1069 1070 /** 1071 * Create a new CAPS event for caps. The caps event can only travel downstream 1072 * synchronized with the buffer flow and contains the format of the buffers 1073 * that will follow after the event. 1074 * Params: 1075 * caps = a GstCaps. [transfer none] 1076 * Throws: ConstructionException GTK+ fails to create the object. 1077 */ 1078 public this (Caps caps) 1079 { 1080 // GstEvent * gst_event_new_caps (GstCaps *caps); 1081 auto p = gst_event_new_caps((caps is null) ? null : caps.getCapsStruct()); 1082 if(p is null) 1083 { 1084 throw new ConstructionException("null returned by gst_event_new_caps((caps is null) ? null : caps.getCapsStruct())"); 1085 } 1086 this(cast(GstEvent*) p); 1087 } 1088 1089 /** 1090 * Get the caps from event. The caps remains valid as long as event remains 1091 * valid. 1092 * Params: 1093 * caps = A pointer to the caps. [out][transfer none] 1094 */ 1095 public void parseCaps(out Caps caps) 1096 { 1097 // void gst_event_parse_caps (GstEvent *event, GstCaps **caps); 1098 GstCaps* outcaps = null; 1099 1100 gst_event_parse_caps(gstEvent, &outcaps); 1101 1102 caps = ObjectG.getDObject!(Caps)(outcaps); 1103 } 1104 1105 /** 1106 * Generate a TOC event from the given toc. The purpose of the TOC event is to 1107 * inform elements that some kind of the TOC was found. 1108 * Params: 1109 * toc = GstToc structure. [transfer none] 1110 * updated = whether toc was updated or not. 1111 * Throws: ConstructionException GTK+ fails to create the object. 1112 */ 1113 public this (Toc toc, int updated) 1114 { 1115 // GstEvent * gst_event_new_toc (GstToc *toc, gboolean updated); 1116 auto p = gst_event_new_toc((toc is null) ? null : toc.getTocStruct(), updated); 1117 if(p is null) 1118 { 1119 throw new ConstructionException("null returned by gst_event_new_toc((toc is null) ? null : toc.getTocStruct(), updated)"); 1120 } 1121 this(cast(GstEvent*) p); 1122 } 1123 1124 /** 1125 * Parse a TOC event and store the results in the given toc and updated locations. 1126 * Params: 1127 * toc = pointer to GstToc structure. [out][transfer full] 1128 * updated = pointer to store TOC updated flag. [out] 1129 */ 1130 public void parseToc(out Toc toc, out int updated) 1131 { 1132 // void gst_event_parse_toc (GstEvent *event, GstToc **toc, gboolean *updated); 1133 GstToc* outtoc = null; 1134 1135 gst_event_parse_toc(gstEvent, &outtoc, &updated); 1136 1137 toc = ObjectG.getDObject!(Toc)(outtoc); 1138 } 1139 1140 /** 1141 * Parse a TOC select event and store the results in the given uid location. 1142 * Params: 1143 * uid = storage for the selection UID. [out] 1144 */ 1145 public void parseTocSelect(out string uid) 1146 { 1147 // void gst_event_parse_toc_select (GstEvent *event, gchar **uid); 1148 char* outuid = null; 1149 1150 gst_event_parse_toc_select(gstEvent, &outuid); 1151 1152 uid = Str.toString(outuid); 1153 } 1154 1155 /** 1156 * Create a new segment-done event. This event is sent by elements that 1157 * finish playback of a segment as a result of a segment seek. 1158 * Params: 1159 * format = The format of the position being done 1160 * position = The position of the segment being done 1161 * Throws: ConstructionException GTK+ fails to create the object. 1162 */ 1163 public this (GstFormat format, long position) 1164 { 1165 // GstEvent * gst_event_new_segment_done (GstFormat format, gint64 position); 1166 auto p = gst_event_new_segment_done(format, position); 1167 if(p is null) 1168 { 1169 throw new ConstructionException("null returned by gst_event_new_segment_done(format, position)"); 1170 } 1171 this(cast(GstEvent*) p); 1172 } 1173 1174 /** 1175 * Extracts the position and format from the segment done message. 1176 * Params: 1177 * format = Result location for the format, or NULL. [out][allow-none] 1178 * position = Result location for the position, or NULL. [out][allow-none] 1179 */ 1180 public void parseSegmentDone(out GstFormat format, out long position) 1181 { 1182 // void gst_event_parse_segment_done (GstEvent *event, GstFormat *format, gint64 *position); 1183 gst_event_parse_segment_done(gstEvent, &format, &position); 1184 } 1185 }