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.Message; 26 27 private import glib.ConstructionException; 28 private import glib.ErrorG; 29 private import glib.Str; 30 private import gobject.ObjectG; 31 private import gobject.Value; 32 private import gstreamer.Clock; 33 private import gstreamer.Context; 34 private import gstreamer.Device; 35 private import gstreamer.Element; 36 private import gstreamer.ObjectGst; 37 private import gstreamer.Structure; 38 private import gstreamer.TagList; 39 private import gstreamer.Toc; 40 private import gstreamerc.gstreamer; 41 public import gstreamerc.gstreamertypes; 42 43 44 /** 45 * Messages are implemented as a subclass of #GstMiniObject with a generic 46 * #GstStructure as the content. This allows for writing custom messages without 47 * requiring an API change while allowing a wide range of different types 48 * of messages. 49 * 50 * Messages are posted by objects in the pipeline and are passed to the 51 * application using the #GstBus. 52 * 53 * The basic use pattern of posting a message on a #GstBus is as follows: 54 * |[ 55 * gst_bus_post (bus, gst_message_new_eos()); 56 * ]| 57 * 58 * A #GstElement usually posts messages on the bus provided by the parent 59 * container using gst_element_post_message(). 60 */ 61 public class Message 62 { 63 /** the main Gtk struct */ 64 protected GstMessage* gstMessage; 65 66 /** Get the main Gtk struct */ 67 public GstMessage* getMessageStruct() 68 { 69 return gstMessage; 70 } 71 72 /** the main Gtk struct as a void* */ 73 protected void* getStruct() 74 { 75 return cast(void*)gstMessage; 76 } 77 78 /** 79 * Sets our main struct and passes it to the parent class. 80 */ 81 public this (GstMessage* gstMessage) 82 { 83 this.gstMessage = gstMessage; 84 } 85 86 /** 87 * Get the type of the message. 88 */ 89 public GstMessageType type() 90 { 91 return cast(GstMessageType)getMessageStruct().type; 92 } 93 94 /** 95 * Get the src (the element that originated the message) of the message. 96 */ 97 public ObjectGst src() 98 { 99 return new ObjectGst( cast(GstObject*)getMessageStruct().src ); 100 } 101 102 /** 103 * Create a new element-specific message. This is meant as a generic way of 104 * allowing one-way communication from an element to an application, for example 105 * "the firewire cable was unplugged". The format of the message should be 106 * documented in the element's documentation. The structure field can be NULL. 107 * MT safe. 108 * Params: 109 * src = The object originating the message. 110 * structure = The structure for the message. The message will take ownership of 111 * the structure. 112 * Returns: 113 * The new element message. 114 */ 115 public static Message newElement(ObjectGst src, Structure structure) 116 { 117 // GstMessage* gst_message_new_element (GstObject *src, GstStructure *structure); 118 auto p = gst_message_new_element((src is null) ? null : src.getObjectGstStruct(), (structure is null) ? null : structure.getStructureStruct()); 119 120 if(p is null) 121 { 122 throw new ConstructionException("null returned by gst_message_new_element"); 123 } 124 125 return new Message(cast(GstMessage*)p); //, true); 126 } 127 128 /** 129 * Create a new clock message. This message is posted whenever the 130 * pipeline selectes a new clock for the pipeline. 131 * MT safe. 132 * Params: 133 * src = The object originating the message. 134 * clock = the new selected clock 135 * Returns: 136 * The new new clock message. 137 */ 138 public static Message newNewClock(ObjectGst src, Clock clock) 139 { 140 // GstMessage* gst_message_new_new_clock (GstObject *src, GstClock *clock); 141 auto p = gst_message_new_new_clock((src is null) ? null : src.getObjectGstStruct(), (clock is null) ? null : clock.getClockStruct()); 142 143 if(p is null) 144 { 145 throw new ConstructionException("null returned by gst_message_new_new_clock"); 146 } 147 148 return new Message(cast(GstMessage*)p); //, true); 149 } 150 151 /** 152 * Create a new segment done message. This message is posted by elements that 153 * finish playback of a segment as a result of a segment seek. This message 154 * is received by the application after all elements that posted a segment_start 155 * have posted the segment_done. 156 * MT safe. 157 * Params: 158 * src = The object originating the message. 159 * format = The format of the position being done 160 * position = The position of the segment being done 161 * Returns: 162 * The new segment done message. 163 */ 164 public static Message newSegmentDone(ObjectGst src, GstFormat format, long position) 165 { 166 // GstMessage* gst_message_new_segment_done (GstObject *src, GstFormat format, gint64 position); 167 auto p = gst_message_new_segment_done((src is null) ? null : src.getObjectGstStruct(), format, position); 168 169 if(p is null) 170 { 171 throw new ConstructionException("null returned by gst_message_new_segment_done"); 172 } 173 174 return new Message(cast(GstMessage*)p); //, true); 175 } 176 177 /** 178 * Create a new segment message. This message is posted by elements that 179 * start playback of a segment as a result of a segment seek. This message 180 * is not received by the application but is used for maintenance reasons in 181 * container elements. 182 * MT safe. 183 * Params: 184 * src = The object originating the message. 185 * format = The format of the position being played 186 * position = The position of the segment being played 187 * Returns: 188 * The new segment start message. 189 */ 190 public static Message newSegmentStart(ObjectGst src, GstFormat format, long position) 191 { 192 // GstMessage* gst_message_new_segment_start (GstObject *src, GstFormat format, gint64 position); 193 auto p = gst_message_new_segment_start((src is null) ? null : src.getObjectGstStruct(), format, position); 194 195 if(p is null) 196 { 197 throw new ConstructionException("null returned by gst_message_new_segment_start"); 198 } 199 200 return new Message(cast(GstMessage*)p); //, true); 201 } 202 203 /** 204 * Create a new warning message. The message will make copies of error and 205 * debug. 206 * MT safe. 207 * Params: 208 * src = The object originating the message. 209 * error = The GError for this message. 210 * debug = A debugging string for something or other. 211 * Returns: 212 * The new warning message. 213 */ 214 public static Message newWarning(ObjectGst src, ErrorG error, string dbug) 215 { 216 // GstMessage* gst_message_new_warning (GstObject *src, GError *error, gchar *debug); 217 auto p = gst_message_new_warning((src is null) ? null : src.getObjectGstStruct(), (error is null) ? null : error.getErrorGStruct(), Str.toStringz(dbug)); 218 219 if(p is null) 220 { 221 throw new ConstructionException("null returned by gst_message_new_warning"); 222 } 223 224 return new Message(cast(GstMessage*)p); //, true); 225 } 226 227 /** 228 * Create a state dirty message. This message is posted whenever an element 229 * changed its state asynchronously and is used internally to update the 230 * states of container objects. 231 * MT safe. 232 * Params: 233 * src = the object originating the message 234 * Returns: 235 * The new state dirty message. 236 */ 237 public static Message newStateDirty(ObjectGst src) 238 { 239 // GstMessage* gst_message_new_state_dirty (GstObject *src); 240 auto p = gst_message_new_state_dirty((src is null) ? null : src.getObjectGstStruct()); 241 242 if(p is null) 243 { 244 throw new ConstructionException("null returned by gst_message_new_state_dirty"); 245 } 246 247 return new Message(cast(GstMessage*)p); //, true); 248 } 249 250 /** 251 * Create a new eos message. This message is generated and posted in 252 * the sink elements of a GstBin. The bin will only forward the EOS 253 * message to the application if all sinks have posted an EOS message. 254 * MT safe. 255 * Params: 256 * src = The object originating the message. 257 * Returns: 258 * The new eos message. 259 */ 260 public static Message newEOS(ObjectGst src) 261 { 262 // GstMessage* gst_message_new_eos (GstObject *src); 263 auto p = gst_message_new_eos((src is null) ? null : src.getObjectGstStruct()); 264 265 if(p is null) 266 { 267 throw new ConstructionException("null returned by gst_message_new_eos"); 268 } 269 270 return new Message(cast(GstMessage*)p); //, true); 271 } 272 273 /** 274 * Create a new error message. The message will copy error and 275 * debug. This message is posted by element when a fatal event 276 * occured. The pipeline will probably (partially) stop. The application 277 * receiving this message should stop the pipeline. 278 * MT safe. 279 * Params: 280 * src = The object originating the message. 281 * error = The GError for this message. 282 * debug = A debugging string for something or other. 283 * Returns: 284 * The new error message. 285 */ 286 public static Message newError(ObjectGst src, ErrorG error, string dbug) 287 { 288 // GstMessage* gst_message_new_error (GstObject *src, GError *error, gchar *debug); 289 auto p = gst_message_new_error((src is null) ? null : src.getObjectGstStruct(), (error is null) ? null : error.getErrorGStruct(), Str.toStringz(dbug)); 290 291 if(p is null) 292 { 293 throw new ConstructionException("null returned by gst_message_new_error"); 294 } 295 296 return new Message(cast(GstMessage*)p); //, true); 297 } 298 299 /** 300 * Create a new info message. The message will make copies of error and 301 * debug. 302 * MT safe. 303 * Since 0.10.12 304 * Params: 305 * src = The object originating the message. 306 * error = The GError for this message. 307 * debug = A debugging string for something or other. 308 * Returns: 309 * The new info message. 310 */ 311 public static Message newInfo(ObjectGst src, ErrorG error, string dbug) 312 { 313 // GstMessage* gst_message_new_info (GstObject *src, GError *error, gchar *debug); 314 auto p = gst_message_new_info((src is null) ? null : src.getObjectGstStruct(), (error is null) ? null : error.getErrorGStruct(), Str.toStringz(dbug)); 315 316 if(p is null) 317 { 318 throw new ConstructionException("null returned by gst_message_new_info"); 319 } 320 321 return new Message(cast(GstMessage*)p); //, true); 322 } 323 324 /** 325 * This message can be posted by elements when their latency requirements 326 * have changed. 327 * Params: 328 * src = The object originating the message. 329 * Returns: 330 * The new latency message. MT safe. 331 */ 332 public static Message newLatency(ObjectGst src) 333 { 334 // GstMessage* gst_message_new_latency (GstObject *src); 335 auto p = gst_message_new_latency((src is null) ? null : src.getObjectGstStruct()); 336 337 if(p is null) 338 { 339 throw new ConstructionException("null returned by gst_message_new_latency"); 340 } 341 342 return new Message(cast(GstMessage*)p); //, true); 343 } 344 345 /** 346 * Create a new duration changed message. This message is posted by elements 347 * that know the duration of a stream when the duration changes. This message 348 * is received by bins and is used to calculate the total duration of a 349 * pipeline. Elements may post a duration message with a duration of 350 * GST_CLOCK_TIME_NONE to indicate that the duration has changed and the 351 * cached duration should be discarded. The new duration can then be 352 * retrieved via a query. 353 * Params: 354 * src = The object originating the message. [transfer none] 355 * Throws: ConstructionException GTK+ fails to create the object. 356 */ 357 public static Message newDurationChanged(ObjectGst src) 358 { 359 // GstMessage * gst_message_new_duration_changed (GstObject *src); 360 auto p = gst_message_new_duration_changed((src is null) ? null : src.getObjectGstStruct()); 361 362 if(p is null) 363 { 364 throw new ConstructionException("null returned by gst_message_new_duration_changed((src is null) ? null : src.getObjectGstStruct())"); 365 } 366 367 return new Message(cast(GstMessage*)p); //, true); 368 } 369 370 /** 371 * This message is posted by elements when they start an ASYNC state change. 372 * Params: 373 * src = The object originating the message. [transfer none] 374 * Throws: ConstructionException GTK+ fails to create the object. 375 */ 376 public static Message newAsyncStart(ObjectGst src) 377 { 378 // GstMessage * gst_message_new_async_start (GstObject *src); 379 auto p = gst_message_new_async_start((src is null) ? null : src.getObjectGstStruct()); 380 if(p is null) 381 { 382 throw new ConstructionException("null returned by gst_message_new_async_start((src is null) ? null : src.getObjectGstStruct())"); 383 } 384 return new Message(cast(GstMessage*)p); //, true); 385 } 386 387 /** 388 * The message is posted when elements completed an ASYNC state change. 389 * running_time contains the time of the desired running_time when this 390 * elements goes to PLAYING. A value of GST_CLOCK_TIME_NONE for running_time 391 * means that the element has no clock interaction and thus doesn't care about 392 * the running_time of the pipeline. 393 * Params: 394 * src = The object originating the message. [transfer none] 395 * runningTime = the desired running_time 396 * Throws: ConstructionException GTK+ fails to create the object. 397 */ 398 public static Message newAsyncDone(ObjectGst src, GstClockTime runningTime) 399 { 400 // GstMessage * gst_message_new_async_done (GstObject *src, GstClockTime running_time); 401 auto p = gst_message_new_async_done((src is null) ? null : src.getObjectGstStruct(), runningTime); 402 if(p is null) 403 { 404 throw new ConstructionException("null returned by gst_message_new_async_done((src is null) ? null : src.getObjectGstStruct(), runningTime)"); 405 } 406 return new Message(cast(GstMessage*)p); //, true); 407 } 408 409 /** 410 * Creates a new device-added message. The device-added message is produced by 411 * #GstDeviceProvider or a #GstDeviceMonitor. They announce the appearance 412 * of monitored devices. 413 * 414 * Params: 415 * src = The #GstObject that created the message 416 * device = The new #GstDevice 417 * 418 * Return: a newly allocated #GstMessage 419 * 420 * Since: 1.4 421 * 422 * Throws: ConstructionException GTK+ fails to create the object. 423 */ 424 public static Message newDeviceAdded(ObjectGst src, Device device) 425 { 426 auto p = gst_message_new_device_added((src is null) ? null : src.getObjectGstStruct(), (device is null) ? null : device.getDeviceStruct()); 427 428 if(p is null) 429 { 430 throw new ConstructionException("null returned by new_device_added"); 431 } 432 433 return new Message(cast(GstMessage*)p); //, true); 434 } 435 436 /** 437 * Creates a new device-removed message. The device-removed message is produced 438 * by #GstDeviceProvider or a #GstDeviceMonitor. They announce the 439 * disappearance of monitored devices. 440 * 441 * Params: 442 * src = The #GstObject that created the message 443 * device = The removed #GstDevice 444 * 445 * Return: a newly allocated #GstMessage 446 * 447 * Since: 1.4 448 * 449 * Throws: ConstructionException GTK+ fails to create the object. 450 */ 451 public static Message newDeviceRemoved(ObjectGst src, Device device) 452 { 453 auto p = gst_message_new_device_removed((src is null) ? null : src.getObjectGstStruct(), (device is null) ? null : device.getDeviceStruct()); 454 455 if(p is null) 456 { 457 throw new ConstructionException("null returned by new_device_removed"); 458 } 459 460 return new Message(cast(GstMessage*)p); //, true); 461 } 462 463 /** 464 */ 465 466 /** */ 467 public static GType getType() 468 { 469 return gst_message_get_type(); 470 } 471 472 /** 473 * Create a new application-typed message. GStreamer will never create these 474 * messages; they are a gift from us to you. Enjoy. 475 * 476 * Params: 477 * src = The object originating the message. 478 * structure = the structure for the message. The message 479 * will take ownership of the structure. 480 * 481 * Return: The new application message. 482 * 483 * MT safe. 484 * 485 * Throws: ConstructionException GTK+ fails to create the object. 486 */ 487 public this(ObjectGst src, Structure structure) 488 { 489 auto p = gst_message_new_application((src is null) ? null : src.getObjectGstStruct(), (structure is null) ? null : structure.getStructureStruct()); 490 491 if(p is null) 492 { 493 throw new ConstructionException("null returned by new_application"); 494 } 495 496 this(cast(GstMessage*) p); 497 } 498 499 /** 500 * The message is posted when elements completed an ASYNC state change. 501 * @running_time contains the time of the desired running_time when this 502 * elements goes to PLAYING. A value of #GST_CLOCK_TIME_NONE for @running_time 503 * means that the element has no clock interaction and thus doesn't care about 504 * the running_time of the pipeline. 505 * 506 * Params: 507 * src = The object originating the message. 508 * runningTime = the desired running_time 509 * 510 * Return: The new async_done message. 511 * 512 * MT safe. 513 * 514 * Throws: ConstructionException GTK+ fails to create the object. 515 */ 516 public this(ObjectGst src, GstClockTime runningTime) 517 { 518 auto p = gst_message_new_async_done((src is null) ? null : src.getObjectGstStruct(), runningTime); 519 520 if(p is null) 521 { 522 throw new ConstructionException("null returned by new_async_done"); 523 } 524 525 this(cast(GstMessage*) p); 526 } 527 528 /** 529 * Create a new buffering message. This message can be posted by an element that 530 * needs to buffer data before it can continue processing. @percent should be a 531 * value between 0 and 100. A value of 100 means that the buffering completed. 532 * 533 * When @percent is < 100 the application should PAUSE a PLAYING pipeline. When 534 * @percent is 100, the application can set the pipeline (back) to PLAYING. 535 * The application must be prepared to receive BUFFERING messages in the 536 * PREROLLING state and may only set the pipeline to PLAYING after receiving a 537 * message with @percent set to 100, which can happen after the pipeline 538 * completed prerolling. 539 * 540 * MT safe. 541 * 542 * Params: 543 * src = The object originating the message. 544 * percent = The buffering percent 545 * 546 * Return: The new buffering message. 547 * 548 * Throws: ConstructionException GTK+ fails to create the object. 549 */ 550 public this(ObjectGst src, int percent) 551 { 552 auto p = gst_message_new_buffering((src is null) ? null : src.getObjectGstStruct(), percent); 553 554 if(p is null) 555 { 556 throw new ConstructionException("null returned by new_buffering"); 557 } 558 559 this(cast(GstMessage*) p); 560 } 561 562 /** 563 * Create a clock lost message. This message is posted whenever the 564 * clock is not valid anymore. 565 * 566 * If this message is posted by the pipeline, the pipeline will 567 * select a new clock again when it goes to PLAYING. It might therefore 568 * be needed to set the pipeline to PAUSED and PLAYING again. 569 * 570 * Params: 571 * src = The object originating the message. 572 * clock = the clock that was lost 573 * 574 * Return: The new clock lost message. 575 * 576 * MT safe. 577 * 578 * Throws: ConstructionException GTK+ fails to create the object. 579 */ 580 public this(ObjectGst src, Clock clock) 581 { 582 auto p = gst_message_new_clock_lost((src is null) ? null : src.getObjectGstStruct(), (clock is null) ? null : clock.getClockStruct()); 583 584 if(p is null) 585 { 586 throw new ConstructionException("null returned by new_clock_lost"); 587 } 588 589 this(cast(GstMessage*) p); 590 } 591 592 /** 593 * Create a clock provide message. This message is posted whenever an 594 * element is ready to provide a clock or lost its ability to provide 595 * a clock (maybe because it paused or became EOS). 596 * 597 * This message is mainly used internally to manage the clock 598 * selection. 599 * 600 * Params: 601 * src = The object originating the message. 602 * clock = the clock it provides 603 * ready = %TRUE if the sender can provide a clock 604 * 605 * Return: the new provide clock message. 606 * 607 * MT safe. 608 * 609 * Throws: ConstructionException GTK+ fails to create the object. 610 */ 611 public this(ObjectGst src, Clock clock, bool ready) 612 { 613 auto p = gst_message_new_clock_provide((src is null) ? null : src.getObjectGstStruct(), (clock is null) ? null : clock.getClockStruct(), ready); 614 615 if(p is null) 616 { 617 throw new ConstructionException("null returned by new_clock_provide"); 618 } 619 620 this(cast(GstMessage*) p); 621 } 622 623 /** 624 * Create a new custom-typed message. This can be used for anything not 625 * handled by other message-specific functions to pass a message to the 626 * app. The structure field can be %NULL. 627 * 628 * Params: 629 * type = The #GstMessageType to distinguish messages 630 * src = The object originating the message. 631 * structure = the structure for the 632 * message. The message will take ownership of the structure. 633 * 634 * Return: The new message. 635 * 636 * MT safe. 637 * 638 * Throws: ConstructionException GTK+ fails to create the object. 639 */ 640 public this(GstMessageType type, ObjectGst src, Structure structure) 641 { 642 auto p = gst_message_new_custom(type, (src is null) ? null : src.getObjectGstStruct(), (structure is null) ? null : structure.getStructureStruct()); 643 644 if(p is null) 645 { 646 throw new ConstructionException("null returned by new_custom"); 647 } 648 649 this(cast(GstMessage*) p); 650 } 651 652 /** 653 * This message is posted when an element has a new local #GstContext. 654 * 655 * Params: 656 * src = The object originating the message. 657 * context = the context 658 * 659 * Return: The new have-context message. 660 * 661 * MT safe. 662 * 663 * Since: 1.2 664 * 665 * Throws: ConstructionException GTK+ fails to create the object. 666 */ 667 public this(ObjectGst src, Context context) 668 { 669 auto p = gst_message_new_have_context((src is null) ? null : src.getObjectGstStruct(), (context is null) ? null : context.getContextStruct()); 670 671 if(p is null) 672 { 673 throw new ConstructionException("null returned by new_have_context"); 674 } 675 676 this(cast(GstMessage*) p); 677 } 678 679 /** 680 * This message is posted when an element needs a specific #GstContext. 681 * 682 * Params: 683 * src = The object originating the message. 684 * contextType = The context type that is needed 685 * 686 * Return: The new need-context message. 687 * 688 * MT safe. 689 * 690 * Since: 1.2 691 * 692 * Throws: ConstructionException GTK+ fails to create the object. 693 */ 694 public this(ObjectGst src, string contextType) 695 { 696 auto p = gst_message_new_need_context((src is null) ? null : src.getObjectGstStruct(), Str.toStringz(contextType)); 697 698 if(p is null) 699 { 700 throw new ConstructionException("null returned by new_need_context"); 701 } 702 703 this(cast(GstMessage*) p); 704 } 705 706 /** 707 * Progress messages are posted by elements when they use an asynchronous task 708 * to perform actions triggered by a state change. 709 * 710 * @code contains a well defined string describing the action. 711 * @test should contain a user visible string detailing the current action. 712 * 713 * Params: 714 * src = The object originating the message. 715 * type = a #GstProgressType 716 * code = a progress code 717 * text = free, user visible text describing the progress 718 * 719 * Return: The new qos message. 720 * 721 * Throws: ConstructionException GTK+ fails to create the object. 722 */ 723 public this(ObjectGst src, GstProgressType type, string code, string text) 724 { 725 auto p = gst_message_new_progress((src is null) ? null : src.getObjectGstStruct(), type, Str.toStringz(code), Str.toStringz(text)); 726 727 if(p is null) 728 { 729 throw new ConstructionException("null returned by new_progress"); 730 } 731 732 this(cast(GstMessage*) p); 733 } 734 735 /** 736 * A QOS message is posted on the bus whenever an element decides to drop a 737 * buffer because of QoS reasons or whenever it changes its processing strategy 738 * because of QoS reasons (quality adjustments such as processing at lower 739 * accuracy). 740 * 741 * This message can be posted by an element that performs synchronisation against the 742 * clock (live) or it could be dropped by an element that performs QoS because of QOS 743 * events received from a downstream element (!live). 744 * 745 * @running_time, @stream_time, @timestamp, @duration should be set to the 746 * respective running-time, stream-time, timestamp and duration of the (dropped) 747 * buffer that generated the QoS event. Values can be left to 748 * GST_CLOCK_TIME_NONE when unknown. 749 * 750 * Params: 751 * src = The object originating the message. 752 * live = if the message was generated by a live element 753 * runningTime = the running time of the buffer that generated the message 754 * streamTime = the stream time of the buffer that generated the message 755 * timestamp = the timestamps of the buffer that generated the message 756 * duration = the duration of the buffer that generated the message 757 * 758 * Return: The new qos message. 759 * 760 * MT safe. 761 * 762 * Throws: ConstructionException GTK+ fails to create the object. 763 */ 764 public this(ObjectGst src, bool live, ulong runningTime, ulong streamTime, ulong timestamp, ulong duration) 765 { 766 auto p = gst_message_new_qos((src is null) ? null : src.getObjectGstStruct(), live, runningTime, streamTime, timestamp, duration); 767 768 if(p is null) 769 { 770 throw new ConstructionException("null returned by new_qos"); 771 } 772 773 this(cast(GstMessage*) p); 774 } 775 776 /** 777 * This message can be posted by elements when they want to have their state 778 * changed. A typical use case would be an audio server that wants to pause the 779 * pipeline because a higher priority stream is being played. 780 * 781 * Params: 782 * src = The object originating the message. 783 * state = The new requested state 784 * 785 * Return: the new request state message. 786 * 787 * MT safe. 788 * 789 * Throws: ConstructionException GTK+ fails to create the object. 790 */ 791 public this(ObjectGst src, GstState state) 792 { 793 auto p = gst_message_new_request_state((src is null) ? null : src.getObjectGstStruct(), state); 794 795 if(p is null) 796 { 797 throw new ConstructionException("null returned by new_request_state"); 798 } 799 800 this(cast(GstMessage*) p); 801 } 802 803 /** 804 * Create a state change message. This message is posted whenever an element 805 * changed its state. 806 * 807 * Params: 808 * src = The object originating the message. 809 * oldstate = the previous state 810 * newstate = the new (current) state 811 * pending = the pending (target) state 812 * 813 * Return: the new state change message. 814 * 815 * MT safe. 816 * 817 * Throws: ConstructionException GTK+ fails to create the object. 818 */ 819 public this(ObjectGst src, GstState oldstate, GstState newstate, GstState pending) 820 { 821 auto p = gst_message_new_state_changed((src is null) ? null : src.getObjectGstStruct(), oldstate, newstate, pending); 822 823 if(p is null) 824 { 825 throw new ConstructionException("null returned by new_state_changed"); 826 } 827 828 this(cast(GstMessage*) p); 829 } 830 831 /** 832 * This message is posted by elements when they complete a part, when @intermediate set 833 * to %TRUE, or a complete step operation. 834 * 835 * @duration will contain the amount of time (in GST_FORMAT_TIME) of the stepped 836 * @amount of media in format @format. 837 * 838 * Params: 839 * src = The object originating the message. 840 * format = the format of @amount 841 * amount = the amount of stepped data 842 * rate = the rate of the stepped amount 843 * flush = is this an flushing step 844 * intermediate = is this an intermediate step 845 * duration = the duration of the data 846 * eos = the step caused EOS 847 * 848 * Return: the new step_done message. 849 * 850 * MT safe. 851 * 852 * Throws: ConstructionException GTK+ fails to create the object. 853 */ 854 public this(ObjectGst src, GstFormat format, ulong amount, double rate, bool flush, bool intermediate, ulong duration, bool eos) 855 { 856 auto p = gst_message_new_step_done((src is null) ? null : src.getObjectGstStruct(), format, amount, rate, flush, intermediate, duration, eos); 857 858 if(p is null) 859 { 860 throw new ConstructionException("null returned by new_step_done"); 861 } 862 863 this(cast(GstMessage*) p); 864 } 865 866 /** 867 * This message is posted by elements when they accept or activate a new step 868 * event for @amount in @format. 869 * 870 * @active is set to %FALSE when the element accepted the new step event and has 871 * queued it for execution in the streaming threads. 872 * 873 * @active is set to %TRUE when the element has activated the step operation and 874 * is now ready to start executing the step in the streaming thread. After this 875 * message is emitted, the application can queue a new step operation in the 876 * element. 877 * 878 * Params: 879 * src = The object originating the message. 880 * active = if the step is active or queued 881 * format = the format of @amount 882 * amount = the amount of stepped data 883 * rate = the rate of the stepped amount 884 * flush = is this an flushing step 885 * intermediate = is this an intermediate step 886 * 887 * Return: The new step_start message. 888 * 889 * MT safe. 890 * 891 * Throws: ConstructionException GTK+ fails to create the object. 892 */ 893 public this(ObjectGst src, bool active, GstFormat format, ulong amount, double rate, bool flush, bool intermediate) 894 { 895 auto p = gst_message_new_step_start((src is null) ? null : src.getObjectGstStruct(), active, format, amount, rate, flush, intermediate); 896 897 if(p is null) 898 { 899 throw new ConstructionException("null returned by new_step_start"); 900 } 901 902 this(cast(GstMessage*) p); 903 } 904 905 /** 906 * Create a new stream_start message. This message is generated and posted in 907 * the sink elements of a GstBin. The bin will only forward the STREAM_START 908 * message to the application if all sinks have posted an STREAM_START message. 909 * 910 * Params: 911 * src = The object originating the message. 912 * 913 * Return: The new stream_start message. 914 * 915 * MT safe. 916 * 917 * Throws: ConstructionException GTK+ fails to create the object. 918 */ 919 public this(ObjectGst src) 920 { 921 auto p = gst_message_new_stream_start((src is null) ? null : src.getObjectGstStruct()); 922 923 if(p is null) 924 { 925 throw new ConstructionException("null returned by new_stream_start"); 926 } 927 928 this(cast(GstMessage*) p); 929 } 930 931 /** 932 * Create a new stream status message. This message is posted when a streaming 933 * thread is created/destroyed or when the state changed. 934 * 935 * Params: 936 * src = The object originating the message. 937 * type = The stream status type. 938 * owner = the owner element of @src. 939 * 940 * Return: the new stream status message. 941 * 942 * MT safe. 943 * 944 * Throws: ConstructionException GTK+ fails to create the object. 945 */ 946 public this(ObjectGst src, GstStreamStatusType type, Element owner) 947 { 948 auto p = gst_message_new_stream_status((src is null) ? null : src.getObjectGstStruct(), type, (owner is null) ? null : owner.getElementStruct()); 949 950 if(p is null) 951 { 952 throw new ConstructionException("null returned by new_stream_status"); 953 } 954 955 this(cast(GstMessage*) p); 956 } 957 958 /** 959 * Create a new structure change message. This message is posted when the 960 * structure of a pipeline is in the process of being changed, for example 961 * when pads are linked or unlinked. 962 * 963 * @src should be the sinkpad that unlinked or linked. 964 * 965 * Params: 966 * src = The object originating the message. 967 * type = The change type. 968 * owner = The owner element of @src. 969 * busy = Whether the structure change is busy. 970 * 971 * Return: the new structure change message. 972 * 973 * MT safe. 974 * 975 * Throws: ConstructionException GTK+ fails to create the object. 976 */ 977 public this(ObjectGst src, GstStructureChangeType type, Element owner, bool busy) 978 { 979 auto p = gst_message_new_structure_change((src is null) ? null : src.getObjectGstStruct(), type, (owner is null) ? null : owner.getElementStruct(), busy); 980 981 if(p is null) 982 { 983 throw new ConstructionException("null returned by new_structure_change"); 984 } 985 986 this(cast(GstMessage*) p); 987 } 988 989 /** 990 * Create a new tag message. The message will take ownership of the tag list. 991 * The message is posted by elements that discovered a new taglist. 992 * 993 * Params: 994 * src = The object originating the message. 995 * tagList = the tag list for the message. 996 * 997 * Return: the new tag message. 998 * 999 * MT safe. 1000 * 1001 * Throws: ConstructionException GTK+ fails to create the object. 1002 */ 1003 public this(ObjectGst src, TagList tagList) 1004 { 1005 auto p = gst_message_new_tag((src is null) ? null : src.getObjectGstStruct(), (tagList is null) ? null : tagList.getTagListStruct()); 1006 1007 if(p is null) 1008 { 1009 throw new ConstructionException("null returned by new_tag"); 1010 } 1011 1012 this(cast(GstMessage*) p); 1013 } 1014 1015 /** 1016 * Create a new TOC message. The message is posted by elements 1017 * that discovered or updated a TOC. 1018 * 1019 * Params: 1020 * src = the object originating the message. 1021 * toc = #GstToc structure for the message. 1022 * updated = whether TOC was updated or not. 1023 * 1024 * Return: a new TOC message. 1025 * 1026 * MT safe. 1027 * 1028 * Throws: ConstructionException GTK+ fails to create the object. 1029 */ 1030 public this(ObjectGst src, Toc toc, bool updated) 1031 { 1032 auto p = gst_message_new_toc((src is null) ? null : src.getObjectGstStruct(), (toc is null) ? null : toc.getTocStruct(), updated); 1033 1034 if(p is null) 1035 { 1036 throw new ConstructionException("null returned by new_toc"); 1037 } 1038 1039 this(cast(GstMessage*) p); 1040 } 1041 1042 /** 1043 * Retrieve the sequence number of a message. 1044 * 1045 * Messages have ever-incrementing sequence numbers, which may also be set 1046 * explicitly via gst_message_set_seqnum(). Sequence numbers are typically used 1047 * to indicate that a message corresponds to some other set of messages or 1048 * events, for example a SEGMENT_DONE message corresponding to a SEEK event. It 1049 * is considered good practice to make this correspondence when possible, though 1050 * it is not required. 1051 * 1052 * Note that events and messages share the same sequence number incrementor; 1053 * two events or messages will never have the same sequence number unless 1054 * that correspondence was made explicitly. 1055 * 1056 * Return: The message's sequence number. 1057 * 1058 * MT safe. 1059 */ 1060 public uint getSeqnum() 1061 { 1062 return gst_message_get_seqnum(gstMessage); 1063 } 1064 1065 /** 1066 * Extracts the object managing the streaming thread from @message. 1067 * 1068 * Return: a GValue containing the object that manages the streaming thread. 1069 * This object is usually of type GstTask but other types can be added in the 1070 * future. The object remains valid as long as @message is valid. 1071 */ 1072 public Value getStreamStatusObject() 1073 { 1074 auto p = gst_message_get_stream_status_object(gstMessage); 1075 1076 if(p is null) 1077 { 1078 return null; 1079 } 1080 1081 return ObjectG.getDObject!(Value)(cast(GValue*) p); 1082 } 1083 1084 /** 1085 * Access the structure of the message. 1086 * 1087 * Return: The structure of the message. The structure is 1088 * still owned by the message, which means that you should not free it and 1089 * that the pointer becomes invalid when you free the message. 1090 * 1091 * MT safe. 1092 */ 1093 public Structure getStructure() 1094 { 1095 auto p = gst_message_get_structure(gstMessage); 1096 1097 if(p is null) 1098 { 1099 return null; 1100 } 1101 1102 return ObjectG.getDObject!(Structure)(cast(GstStructure*) p); 1103 } 1104 1105 /** 1106 * Checks if @message has the given @name. This function is usually used to 1107 * check the name of a custom message. 1108 * 1109 * Params: 1110 * name = name to check 1111 * 1112 * Return: %TRUE if @name matches the name of the message structure. 1113 */ 1114 public bool hasName(string name) 1115 { 1116 return gst_message_has_name(gstMessage, Str.toStringz(name)) != 0; 1117 } 1118 1119 /** 1120 * Extract the running_time from the async_done message. 1121 * 1122 * MT safe. 1123 * 1124 * Params: 1125 * runningTime = Result location for the running_time or %NULL 1126 */ 1127 public void parseAsyncDone(out GstClockTime runningTime) 1128 { 1129 gst_message_parse_async_done(gstMessage, &runningTime); 1130 } 1131 1132 /** 1133 * Extracts the buffering percent from the GstMessage. see also 1134 * gst_message_new_buffering(). 1135 * 1136 * MT safe. 1137 * 1138 * Params: 1139 * percent = Return location for the percent. 1140 */ 1141 public void parseBuffering(out int percent) 1142 { 1143 gst_message_parse_buffering(gstMessage, &percent); 1144 } 1145 1146 /** 1147 * Extracts the buffering stats values from @message. 1148 * 1149 * Params: 1150 * mode = a buffering mode, or %NULL 1151 * avgIn = the average input rate, or %NULL 1152 * avgOut = the average output rate, or %NULL 1153 * bufferingLeft = amount of buffering time left in 1154 * milliseconds, or %NULL 1155 */ 1156 public void parseBufferingStats(out GstBufferingMode mode, out int avgIn, out int avgOut, out long bufferingLeft) 1157 { 1158 gst_message_parse_buffering_stats(gstMessage, &mode, &avgIn, &avgOut, &bufferingLeft); 1159 } 1160 1161 /** 1162 * Extracts the lost clock from the GstMessage. 1163 * The clock object returned remains valid until the message is freed. 1164 * 1165 * MT safe. 1166 * 1167 * Params: 1168 * clock = a pointer to hold the lost clock 1169 */ 1170 public void parseClockLost(out Clock clock) 1171 { 1172 GstClock* outclock = null; 1173 1174 gst_message_parse_clock_lost(gstMessage, &outclock); 1175 1176 clock = ObjectG.getDObject!(Clock)(outclock); 1177 } 1178 1179 /** 1180 * Extracts the clock and ready flag from the GstMessage. 1181 * The clock object returned remains valid until the message is freed. 1182 * 1183 * MT safe. 1184 * 1185 * Params: 1186 * clock = a pointer to hold a clock 1187 * object, or %NULL 1188 * ready = a pointer to hold the ready flag, or %NULL 1189 */ 1190 public void parseClockProvide(out Clock clock, out bool ready) 1191 { 1192 GstClock* outclock = null; 1193 int outready; 1194 1195 gst_message_parse_clock_provide(gstMessage, &outclock, &outready); 1196 1197 clock = ObjectG.getDObject!(Clock)(outclock); 1198 ready = (outready == 1); 1199 } 1200 1201 /** 1202 * Parse a context type from an existing GST_MESSAGE_NEED_CONTEXT message. 1203 * 1204 * Params: 1205 * contextType = the context type, or %NULL 1206 * 1207 * Return: a #gboolean indicating if the parsing succeeded. 1208 * 1209 * Since: 1.2 1210 */ 1211 public bool parseContextType(out string contextType) 1212 { 1213 char* outcontextType = null; 1214 1215 auto p = gst_message_parse_context_type(gstMessage, &outcontextType) != 0; 1216 1217 contextType = Str.toString(outcontextType); 1218 1219 return p; 1220 } 1221 1222 /** 1223 * Parses a device-added message. The device-added message is produced by 1224 * #GstDeviceProvider or a #GstDeviceMonitor. It announces the appearance 1225 * of monitored devices. 1226 * 1227 * Params: 1228 * device = A location where to store a 1229 * pointer to the new #GstDevice, or %NULL 1230 * 1231 * Since: 1.4 1232 */ 1233 public void parseDeviceAdded(out Device device) 1234 { 1235 GstDevice* outdevice = null; 1236 1237 gst_message_parse_device_added(gstMessage, &outdevice); 1238 1239 device = ObjectG.getDObject!(Device)(outdevice); 1240 } 1241 1242 /** 1243 * Parses a device-removed message. The device-removed message is produced by 1244 * #GstDeviceProvider or a #GstDeviceMonitor. It announces the 1245 * disappearance of monitored devices. 1246 * 1247 * Params: 1248 * device = A location where to store a 1249 * pointer to the removed #GstDevice, or %NULL 1250 * 1251 * Since: 1.4 1252 */ 1253 public void parseDeviceRemoved(out Device device) 1254 { 1255 GstDevice* outdevice = null; 1256 1257 gst_message_parse_device_removed(gstMessage, &outdevice); 1258 1259 device = ObjectG.getDObject!(Device)(outdevice); 1260 } 1261 1262 /** 1263 * Extracts the GError and debug string from the GstMessage. The values returned 1264 * in the output arguments are copies; the caller must free them when done. 1265 * 1266 * Typical usage of this function might be: 1267 * |[ 1268 * ... 1269 * switch (GST_MESSAGE_TYPE (msg)) { 1270 * case GST_MESSAGE_ERROR: { 1271 * GError *err = NULL; 1272 * gchar *dbg_info = NULL; 1273 * 1274 * gst_message_parse_error (msg, &err, &dbg_info); 1275 * g_printerr ("ERROR from element %s: %s\n", 1276 * GST_OBJECT_NAME (msg->src), err->message); 1277 * g_printerr ("Debugging info: %s\n", (dbg_info) ? dbg_info : "none"); 1278 * g_error_free (err); 1279 * g_free (dbg_info); 1280 * break; 1281 * } 1282 * ... 1283 * } 1284 * ... 1285 * ]| 1286 * 1287 * MT safe. 1288 * 1289 * Params: 1290 * gerror = location for the GError 1291 * dbg = location for the debug message, 1292 * or %NULL 1293 */ 1294 public void parseError(out ErrorG gerror, out string dbg) 1295 { 1296 GError* outgerror = null; 1297 char* outdbg = null; 1298 1299 gst_message_parse_error(gstMessage, &outgerror, &outdbg); 1300 1301 gerror = new ErrorG(outgerror); 1302 dbg = Str.toString(outdbg); 1303 } 1304 1305 /** 1306 * Extract the group from the STREAM_START message. 1307 * 1308 * Params: 1309 * groupId = Result location for the group id or 1310 * %NULL 1311 * 1312 * Return: %TRUE if the message had a group id set, %FALSE otherwise 1313 * 1314 * MT safe. 1315 * 1316 * Since: 1.2 1317 */ 1318 public bool parseGroupId(out uint groupId) 1319 { 1320 return gst_message_parse_group_id(gstMessage, &groupId) != 0; 1321 } 1322 1323 /** 1324 * Extract the context from the HAVE_CONTEXT message. 1325 * 1326 * MT safe. 1327 * 1328 * Params: 1329 * context = Result location for the 1330 * context or %NULL 1331 * 1332 * Since: 1.2 1333 */ 1334 public void parseHaveContext(out Context context) 1335 { 1336 GstContext* outcontext = null; 1337 1338 gst_message_parse_have_context(gstMessage, &outcontext); 1339 1340 context = ObjectG.getDObject!(Context)(outcontext); 1341 } 1342 1343 /** 1344 * Extracts the GError and debug string from the GstMessage. The values returned 1345 * in the output arguments are copies; the caller must free them when done. 1346 * 1347 * MT safe. 1348 * 1349 * Params: 1350 * gerror = location for the GError 1351 * dbg = location for the debug message, 1352 * or %NULL 1353 */ 1354 public void parseInfo(out ErrorG gerror, out string dbg) 1355 { 1356 GError* outgerror = null; 1357 char* outdbg = null; 1358 1359 gst_message_parse_info(gstMessage, &outgerror, &outdbg); 1360 1361 gerror = new ErrorG(outgerror); 1362 dbg = Str.toString(outdbg); 1363 } 1364 1365 /** 1366 * Extracts the new clock from the GstMessage. 1367 * The clock object returned remains valid until the message is freed. 1368 * 1369 * MT safe. 1370 * 1371 * Params: 1372 * clock = a pointer to hold the selected 1373 * new clock 1374 */ 1375 public void parseNewClock(out Clock clock) 1376 { 1377 GstClock* outclock = null; 1378 1379 gst_message_parse_new_clock(gstMessage, &outclock); 1380 1381 clock = ObjectG.getDObject!(Clock)(outclock); 1382 } 1383 1384 /** 1385 * Parses the progress @type, @code and @text. 1386 * 1387 * Params: 1388 * type = location for the type 1389 * code = location for the code 1390 * text = location for the text 1391 */ 1392 public void parseProgress(out GstProgressType type, out string code, out string text) 1393 { 1394 char* outcode = null; 1395 char* outtext = null; 1396 1397 gst_message_parse_progress(gstMessage, &type, &outcode, &outtext); 1398 1399 code = Str.toString(outcode); 1400 text = Str.toString(outtext); 1401 } 1402 1403 /** 1404 * Extract the timestamps and live status from the QoS message. 1405 * 1406 * The returned values give the running_time, stream_time, timestamp and 1407 * duration of the dropped buffer. Values of GST_CLOCK_TIME_NONE mean unknown 1408 * values. 1409 * 1410 * MT safe. 1411 * 1412 * Params: 1413 * live = if the message was generated by a live element 1414 * runningTime = the running time of the buffer that 1415 * generated the message 1416 * streamTime = the stream time of the buffer that 1417 * generated the message 1418 * timestamp = the timestamps of the buffer that 1419 * generated the message 1420 * duration = the duration of the buffer that 1421 * generated the message 1422 */ 1423 public void parseQos(out bool live, out ulong runningTime, out ulong streamTime, out ulong timestamp, out ulong duration) 1424 { 1425 int outlive; 1426 1427 gst_message_parse_qos(gstMessage, &outlive, &runningTime, &streamTime, ×tamp, &duration); 1428 1429 live = (outlive == 1); 1430 } 1431 1432 /** 1433 * Extract the QoS stats representing the history of the current continuous 1434 * pipeline playback period. 1435 * 1436 * When @format is @GST_FORMAT_UNDEFINED both @dropped and @processed are 1437 * invalid. Values of -1 for either @processed or @dropped mean unknown values. 1438 * 1439 * MT safe. 1440 * 1441 * Params: 1442 * format = Units of the 'processed' and 'dropped' fields. 1443 * Video sinks and video filters will use GST_FORMAT_BUFFERS (frames). 1444 * Audio sinks and audio filters will likely use GST_FORMAT_DEFAULT 1445 * (samples). 1446 * processed = Total number of units correctly processed 1447 * since the last state change to READY or a flushing operation. 1448 * dropped = Total number of units dropped since the last 1449 * state change to READY or a flushing operation. 1450 */ 1451 public void parseQosStats(out GstFormat format, out ulong processed, out ulong dropped) 1452 { 1453 gst_message_parse_qos_stats(gstMessage, &format, &processed, &dropped); 1454 } 1455 1456 /** 1457 * Extract the QoS values that have been calculated/analysed from the QoS data 1458 * 1459 * MT safe. 1460 * 1461 * Params: 1462 * jitter = The difference of the running-time against 1463 * the deadline. 1464 * proportion = Long term prediction of the ideal rate 1465 * relative to normal rate to get optimal quality. 1466 * quality = An element dependent integer value that 1467 * specifies the current quality level of the element. The default 1468 * maximum quality is 1000000. 1469 */ 1470 public void parseQosValues(out long jitter, out double proportion, out int quality) 1471 { 1472 gst_message_parse_qos_values(gstMessage, &jitter, &proportion, &quality); 1473 } 1474 1475 /** 1476 * Extract the requested state from the request_state message. 1477 * 1478 * MT safe. 1479 * 1480 * Params: 1481 * state = Result location for the requested state or %NULL 1482 */ 1483 public void parseRequestState(out GstState state) 1484 { 1485 gst_message_parse_request_state(gstMessage, &state); 1486 } 1487 1488 /** 1489 * Extract the running-time from the RESET_TIME message. 1490 * 1491 * MT safe. 1492 * 1493 * Params: 1494 * runningTime = Result location for the running_time or 1495 * %NULL 1496 */ 1497 public void parseResetTime(out GstClockTime runningTime) 1498 { 1499 gst_message_parse_reset_time(gstMessage, &runningTime); 1500 } 1501 1502 /** 1503 * Extracts the position and format from the segment done message. 1504 * 1505 * MT safe. 1506 * 1507 * Params: 1508 * format = Result location for the format, or %NULL 1509 * position = Result location for the position, or %NULL 1510 */ 1511 public void parseSegmentDone(out GstFormat format, out long position) 1512 { 1513 gst_message_parse_segment_done(gstMessage, &format, &position); 1514 } 1515 1516 /** 1517 * Extracts the position and format from the segment start message. 1518 * 1519 * MT safe. 1520 * 1521 * Params: 1522 * format = Result location for the format, or %NULL 1523 * position = Result location for the position, or %NULL 1524 */ 1525 public void parseSegmentStart(out GstFormat format, out long position) 1526 { 1527 gst_message_parse_segment_start(gstMessage, &format, &position); 1528 } 1529 1530 /** 1531 * Extracts the old and new states from the GstMessage. 1532 * 1533 * Typical usage of this function might be: 1534 * |[ 1535 * ... 1536 * switch (GST_MESSAGE_TYPE (msg)) { 1537 * case GST_MESSAGE_STATE_CHANGED: { 1538 * GstState old_state, new_state; 1539 * 1540 * gst_message_parse_state_changed (msg, &old_state, &new_state, NULL); 1541 * g_print ("Element %s changed state from %s to %s.\n", 1542 * GST_OBJECT_NAME (msg->src), 1543 * gst_element_state_get_name (old_state), 1544 * gst_element_state_get_name (new_state)); 1545 * break; 1546 * } 1547 * ... 1548 * } 1549 * ... 1550 * ]| 1551 * 1552 * MT safe. 1553 * 1554 * Params: 1555 * oldstate = the previous state, or %NULL 1556 * newstate = the new (current) state, or %NULL 1557 * pending = the pending (target) state, or %NULL 1558 */ 1559 public void parseStateChanged(out GstState oldstate, out GstState newstate, out GstState pending) 1560 { 1561 gst_message_parse_state_changed(gstMessage, &oldstate, &newstate, &pending); 1562 } 1563 1564 /** 1565 * Extract the values the step_done message. 1566 * 1567 * MT safe. 1568 * 1569 * Params: 1570 * format = result location for the format 1571 * amount = result location for the amount 1572 * rate = result location for the rate 1573 * flush = result location for the flush flag 1574 * intermediate = result location for the intermediate flag 1575 * duration = result location for the duration 1576 * eos = result location for the EOS flag 1577 */ 1578 public void parseStepDone(out GstFormat format, out ulong amount, out double rate, out bool flush, out bool intermediate, out ulong duration, out bool eos) 1579 { 1580 int outflush; 1581 int outintermediate; 1582 int outeos; 1583 1584 gst_message_parse_step_done(gstMessage, &format, &amount, &rate, &outflush, &outintermediate, &duration, &outeos); 1585 1586 flush = (outflush == 1); 1587 intermediate = (outintermediate == 1); 1588 eos = (outeos == 1); 1589 } 1590 1591 /** 1592 * Extract the values from step_start message. 1593 * 1594 * MT safe. 1595 * 1596 * Params: 1597 * active = result location for the active flag 1598 * format = result location for the format 1599 * amount = result location for the amount 1600 * rate = result location for the rate 1601 * flush = result location for the flush flag 1602 * intermediate = result location for the intermediate flag 1603 */ 1604 public void parseStepStart(out bool active, out GstFormat format, out ulong amount, out double rate, out bool flush, out bool intermediate) 1605 { 1606 int outactive; 1607 int outflush; 1608 int outintermediate; 1609 1610 gst_message_parse_step_start(gstMessage, &outactive, &format, &amount, &rate, &outflush, &outintermediate); 1611 1612 active = (outactive == 1); 1613 flush = (outflush == 1); 1614 intermediate = (outintermediate == 1); 1615 } 1616 1617 /** 1618 * Extracts the stream status type and owner the GstMessage. The returned 1619 * owner remains valid for as long as the reference to @message is valid and 1620 * should thus not be unreffed. 1621 * 1622 * MT safe. 1623 * 1624 * Params: 1625 * type = A pointer to hold the status type 1626 * owner = The owner element of the message source 1627 */ 1628 public void parseStreamStatus(out GstStreamStatusType type, out Element owner) 1629 { 1630 GstElement* outowner = null; 1631 1632 gst_message_parse_stream_status(gstMessage, &type, &outowner); 1633 1634 owner = ObjectG.getDObject!(Element)(outowner); 1635 } 1636 1637 /** 1638 * Extracts the change type and completion status from the GstMessage. 1639 * 1640 * MT safe. 1641 * 1642 * Params: 1643 * type = A pointer to hold the change type 1644 * owner = The owner element of the 1645 * message source 1646 * busy = a pointer to hold whether the change is in 1647 * progress or has been completed 1648 */ 1649 public void parseStructureChange(out GstStructureChangeType type, out Element owner, out bool busy) 1650 { 1651 GstElement* outowner = null; 1652 int outbusy; 1653 1654 gst_message_parse_structure_change(gstMessage, &type, &outowner, &outbusy); 1655 1656 owner = ObjectG.getDObject!(Element)(outowner); 1657 busy = (outbusy == 1); 1658 } 1659 1660 /** 1661 * Extracts the tag list from the GstMessage. The tag list returned in the 1662 * output argument is a copy; the caller must free it when done. 1663 * 1664 * Typical usage of this function might be: 1665 * |[ 1666 * ... 1667 * switch (GST_MESSAGE_TYPE (msg)) { 1668 * case GST_MESSAGE_TAG: { 1669 * GstTagList *tags = NULL; 1670 * 1671 * gst_message_parse_tag (msg, &tags); 1672 * g_print ("Got tags from element %s\n", GST_OBJECT_NAME (msg->src)); 1673 * handle_tags (tags); 1674 * gst_tag_list_unref (tags); 1675 * break; 1676 * } 1677 * ... 1678 * } 1679 * ... 1680 * ]| 1681 * 1682 * MT safe. 1683 * 1684 * Params: 1685 * tagList = return location for the tag-list. 1686 */ 1687 public void parseTag(out TagList tagList) 1688 { 1689 GstTagList* outtagList = null; 1690 1691 gst_message_parse_tag(gstMessage, &outtagList); 1692 1693 tagList = ObjectG.getDObject!(TagList)(outtagList); 1694 } 1695 1696 /** 1697 * Extract the TOC from the #GstMessage. The TOC returned in the 1698 * output argument is a copy; the caller must free it with 1699 * gst_toc_unref() when done. 1700 * 1701 * MT safe. 1702 * 1703 * Params: 1704 * toc = return location for the TOC. 1705 * updated = return location for the updated flag. 1706 */ 1707 public void parseToc(out Toc toc, out bool updated) 1708 { 1709 GstToc* outtoc = null; 1710 int outupdated; 1711 1712 gst_message_parse_toc(gstMessage, &outtoc, &outupdated); 1713 1714 toc = ObjectG.getDObject!(Toc)(outtoc); 1715 updated = (outupdated == 1); 1716 } 1717 1718 /** 1719 * Extracts the GError and debug string from the GstMessage. The values returned 1720 * in the output arguments are copies; the caller must free them when done. 1721 * 1722 * MT safe. 1723 * 1724 * Params: 1725 * gerror = location for the GError 1726 * dbg = location for the debug message, 1727 * or %NULL 1728 */ 1729 public void parseWarning(out ErrorG gerror, out string dbg) 1730 { 1731 GError* outgerror = null; 1732 char* outdbg = null; 1733 1734 gst_message_parse_warning(gstMessage, &outgerror, &outdbg); 1735 1736 gerror = new ErrorG(outgerror); 1737 dbg = Str.toString(outdbg); 1738 } 1739 1740 /** 1741 * Configures the buffering stats values in @message. 1742 * 1743 * Params: 1744 * mode = a buffering mode 1745 * avgIn = the average input rate 1746 * avgOut = the average output rate 1747 * bufferingLeft = amount of buffering time left in milliseconds 1748 */ 1749 public void setBufferingStats(GstBufferingMode mode, int avgIn, int avgOut, long bufferingLeft) 1750 { 1751 gst_message_set_buffering_stats(gstMessage, mode, avgIn, avgOut, bufferingLeft); 1752 } 1753 1754 /** 1755 * Sets the group id on the stream-start message. 1756 * 1757 * All streams that have the same group id are supposed to be played 1758 * together, i.e. all streams inside a container file should have the 1759 * same group id but different stream ids. The group id should change 1760 * each time the stream is started, resulting in different group ids 1761 * each time a file is played for example. 1762 * 1763 * MT safe. 1764 * 1765 * Params: 1766 * groupId = the group id 1767 * 1768 * Since: 1.2 1769 */ 1770 public void setGroupId(uint groupId) 1771 { 1772 gst_message_set_group_id(gstMessage, groupId); 1773 } 1774 1775 /** 1776 * Set the QoS stats representing the history of the current continuous pipeline 1777 * playback period. 1778 * 1779 * When @format is @GST_FORMAT_UNDEFINED both @dropped and @processed are 1780 * invalid. Values of -1 for either @processed or @dropped mean unknown values. 1781 * 1782 * MT safe. 1783 * 1784 * Params: 1785 * format = Units of the 'processed' and 'dropped' fields. Video sinks and video 1786 * filters will use GST_FORMAT_BUFFERS (frames). Audio sinks and audio filters 1787 * will likely use GST_FORMAT_DEFAULT (samples). 1788 * processed = Total number of units correctly processed since the last state 1789 * change to READY or a flushing operation. 1790 * dropped = Total number of units dropped since the last state change to READY 1791 * or a flushing operation. 1792 */ 1793 public void setQosStats(GstFormat format, ulong processed, ulong dropped) 1794 { 1795 gst_message_set_qos_stats(gstMessage, format, processed, dropped); 1796 } 1797 1798 /** 1799 * Set the QoS values that have been calculated/analysed from the QoS data 1800 * 1801 * MT safe. 1802 * 1803 * Params: 1804 * jitter = The difference of the running-time against the deadline. 1805 * proportion = Long term prediction of the ideal rate relative to normal rate 1806 * to get optimal quality. 1807 * quality = An element dependent integer value that specifies the current 1808 * quality level of the element. The default maximum quality is 1000000. 1809 */ 1810 public void setQosValues(long jitter, double proportion, int quality) 1811 { 1812 gst_message_set_qos_values(gstMessage, jitter, proportion, quality); 1813 } 1814 1815 /** 1816 * Set the sequence number of a message. 1817 * 1818 * This function might be called by the creator of a message to indicate that 1819 * the message relates to other messages or events. See gst_message_get_seqnum() 1820 * for more information. 1821 * 1822 * MT safe. 1823 * 1824 * Params: 1825 * seqnum = A sequence number. 1826 */ 1827 public void setSeqnum(uint seqnum) 1828 { 1829 gst_message_set_seqnum(gstMessage, seqnum); 1830 } 1831 1832 /** 1833 * Configures the object handling the streaming thread. This is usually a 1834 * GstTask object but other objects might be added in the future. 1835 * 1836 * Params: 1837 * object = the object controlling the streaming 1838 */ 1839 public void setStreamStatusObject(Value object) 1840 { 1841 gst_message_set_stream_status_object(gstMessage, (object is null) ? null : object.getValueStruct()); 1842 } 1843 1844 /** 1845 * Get a printable name for the given message type. Do not modify or free. 1846 * 1847 * Params: 1848 * type = the message type 1849 * 1850 * Return: a reference to the static name of the message. 1851 */ 1852 public static string typeGetName(GstMessageType type) 1853 { 1854 return Str.toString(gst_message_type_get_name(type)); 1855 } 1856 1857 /** 1858 * Get the unique quark for the given message type. 1859 * 1860 * Params: 1861 * type = the message type 1862 * 1863 * Return: the quark associated with the message type 1864 */ 1865 public static GQuark typeToQuark(GstMessageType type) 1866 { 1867 return gst_message_type_to_quark(type); 1868 } 1869 }