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 = GstElement.html 27 * outPack = gstreamer 28 * outFile = Element 29 * strct = GstElement 30 * realStrct= 31 * ctorStrct= 32 * clss = Element 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gst_element_ 41 * - gst_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - gtkc.gobject 49 * - glib.ListG 50 * - gstreamer.Pad 51 * - gstreamer.PadTemplate 52 * - gstreamer.Clock 53 * - gstreamer.Caps 54 * - gstreamer.ElementFactory 55 * - gstreamer.Iterator 56 * - gstreamer.Index 57 * - gstreamer.TagList 58 * - gstreamer.Message 59 * - gstreamer.Query 60 * - gstreamer.Event 61 * - gstreamer.Bus 62 * structWrap: 63 * - GList -> ListG 64 * - GObject* -> Pad 65 * - GstBus* -> Bus 66 * - GstCaps* -> Caps 67 * - GstClock* -> Clock 68 * - GstElement* -> Element 69 * - GstElementFactory* -> ElementFactory 70 * - GstEvent* -> Event 71 * - GstIndex* -> Index 72 * - GstIterator* -> Iterator 73 * - GstMessage* -> Message 74 * - GstPad* -> Pad 75 * - GstPadTemplate* -> PadTemplate 76 * - GstQuery* -> Query 77 * - GstTagList* -> TagList 78 * module aliases: 79 * local aliases: 80 * overrides: 81 */ 82 83 module gstreamer.Element; 84 85 public import gstreamerc.gstreamertypes; 86 87 private import gstreamerc.gstreamer; 88 private import glib.ConstructionException; 89 private import gobject.ObjectG; 90 91 private import gobject.Signals; 92 public import gtkc.gdktypes; 93 94 private import glib.Str; 95 private import gtkc.gobject; 96 private import glib.ListG; 97 private import gstreamer.Pad; 98 private import gstreamer.PadTemplate; 99 private import gstreamer.Clock; 100 private import gstreamer.Caps; 101 private import gstreamer.ElementFactory; 102 private import gstreamer.Iterator; 103 private import gstreamer.Index; 104 private import gstreamer.TagList; 105 private import gstreamer.Message; 106 private import gstreamer.Query; 107 private import gstreamer.Event; 108 private import gstreamer.Bus; 109 110 111 112 private import gstreamer.ObjectGst; 113 114 /** 115 * Description 116 * GstElement is the abstract base class needed to construct an element that 117 * can be used in a GStreamer pipeline. Please refer to the plugin writers 118 * guide for more information on creating GstElement subclasses. 119 * The name of a GstElement can be get with gst_element_get_name() and set with 120 * gst_element_set_name(). For speed, GST_ELEMENT_NAME() can be used in the 121 * core when using the appropriate locking. Do not use this in plug-ins or 122 * applications in order to retain ABI compatibility. 123 * All elements have pads (of the type GstPad). These pads link to pads on 124 * other elements. GstBuffer flow between these linked pads. 125 * A GstElement has a GList of GstPad structures for all their input (or sink) 126 * and output (or source) pads. 127 * Core and plug-in writers can add and remove pads with gst_element_add_pad() 128 * and gst_element_remove_pad(). 129 * A pad of an element can be retrieved by name with gst_element_get_pad(). 130 * An iterator of all pads can be retrieved with gst_element_iterate_pads(). 131 * Elements can be linked through their pads. 132 * If the link is straightforward, use the gst_element_link() 133 * convenience function to link two elements, or gst_element_link_many() 134 * for more elements in a row. 135 * Use gst_element_link_filtered() to link two elements constrained by 136 * a specified set of GstCaps. 137 * For finer control, use gst_element_link_pads() and 138 * gst_element_link_pads_filtered() to specify the pads to link on 139 * each element by name. 140 * Each element has a state (see GstState). You can get and set the state 141 * of an element with gst_element_get_state() and gst_element_set_state(). 142 * To get a string representation of a GstState, use 143 * gst_element_state_get_name(). 144 * You can get and set a GstClock on an element using gst_element_get_clock() 145 * and gst_element_set_clock(). 146 * Some elements can provide a clock for the pipeline if 147 * gst_element_provides_clock() returns TRUE. With the 148 * gst_element_provide_clock() method one can retrieve the clock provided by 149 * such an element. 150 * Not all elements require a clock to operate correctly. If 151 * gst_element_requires_clock() returns TRUE, a clock should be set on the 152 * element with gst_element_set_clock(). 153 * Note that clock slection and distribution is normally handled by the 154 * toplevel GstPipeline so the clock functions are only to be used in very 155 * specific situations. 156 * Last reviewed on 2006-03-12 (0.10.5) 157 */ 158 public class Element : ObjectGst 159 { 160 161 /** the main Gtk struct */ 162 protected GstElement* gstElement; 163 164 165 public GstElement* getElementStruct() 166 { 167 return gstElement; 168 } 169 170 171 /** the main Gtk struct as a void* */ 172 protected override void* getStruct() 173 { 174 return cast(void*)gstElement; 175 } 176 177 /** 178 * Sets our main struct and passes it to the parent class 179 */ 180 public this (GstElement* gstElement) 181 { 182 super(cast(GstObject*)gstElement); 183 this.gstElement = gstElement; 184 } 185 186 protected override void setStruct(GObject* obj) 187 { 188 super.setStruct(obj); 189 gstElement = cast(GstElement*)obj; 190 } 191 192 /** 193 * Queries an element for the stream position. 194 * This is a convenience function for gstreamerD. 195 * Returns: 196 * The current position in nanoseconds - GstFormat.TIME. 197 */ 198 public long queryPosition() 199 { 200 GstFormat form = GstFormat.TIME; 201 long cur_pos; 202 queryPosition( form, cur_pos ); 203 return cur_pos; 204 } 205 206 /** 207 * Queries an element for the stream duration. 208 * This is a convenience function for gstreamerD. 209 * Returns: 210 * The duration in nanoseconds - GstFormat.TIME. 211 */ 212 public long queryDuration() 213 { 214 GstFormat form = GstFormat.TIME; 215 long cur_dur; 216 queryDuration( form, cur_dur ); 217 return cur_dur; 218 } 219 220 /** 221 * This set's the filename for a filesrc element. 222 */ 223 public void location( string set ) 224 { 225 //g_object_set( G_OBJECT(getElementStruct()), "location", set, NULL); 226 setProperty("location", set); 227 } 228 229 /** 230 * Set the caps property of an Element. 231 */ 232 void caps( Caps cp ) 233 { 234 g_object_set( getElementStruct(), Str.toStringz("caps"), cp.getCapsStruct(), null ); 235 } 236 237 /** 238 * For your convenience in gstreamerD: you can seek to the 239 * position of the pipeline measured in time_nanoseconds. 240 */ 241 public int seek( long time_nanoseconds ) //gint64 242 { 243 return seek( 1.0, GstFormat.TIME, GstSeekFlags.FLUSH, 244 GstSeekType.SET, time_nanoseconds, 245 GstSeekType.NONE, GST_CLOCK_TIME_NONE); 246 } 247 248 /** 249 * Get's all the pads from an element in a Pad[]. FIXME: This a hackish mess. 250 */ 251 public Pad[] pads() 252 { 253 Pad[] result = new Pad[0]; 254 255 Iterator iter = iteratePads(); 256 GstPad* obu_c = null; 257 iter.next( cast(void**) &obu_c ); 258 while( obu_c !is null ) 259 { 260 Pad tmpobu = new Pad( obu_c ); 261 //writefln( "iterating Padname: ", tmpobu.getName() ); 262 result.length = result.length + 1; 263 result[result.length-1] = tmpobu; 264 265 obu_c = null; 266 iter.next( cast(void**) &obu_c ); 267 } 268 //writefln("no more pads."); 269 return result; 270 } 271 272 /** 273 */ 274 int[string] connectedSignals; 275 276 void delegate(Element)[] onNoMorePadsListeners; 277 /** 278 * This signals that the element will not generate more dynamic pads. 279 */ 280 void addOnNoMorePads(void delegate(Element) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 281 { 282 if ( !("no-more-pads" in connectedSignals) ) 283 { 284 Signals.connectData( 285 getStruct(), 286 "no-more-pads", 287 cast(GCallback)&callBackNoMorePads, 288 cast(void*)this, 289 null, 290 connectFlags); 291 connectedSignals["no-more-pads"] = 1; 292 } 293 onNoMorePadsListeners ~= dlg; 294 } 295 extern(C) static void callBackNoMorePads(GstElement* gstelementStruct, Element _element) 296 { 297 foreach ( void delegate(Element) dlg ; _element.onNoMorePadsListeners ) 298 { 299 dlg(_element); 300 } 301 } 302 303 void delegate(Pad, Element)[] onPadAddedListeners; 304 /** 305 * a new GstPad has been added to the element. 306 */ 307 void addOnPadAdded(void delegate(Pad, Element) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 308 { 309 if ( !("pad-added" in connectedSignals) ) 310 { 311 Signals.connectData( 312 getStruct(), 313 "pad-added", 314 cast(GCallback)&callBackPadAdded, 315 cast(void*)this, 316 null, 317 connectFlags); 318 connectedSignals["pad-added"] = 1; 319 } 320 onPadAddedListeners ~= dlg; 321 } 322 extern(C) static void callBackPadAdded(GstElement* gstelementStruct, GstPad* newPad, Element _element) 323 { 324 foreach ( void delegate(Pad, Element) dlg ; _element.onPadAddedListeners ) 325 { 326 dlg(ObjectG.getDObject!(Pad)(newPad), _element); 327 } 328 } 329 330 void delegate(Pad, Element)[] onPadRemovedListeners; 331 /** 332 * a GstPad has been removed from the element 333 * See Also 334 * GstElementFactory, GstPad 335 */ 336 void addOnPadRemoved(void delegate(Pad, Element) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 337 { 338 if ( !("pad-removed" in connectedSignals) ) 339 { 340 Signals.connectData( 341 getStruct(), 342 "pad-removed", 343 cast(GCallback)&callBackPadRemoved, 344 cast(void*)this, 345 null, 346 connectFlags); 347 connectedSignals["pad-removed"] = 1; 348 } 349 onPadRemovedListeners ~= dlg; 350 } 351 extern(C) static void callBackPadRemoved(GstElement* gstelementStruct, GstPad* oldPad, Element _element) 352 { 353 foreach ( void delegate(Pad, Element) dlg ; _element.onPadRemovedListeners ) 354 { 355 dlg(ObjectG.getDObject!(Pad)(oldPad), _element); 356 } 357 } 358 359 360 /** 361 * Adds a padtemplate to an element class. This is mainly used in the _base_init 362 * functions of classes. 363 * Params: 364 * klass = the GstElementClass to add the pad template to. 365 * templ = a GstPadTemplate to add to the element class. 366 */ 367 public static void classAddPadTemplate(GstElementClass* klass, PadTemplate templ) 368 { 369 // void gst_element_class_add_pad_template (GstElementClass *klass, GstPadTemplate *templ); 370 gst_element_class_add_pad_template(klass, (templ is null) ? null : templ.getPadTemplateStruct()); 371 } 372 373 /** 374 * Retrieves a padtemplate from element_class with the given name. 375 * Note 376 * If you use this function in the GInstanceInitFunc of an object class 377 * that has subclasses, make sure to pass the g_class parameter of the 378 * GInstanceInitFunc here. 379 * Params: 380 * elementClass = a GstElementClass to get the pad template of. 381 * name = the name of the GstPadTemplate to get. 382 * Returns: the GstPadTemplate with the given name, or NULL if none was found. No unreferencing is necessary. 383 */ 384 public static PadTemplate classGetPadTemplate(GstElementClass* elementClass, string name) 385 { 386 // GstPadTemplate* gst_element_class_get_pad_template (GstElementClass *element_class, const gchar *name); 387 auto p = gst_element_class_get_pad_template(elementClass, Str.toStringz(name)); 388 389 if(p is null) 390 { 391 return null; 392 } 393 394 return ObjectG.getDObject!(PadTemplate)(cast(GstPadTemplate*) p); 395 } 396 397 /** 398 * Retrieves a list of the pad templates associated with element_class. The 399 * list must not be modified by the calling code. 400 * Note 401 * If you use this function in the GInstanceInitFunc of an object class 402 * that has subclasses, make sure to pass the g_class parameter of the 403 * GInstanceInitFunc here. 404 * Params: 405 * elementClass = a GstElementClass to get pad templates of. 406 * Returns: the GList of padtemplates. 407 */ 408 public static GList* classGetPadTemplateList(GstElementClass* elementClass) 409 { 410 // GList* gst_element_class_get_pad_template_list (GstElementClass *element_class); 411 return gst_element_class_get_pad_template_list(elementClass); 412 } 413 414 /** 415 * Sets the detailed information for a GstElementClass. 416 * Note 417 * This function is for use in _base_init functions only. 418 * The details are copied. 419 * Params: 420 * klass = class to set details for 421 * details = details to set 422 */ 423 public static void classSetDetails(GstElementClass* klass, GstElementDetails* details) 424 { 425 // void gst_element_class_set_details (GstElementClass *klass, const GstElementDetails *details); 426 gst_element_class_set_details(klass, details); 427 } 428 429 /** 430 * Sets the detailed information for a GstElementClass. Simpler version of 431 * gst_element_class_set_details() that generates less linker overhead. 432 * Note 433 * This function is for use in _base_init functions only. 434 * The detail parameter strings are copied into the GstElementDetails for 435 * the element class. 436 * Params: 437 * klass = class to set details for 438 * longname = The long English name of the element. E.g. "File Sink" 439 * classification = String describing the type of element, as an unordered list 440 * separated with slashes ('/'). See draft-klass.txt of the design docs 441 * for more details and common types. E.g: "Sink/File" 442 * description = Sentence describing the purpose of the element. 443 * E.g: "Write stream to a file" 444 * author = Name and contact details of the author(s). Use \n to separate 445 * multiple author details. E.g: "Joe Bloggs <joe.blogs at foo.com>" 446 * Since 0.10.14 447 */ 448 public static void classSetDetailsSimple(GstElementClass* klass, string longname, string classification, string description, string author) 449 { 450 // void gst_element_class_set_details_simple (GstElementClass *klass, const gchar *longname, const gchar *classification, const gchar *description, const gchar *author); 451 gst_element_class_set_details_simple(klass, Str.toStringz(longname), Str.toStringz(classification), Str.toStringz(description), Str.toStringz(author)); 452 } 453 454 /** 455 * Adds a pad (link point) to element. pad's parent will be set to element; 456 * see gst_object_set_parent() for refcounting information. 457 * Pads are not automatically activated so elements should perform the needed 458 * steps to activate the pad in case this pad is added in the PAUSED or PLAYING 459 * state. See gst_pad_set_active() for more information about activating pads. 460 * The pad and the element should be unlocked when calling this function. 461 * This function will emit the GstElement::pad-added signal on the element. 462 * Params: 463 * pad = the GstPad to add to the element. 464 * Returns: TRUE if the pad could be added. This function can fail when a pad with the same name already existed or the pad already had another parent. MT safe. 465 */ 466 public int addPad(Pad pad) 467 { 468 // gboolean gst_element_add_pad (GstElement *element, GstPad *pad); 469 return gst_element_add_pad(gstElement, (pad is null) ? null : pad.getPadStruct()); 470 } 471 472 /** 473 * Retrieves a pad from element by name. Tries gst_element_get_static_pad() 474 * first, then gst_element_get_request_pad(). 475 * Note 476 * Usage of this function is not recommended as it is unclear if the reference 477 * to the result pad should be released with gst_object_unref() in case of a static pad 478 * or gst_element_release_request_pad() in case of a request pad. 479 * Params: 480 * name = the name of the pad to retrieve. 481 * Returns: the GstPad if found, otherwise NULL. Unref or Release after usage, depending on the type of the pad. 482 */ 483 public Pad getPad(string name) 484 { 485 // GstPad* gst_element_get_pad (GstElement *element, const gchar *name); 486 auto p = gst_element_get_pad(gstElement, Str.toStringz(name)); 487 488 if(p is null) 489 { 490 return null; 491 } 492 493 return ObjectG.getDObject!(Pad)(cast(GstPad*) p); 494 } 495 496 /** 497 * Creates a pad for each pad template that is always available. 498 * This function is only useful during object intialization of 499 * subclasses of GstElement. 500 */ 501 public void createAllPads() 502 { 503 // void gst_element_create_all_pads (GstElement *element); 504 gst_element_create_all_pads(gstElement); 505 } 506 507 /** 508 * Looks for an unlinked pad to which the given pad can link. It is not 509 * guaranteed that linking the pads will work, though it should work in most 510 * cases. 511 * Params: 512 * pad = the GstPad to find a compatible one for. 513 * caps = the GstCaps to use as a filter. 514 * Returns: the GstPad to which a link can be made, or NULL if one cannot be found. 515 */ 516 public Pad getCompatiblePad(Pad pad, Caps caps) 517 { 518 // GstPad* gst_element_get_compatible_pad (GstElement *element, GstPad *pad, const GstCaps *caps); 519 auto p = gst_element_get_compatible_pad(gstElement, (pad is null) ? null : pad.getPadStruct(), (caps is null) ? null : caps.getCapsStruct()); 520 521 if(p is null) 522 { 523 return null; 524 } 525 526 return ObjectG.getDObject!(Pad)(cast(GstPad*) p); 527 } 528 529 /** 530 * Retrieves a pad template from element that is compatible with compattempl. 531 * Pads from compatible templates can be linked together. 532 * Params: 533 * compattempl = the GstPadTemplate to find a compatible template for. 534 * Returns: a compatible GstPadTemplate, or NULL if none was found. No unreferencing is necessary. 535 */ 536 public PadTemplate getCompatiblePadTemplate(PadTemplate compattempl) 537 { 538 // GstPadTemplate* gst_element_get_compatible_pad_template (GstElement *element, GstPadTemplate *compattempl); 539 auto p = gst_element_get_compatible_pad_template(gstElement, (compattempl is null) ? null : compattempl.getPadTemplateStruct()); 540 541 if(p is null) 542 { 543 return null; 544 } 545 546 return ObjectG.getDObject!(PadTemplate)(cast(GstPadTemplate*) p); 547 } 548 549 /** 550 * Retrieves a pad from the element by name. This version only retrieves 551 * request pads. The pad should be released with 552 * gst_element_release_request_pad(). 553 * Params: 554 * name = the name of the request GstPad to retrieve. 555 * Returns: requested GstPad if found, otherwise NULL. Release after usage. 556 */ 557 public Pad getRequestPad(string name) 558 { 559 // GstPad* gst_element_get_request_pad (GstElement *element, const gchar *name); 560 auto p = gst_element_get_request_pad(gstElement, Str.toStringz(name)); 561 562 if(p is null) 563 { 564 return null; 565 } 566 567 return ObjectG.getDObject!(Pad)(cast(GstPad*) p); 568 } 569 570 /** 571 * Retrieves a pad from element by name. This version only retrieves 572 * already-existing (i.e. 'static') pads. 573 * Params: 574 * name = the name of the static GstPad to retrieve. 575 * Returns: the requested GstPad if found, otherwise NULL. unref after usage. MT safe. 576 */ 577 public Pad getStaticPad(string name) 578 { 579 // GstPad* gst_element_get_static_pad (GstElement *element, const gchar *name); 580 auto p = gst_element_get_static_pad(gstElement, Str.toStringz(name)); 581 582 if(p is null) 583 { 584 return null; 585 } 586 587 return ObjectG.getDObject!(Pad)(cast(GstPad*) p); 588 } 589 590 /** 591 * Use this function to signal that the element does not expect any more pads 592 * to show up in the current pipeline. This function should be called whenever 593 * pads have been added by the element itself. Elements with GST_PAD_SOMETIMES 594 * pad templates use this in combination with autopluggers to figure out that 595 * the element is done initializing its pads. 596 * This function emits the GstElement::no-more-pads signal. 597 * MT safe. 598 */ 599 public void noMorePads() 600 { 601 // void gst_element_no_more_pads (GstElement *element); 602 gst_element_no_more_pads(gstElement); 603 } 604 605 /** 606 * Makes the element free the previously requested pad as obtained 607 * with gst_element_get_request_pad(). 608 * MT safe. 609 * Params: 610 * pad = the GstPad to release. 611 */ 612 public void releaseRequestPad(Pad pad) 613 { 614 // void gst_element_release_request_pad (GstElement *element, GstPad *pad); 615 gst_element_release_request_pad(gstElement, (pad is null) ? null : pad.getPadStruct()); 616 } 617 618 /** 619 * Removes pad from element. pad will be destroyed if it has not been 620 * referenced elsewhere using gst_object_unparent(). 621 * This function is used by plugin developers and should not be used 622 * by applications. Pads that were dynamically requested from elements 623 * with gst_element_get_request_pad() should be released with the 624 * gst_element_release_request_pad() function instead. 625 * Pads are not automatically deactivated so elements should perform the needed 626 * steps to deactivate the pad in case this pad is removed in the PAUSED or 627 * PLAYING state. See gst_pad_set_active() for more information about 628 * deactivating pads. 629 * The pad and the element should be unlocked when calling this function. 630 * This function will emit the GstElement::pad-removed signal on the element. 631 * Params: 632 * pad = the GstPad to remove from the element. 633 * Returns: TRUE if the pad could be removed. Can return FALSE if the pad does not belong to the provided element. MT safe. 634 */ 635 public int removePad(Pad pad) 636 { 637 // gboolean gst_element_remove_pad (GstElement *element, GstPad *pad); 638 return gst_element_remove_pad(gstElement, (pad is null) ? null : pad.getPadStruct()); 639 } 640 641 /** 642 * Retrieves an iterattor of element's pads. The iterator should 643 * be freed after usage. 644 * Returns: the GstIterator of GstPad. Unref each pad after use. MT safe. 645 */ 646 public Iterator iteratePads() 647 { 648 // GstIterator* gst_element_iterate_pads (GstElement *element); 649 auto p = gst_element_iterate_pads(gstElement); 650 651 if(p is null) 652 { 653 return null; 654 } 655 656 return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p); 657 } 658 659 /** 660 * Retrieves an iterator of element's sink pads. 661 * Returns: the GstIterator of GstPad. Unref each pad after use. MT safe. 662 */ 663 public Iterator iterateSinkPads() 664 { 665 // GstIterator* gst_element_iterate_sink_pads (GstElement *element); 666 auto p = gst_element_iterate_sink_pads(gstElement); 667 668 if(p is null) 669 { 670 return null; 671 } 672 673 return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p); 674 } 675 676 /** 677 * Retrieves an iterator of element's source pads. 678 * Returns: the GstIterator of GstPad. Unref each pad after use. MT safe. 679 */ 680 public Iterator iterateSrcPads() 681 { 682 // GstIterator* gst_element_iterate_src_pads (GstElement *element); 683 auto p = gst_element_iterate_src_pads(gstElement); 684 685 if(p is null) 686 { 687 return null; 688 } 689 690 return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p); 691 } 692 693 /** 694 * Links src to dest. The link must be from source to 695 * destination; the other direction will not be tried. The function looks for 696 * existing pads that aren't linked yet. It will request new pads if necessary. 697 * Such pads need to be released manualy when unlinking. 698 * If multiple links are possible, only one is established. 699 * Make sure you have added your elements to a bin or pipeline with 700 * gst_bin_add() before trying to link them. 701 * Params: 702 * dest = the GstElement containing the destination pad. 703 * Returns: TRUE if the elements could be linked, FALSE otherwise. 704 */ 705 public int link(Element dest) 706 { 707 // gboolean gst_element_link (GstElement *src, GstElement *dest); 708 return gst_element_link(gstElement, (dest is null) ? null : dest.getElementStruct()); 709 } 710 711 /** 712 * Unlinks all source pads of the source element with all sink pads 713 * of the sink element to which they are linked. 714 * If the link has been made using gst_element_link(), it could have created an 715 * requestpad, which has to be released using gst_element_release_request_pad(). 716 * Params: 717 * dest = the sink GstElement to unlink. 718 */ 719 public void unlink(Element dest) 720 { 721 // void gst_element_unlink (GstElement *src, GstElement *dest); 722 gst_element_unlink(gstElement, (dest is null) ? null : dest.getElementStruct()); 723 } 724 725 /** 726 * Links the two named pads of the source and destination elements. 727 * Side effect is that if one of the pads has no parent, it becomes a 728 * child of the parent of the other element. If they have different 729 * parents, the link fails. 730 * Params: 731 * src = a GstElement containing the source pad. 732 * srcpadname = the name of the GstPad in source element or NULL for any pad. 733 * dest = the GstElement containing the destination pad. 734 * destpadname = the name of the GstPad in destination element, 735 * or NULL for any pad. 736 * Returns: TRUE if the pads could be linked, FALSE otherwise. 737 */ 738 public int linkPads(string srcpadname, Element dest, string destpadname) 739 { 740 // gboolean gst_element_link_pads (GstElement *src, const gchar *srcpadname, GstElement *dest, const gchar *destpadname); 741 return gst_element_link_pads(gstElement, Str.toStringz(srcpadname), (dest is null) ? null : dest.getElementStruct(), Str.toStringz(destpadname)); 742 } 743 744 /** 745 * Unlinks the two named pads of the source and destination elements. 746 * Params: 747 * src = a GstElement containing the source pad. 748 * srcpadname = the name of the GstPad in source element. 749 * dest = a GstElement containing the destination pad. 750 * destpadname = the name of the GstPad in destination element. 751 */ 752 public void unlinkPads(string srcpadname, Element dest, string destpadname) 753 { 754 // void gst_element_unlink_pads (GstElement *src, const gchar *srcpadname, GstElement *dest, const gchar *destpadname); 755 gst_element_unlink_pads(gstElement, Str.toStringz(srcpadname), (dest is null) ? null : dest.getElementStruct(), Str.toStringz(destpadname)); 756 } 757 758 /** 759 * Links the two named pads of the source and destination elements. Side effect 760 * is that if one of the pads has no parent, it becomes a child of the parent of 761 * the other element. If they have different parents, the link fails. If caps 762 * is not NULL, makes sure that the caps of the link is a subset of caps. 763 * Params: 764 * src = a GstElement containing the source pad. 765 * srcpadname = the name of the GstPad in source element or NULL for any pad. 766 * dest = the GstElement containing the destination pad. 767 * destpadname = the name of the GstPad in destination element or NULL for any pad. 768 * filter = the GstCaps to filter the link, or NULL for no filter. 769 * Returns: TRUE if the pads could be linked, FALSE otherwise. 770 */ 771 public int linkPadsFiltered(string srcpadname, Element dest, string destpadname, Caps filter) 772 { 773 // gboolean gst_element_link_pads_filtered (GstElement *src, const gchar *srcpadname, GstElement *dest, const gchar *destpadname, GstCaps *filter); 774 return gst_element_link_pads_filtered(gstElement, Str.toStringz(srcpadname), (dest is null) ? null : dest.getElementStruct(), Str.toStringz(destpadname), (filter is null) ? null : filter.getCapsStruct()); 775 } 776 777 /** 778 * Links src to dest using the given caps as filtercaps. 779 * The link must be from source to 780 * destination; the other direction will not be tried. The function looks for 781 * existing pads that aren't linked yet. It will request new pads if necessary. 782 * If multiple links are possible, only one is established. 783 * Make sure you have added your elements to a bin or pipeline with 784 * gst_bin_add() before trying to link them. 785 * Params: 786 * dest = the GstElement containing the destination pad. 787 * filter = the GstCaps to filter the link, or NULL for no filter. 788 * Returns: TRUE if the pads could be linked, FALSE otherwise. 789 */ 790 public int linkFiltered(Element dest, Caps filter) 791 { 792 // gboolean gst_element_link_filtered (GstElement *src, GstElement *dest, GstCaps *filter); 793 return gst_element_link_filtered(gstElement, (dest is null) ? null : dest.getElementStruct(), (filter is null) ? null : filter.getCapsStruct()); 794 } 795 796 /** 797 * Set the base time of an element. See gst_element_get_base_time(). 798 * MT safe. 799 * Params: 800 * time = the base time to set. 801 */ 802 public void setBaseTime(GstClockTime time) 803 { 804 // void gst_element_set_base_time (GstElement *element, GstClockTime time); 805 gst_element_set_base_time(gstElement, time); 806 } 807 808 /** 809 * Returns the base time of the element. The base time is the 810 * absolute time of the clock when this element was last put to 811 * PLAYING. Subtracting the base time from the clock time gives 812 * the stream time of the element. 813 * Returns: the base time of the element. MT safe. 814 */ 815 public GstClockTime getBaseTime() 816 { 817 // GstClockTime gst_element_get_base_time (GstElement *element); 818 return gst_element_get_base_time(gstElement); 819 } 820 821 /** 822 * Sets the bus of the element. Increases the refcount on the bus. 823 * For internal use only, unless you're testing elements. 824 * MT safe. 825 * Params: 826 * bus = the GstBus to set. 827 */ 828 public void setBus(Bus bus) 829 { 830 // void gst_element_set_bus (GstElement *element, GstBus *bus); 831 gst_element_set_bus(gstElement, (bus is null) ? null : bus.getBusStruct()); 832 } 833 834 /** 835 * Returns the bus of the element. Note that only a GstPipeline will provide a 836 * bus for the application. 837 * Returns: the element's GstBus. unref after usage. MT safe. 838 */ 839 public Bus getBus() 840 { 841 // GstBus* gst_element_get_bus (GstElement *element); 842 auto p = gst_element_get_bus(gstElement); 843 844 if(p is null) 845 { 846 return null; 847 } 848 849 return ObjectG.getDObject!(Bus)(cast(GstBus*) p); 850 } 851 852 /** 853 * Retrieves the factory that was used to create this element. 854 * Returns: the GstElementFactory used for creating this element. no refcounting is needed. 855 */ 856 public ElementFactory getFactory() 857 { 858 // GstElementFactory* gst_element_get_factory (GstElement *element); 859 auto p = gst_element_get_factory(gstElement); 860 861 if(p is null) 862 { 863 return null; 864 } 865 866 return ObjectG.getDObject!(ElementFactory)(cast(GstElementFactory*) p); 867 } 868 869 /** 870 * Set index on the element. The refcount of the index 871 * will be increased, any previously set index is unreffed. 872 * MT safe. 873 * Params: 874 * index = a GstIndex. 875 */ 876 public void setIndex(Index index) 877 { 878 // void gst_element_set_index (GstElement *element, GstIndex *index); 879 gst_element_set_index(gstElement, (index is null) ? null : index.getIndexStruct()); 880 } 881 882 /** 883 * Gets the index from the element. 884 * Returns: a GstIndex or NULL when no index was set on the element. unref after usage. MT safe. 885 */ 886 public Index getIndex() 887 { 888 // GstIndex* gst_element_get_index (GstElement *element); 889 auto p = gst_element_get_index(gstElement); 890 891 if(p is null) 892 { 893 return null; 894 } 895 896 return ObjectG.getDObject!(Index)(cast(GstIndex*) p); 897 } 898 899 /** 900 * Queries if the element can be indexed. 901 * Returns: TRUE if the element can be indexed. MT safe. 902 */ 903 public int isIndexable() 904 { 905 // gboolean gst_element_is_indexable (GstElement *element); 906 return gst_element_is_indexable(gstElement); 907 } 908 909 /** 910 * Query if the element requires a clock. 911 * Returns: TRUE if the element requires a clock MT safe. 912 */ 913 public int requiresClock() 914 { 915 // gboolean gst_element_requires_clock (GstElement *element); 916 return gst_element_requires_clock(gstElement); 917 } 918 919 /** 920 * Sets the clock for the element. This function increases the 921 * refcount on the clock. Any previously set clock on the object 922 * is unreffed. 923 * Params: 924 * clock = the GstClock to set for the element. 925 * Returns: TRUE if the element accepted the clock. An element can refuse a clock when it, for example, is not able to slave its internal clock to the clock or when it requires a specific clock to operate. MT safe. 926 */ 927 public int setClock(Clock clock) 928 { 929 // gboolean gst_element_set_clock (GstElement *element, GstClock *clock); 930 return gst_element_set_clock(gstElement, (clock is null) ? null : clock.getClockStruct()); 931 } 932 933 /** 934 * Gets the currently configured clock of the element. This is the clock as was 935 * last set with gst_element_set_clock(). 936 * Returns: the GstClock of the element. unref after usage. MT safe. 937 */ 938 public Clock getClock() 939 { 940 // GstClock* gst_element_get_clock (GstElement *element); 941 auto p = gst_element_get_clock(gstElement); 942 943 if(p is null) 944 { 945 return null; 946 } 947 948 return ObjectG.getDObject!(Clock)(cast(GstClock*) p); 949 } 950 951 /** 952 * Query if the element provides a clock. A GstClock provided by an 953 * element can be used as the global GstClock for the pipeline. 954 * An element that can provide a clock is only required to do so in the PAUSED 955 * state, this means when it is fully negotiated and has allocated the resources 956 * to operate the clock. 957 * Returns: TRUE if the element provides a clock MT safe. 958 */ 959 public int providesClock() 960 { 961 // gboolean gst_element_provides_clock (GstElement *element); 962 return gst_element_provides_clock(gstElement); 963 } 964 965 /** 966 * Get the clock provided by the given element. 967 * Note 968 * An element is only required to provide a clock in the PAUSED 969 * state. Some elements can provide a clock in other states. 970 * Returns: the GstClock provided by the element or NULL if no clock could be provided. Unref after usage. MT safe. 971 */ 972 public Clock provideClock() 973 { 974 // GstClock* gst_element_provide_clock (GstElement *element); 975 auto p = gst_element_provide_clock(gstElement); 976 977 if(p is null) 978 { 979 return null; 980 } 981 982 return ObjectG.getDObject!(Clock)(cast(GstClock*) p); 983 } 984 985 /** 986 * Sets the state of the element. This function will try to set the 987 * requested state by going through all the intermediary states and calling 988 * the class's state change function for each. 989 * This function can return GST_STATE_CHANGE_ASYNC, in which case the 990 * element will perform the remainder of the state change asynchronously in 991 * another thread. 992 * An application can use gst_element_get_state() to wait for the completion 993 * of the state change or it can wait for a state change message on the bus. 994 * Params: 995 * state = the element's new GstState. 996 * Returns: Result of the state change using GstStateChangeReturn. MT safe. 997 */ 998 public GstStateChangeReturn setState(GstState state) 999 { 1000 // GstStateChangeReturn gst_element_set_state (GstElement *element, GstState state); 1001 return gst_element_set_state(gstElement, state); 1002 } 1003 1004 /** 1005 * Gets the state of the element. 1006 * For elements that performed an ASYNC state change, as reported by 1007 * gst_element_set_state(), this function will block up to the 1008 * specified timeout value for the state change to complete. 1009 * If the element completes the state change or goes into 1010 * an error, this function returns immediately with a return value of 1011 * GST_STATE_CHANGE_SUCCESS or GST_STATE_CHANGE_FAILURE respectively. 1012 * For elements that did not return GST_STATE_CHANGE_ASYNC, this function 1013 * returns the current and pending state immediately. 1014 * This function returns GST_STATE_CHANGE_NO_PREROLL if the element 1015 * successfully changed its state but is not able to provide data yet. 1016 * This mostly happens for live sources that only produce data in the PLAYING 1017 * state. While the state change return is equivalent to 1018 * GST_STATE_CHANGE_SUCCESS, it is returned to the application to signal that 1019 * some sink elements might not be able to complete their state change because 1020 * an element is not producing data to complete the preroll. When setting the 1021 * element to playing, the preroll will complete and playback will start. 1022 * Params: 1023 * state = a pointer to GstState to hold the state. Can be NULL. 1024 * pending = a pointer to GstState to hold the pending state. 1025 * Can be NULL. 1026 * timeout = a GstClockTime to specify the timeout for an async 1027 * state change or GST_CLOCK_TIME_NONE for infinite timeout. 1028 * Returns: GST_STATE_CHANGE_SUCCESS if the element has no more pending state and the last state change succeeded, GST_STATE_CHANGE_ASYNC if the element is still performing a state change or GST_STATE_CHANGE_FAILURE if the last state change failed. MT safe. 1029 */ 1030 public GstStateChangeReturn getState(out GstState state, out GstState pending, GstClockTime timeout) 1031 { 1032 // GstStateChangeReturn gst_element_get_state (GstElement *element, GstState *state, GstState *pending, GstClockTime timeout); 1033 return gst_element_get_state(gstElement, &state, &pending, timeout); 1034 } 1035 1036 /** 1037 * Locks the state of an element, so state changes of the parent don't affect 1038 * this element anymore. 1039 * MT safe. 1040 * Params: 1041 * lockedState = TRUE to lock the element's state 1042 * Returns: TRUE if the state was changed, FALSE if bad parameters were given or the elements state-locking needed no change. 1043 */ 1044 public int setLockedState(int lockedState) 1045 { 1046 // gboolean gst_element_set_locked_state (GstElement *element, gboolean locked_state); 1047 return gst_element_set_locked_state(gstElement, lockedState); 1048 } 1049 1050 /** 1051 * Checks if the state of an element is locked. 1052 * If the state of an element is locked, state changes of the parent don't 1053 * affect the element. 1054 * This way you can leave currently unused elements inside bins. Just lock their 1055 * state before changing the state from GST_STATE_NULL. 1056 * MT safe. 1057 * Returns: TRUE, if the element's state is locked. 1058 */ 1059 public int isLockedState() 1060 { 1061 // gboolean gst_element_is_locked_state (GstElement *element); 1062 return gst_element_is_locked_state(gstElement); 1063 } 1064 1065 /** 1066 * Abort the state change of the element. This function is used 1067 * by elements that do asynchronous state changes and find out 1068 * something is wrong. 1069 * This function should be called with the STATE_LOCK held. 1070 * MT safe. 1071 */ 1072 public void abortState() 1073 { 1074 // void gst_element_abort_state (GstElement *element); 1075 gst_element_abort_state(gstElement); 1076 } 1077 1078 /** 1079 * Commit the state change of the element and proceed to the next 1080 * pending state if any. This function is used 1081 * by elements that do asynchronous state changes. 1082 * The core will normally call this method automatically when an 1083 * element returned GST_STATE_CHANGE_SUCCESS from the state change function. 1084 * If after calling this method the element still has not reached 1085 * the pending state, the next state change is performed. 1086 * This method is used internally and should normally not be called by plugins 1087 * or applications. 1088 * Params: 1089 * ret = The previous state return value 1090 * Returns: The result of the commit state change. MT safe. 1091 */ 1092 public GstStateChangeReturn continueState(GstStateChangeReturn ret) 1093 { 1094 // GstStateChangeReturn gst_element_continue_state (GstElement *element, GstStateChangeReturn ret); 1095 return gst_element_continue_state(gstElement, ret); 1096 } 1097 1098 /** 1099 * Brings the element to the lost state. The current state of the 1100 * element is copied to the pending state so that any call to 1101 * gst_element_get_state() will return GST_STATE_CHANGE_ASYNC. 1102 * An ASYNC_START message is posted with an indication to distribute a new 1103 * base_time to the element. 1104 * If the element was PLAYING, it will go to PAUSED. The element 1105 * will be restored to its PLAYING state by the parent pipeline when it 1106 * prerolls again. 1107 * This is mostly used for elements that lost their preroll buffer 1108 * in the GST_STATE_PAUSED or GST_STATE_PLAYING state after a flush, 1109 * they will go to their pending state again when a new preroll buffer is 1110 * queued. This function can only be called when the element is currently 1111 * not in error or an async state change. 1112 * This function is used internally and should normally not be called from 1113 * plugins or applications. 1114 * MT safe. 1115 */ 1116 public void lostState() 1117 { 1118 // void gst_element_lost_state (GstElement *element); 1119 gst_element_lost_state(gstElement); 1120 } 1121 1122 /** 1123 * Gets a string representing the given state. 1124 * Params: 1125 * state = a GstState to get the name of. 1126 * Returns: a string with the name of the state. 1127 */ 1128 public static string stateGetName(GstState state) 1129 { 1130 // const gchar* gst_element_state_get_name (GstState state); 1131 return Str.toString(gst_element_state_get_name(state)); 1132 } 1133 1134 /** 1135 * Gets a string representing the given state change result. 1136 * Params: 1137 * stateRet = a GstStateChangeReturn to get the name of. 1138 * Returns: a string with the name of the state change result. 1139 */ 1140 public static string stateChangeReturnGetName(GstStateChangeReturn stateRet) 1141 { 1142 // const gchar* gst_element_state_change_return_get_name (GstStateChangeReturn state_ret); 1143 return Str.toString(gst_element_state_change_return_get_name(stateRet)); 1144 } 1145 1146 /** 1147 * Tries to change the state of the element to the same as its parent. 1148 * If this function returns FALSE, the state of element is undefined. 1149 * Returns: TRUE, if the element's state could be synced to the parent's state. MT safe. 1150 */ 1151 public int syncStateWithParent() 1152 { 1153 // gboolean gst_element_sync_state_with_parent (GstElement *element); 1154 return gst_element_sync_state_with_parent(gstElement); 1155 } 1156 1157 /** 1158 * Perform transition on element. 1159 * This function must be called with STATE_LOCK held and is mainly used 1160 * internally. 1161 * Params: 1162 * transition = the requested transition 1163 * Returns: the GstStateChangeReturn of the state transition. 1164 */ 1165 public GstStateChangeReturn changeState(GstStateChange transition) 1166 { 1167 // GstStateChangeReturn gst_element_change_state (GstElement *element, GstStateChange transition); 1168 return gst_element_change_state(gstElement, transition); 1169 } 1170 1171 /** 1172 * Posts a message to the bus that new tags were found, and pushes an event 1173 * to all sourcepads. Takes ownership of the list. 1174 * This is a utility method for elements. Applications should use the 1175 * GstTagSetter interface. 1176 * Params: 1177 * list = list of tags. 1178 */ 1179 public void foundTags(TagList list) 1180 { 1181 // void gst_element_found_tags (GstElement *element, GstTagList *list); 1182 gst_element_found_tags(gstElement, (list is null) ? null : list.getTagListStruct()); 1183 } 1184 1185 /** 1186 * Posts a message to the bus that new tags were found and pushes the 1187 * tags as event. Takes ownership of the list. 1188 * This is a utility method for elements. Applications should use the 1189 * GstTagSetter interface. 1190 * Params: 1191 * pad = pad on which to push tag-event. 1192 * list = the taglist to post on the bus and create event from. 1193 */ 1194 public void foundTagsForPad(Pad pad, TagList list) 1195 { 1196 // void gst_element_found_tags_for_pad (GstElement *element, GstPad *pad, GstTagList *list); 1197 gst_element_found_tags_for_pad(gstElement, (pad is null) ? null : pad.getPadStruct(), (list is null) ? null : list.getTagListStruct()); 1198 } 1199 1200 /** 1201 * Post an error, warning or info message on the bus from inside an element. 1202 * type must be of GST_MESSAGE_ERROR, GST_MESSAGE_WARNING or 1203 * GST_MESSAGE_INFO. 1204 * MT safe. 1205 * Params: 1206 * type = the GstMessageType 1207 * domain = the GStreamer GError domain this message belongs to 1208 * code = the GError code belonging to the domain 1209 * text = an allocated text string to be used as a replacement for the 1210 * default message connected to code, or NULL 1211 * dbug = an allocated debug message to be used as a replacement for the 1212 * default debugging information, or NULL 1213 * file = the source code file where the error was generated 1214 * funct = the source code function where the error was generated 1215 * line = the source code line where the error was generated 1216 */ 1217 public void messageFull(GstMessageType type, GQuark domain, int code, string text, string dbug, string file, string funct, int line) 1218 { 1219 // void gst_element_message_full (GstElement *element, GstMessageType type, GQuark domain, gint code, gchar *text, gchar *debug, const gchar *file, const gchar *function, gint line); 1220 gst_element_message_full(gstElement, type, domain, code, Str.toStringz(text), Str.toStringz(dbug), Str.toStringz(file), Str.toStringz(funct), line); 1221 } 1222 1223 /** 1224 * Post a message on the element's GstBus. This function takes ownership of the 1225 * message; if you want to access the message after this call, you should add an 1226 * additional reference before calling. 1227 * Params: 1228 * message = a GstMessage to post 1229 * Returns: TRUE if the message was successfully posted. The function returns FALSE if the element did not have a bus. MT safe. 1230 */ 1231 public int postMessage(Message message) 1232 { 1233 // gboolean gst_element_post_message (GstElement *element, GstMessage *message); 1234 return gst_element_post_message(gstElement, (message is null) ? null : message.getMessageStruct()); 1235 } 1236 1237 /** 1238 * Get an array of query types from the element. 1239 * If the element doesn't implement a query types function, 1240 * the query will be forwarded to the peer of a random linked sink pad. 1241 * Returns: An array of GstQueryType elements that should not be freed or modified. MT safe. 1242 */ 1243 public GstQueryType* getQueryTypes() 1244 { 1245 // const GstQueryType* gst_element_get_query_types (GstElement *element); 1246 return gst_element_get_query_types(gstElement); 1247 } 1248 1249 /** 1250 * Performs a query on the given element. 1251 * For elements that don't implement a query handler, this function 1252 * forwards the query to a random srcpad or to the peer of a 1253 * random linked sinkpad of this element. 1254 * Params: 1255 * query = the GstQuery. 1256 * Returns: TRUE if the query could be performed. MT safe. 1257 */ 1258 public int query(Query query) 1259 { 1260 // gboolean gst_element_query (GstElement *element, GstQuery *query); 1261 return gst_element_query(gstElement, (query is null) ? null : query.getQueryStruct()); 1262 } 1263 1264 /** 1265 * Queries an element to convert src_val in src_format to dest_format. 1266 * Params: 1267 * srcFormat = a GstFormat to convert from. 1268 * srcVal = a value to convert. 1269 * destFormat = a pointer to the GstFormat to convert to. 1270 * destVal = a pointer to the result. 1271 * Returns: TRUE if the query could be performed. 1272 */ 1273 public int queryConvert(GstFormat srcFormat, long srcVal, ref GstFormat destFormat, long* destVal) 1274 { 1275 // gboolean gst_element_query_convert (GstElement *element, GstFormat src_format, gint64 src_val, GstFormat *dest_format, gint64 *dest_val); 1276 return gst_element_query_convert(gstElement, srcFormat, srcVal, &destFormat, destVal); 1277 } 1278 1279 /** 1280 * Queries an element for the stream position. 1281 * Params: 1282 * format = a pointer to the GstFormat asked for. 1283 * On return contains the GstFormat used. 1284 * cur = A location in which to store the current position, or NULL. 1285 * Returns: TRUE if the query could be performed. 1286 */ 1287 public int queryPosition(ref GstFormat format, ref long cur) 1288 { 1289 // gboolean gst_element_query_position (GstElement *element, GstFormat *format, gint64 *cur); 1290 return gst_element_query_position(gstElement, &format, &cur); 1291 } 1292 1293 /** 1294 * Queries an element for the total stream duration. 1295 * Params: 1296 * format = a pointer to the GstFormat asked for. 1297 * On return contains the GstFormat used. 1298 * duration = A location in which to store the total duration, or NULL. 1299 * Returns: TRUE if the query could be performed. 1300 */ 1301 public int queryDuration(ref GstFormat format, ref long duration) 1302 { 1303 // gboolean gst_element_query_duration (GstElement *element, GstFormat *format, gint64 *duration); 1304 return gst_element_query_duration(gstElement, &format, &duration); 1305 } 1306 1307 /** 1308 * Sends an event to an element. If the element doesn't implement an 1309 * event handler, the event will be pushed on a random linked sink pad for 1310 * upstream events or a random linked source pad for downstream events. 1311 * This function takes owership of the provided event so you should 1312 * gst_event_ref() it if you want to reuse the event after this call. 1313 * Params: 1314 * event = the GstEvent to send to the element. 1315 * Returns: TRUE if the event was handled. MT safe. 1316 */ 1317 public int sendEvent(Event event) 1318 { 1319 // gboolean gst_element_send_event (GstElement *element, GstEvent *event); 1320 return gst_element_send_event(gstElement, (event is null) ? null : event.getEventStruct()); 1321 } 1322 1323 /** 1324 * Simple API to perform a seek on the given element, meaning it just seeks 1325 * to the given position relative to the start of the stream. For more complex 1326 * operations like segment seeks (e.g. for looping) or changing the playback 1327 * rate or seeking relative to the last configured playback segment you should 1328 * use gst_element_seek(). 1329 * In a completely prerolled PAUSED or PLAYING pipeline, seeking is always 1330 * guaranteed to return TRUE on a seekable media type or FALSE when the media 1331 * type is certainly not seekable (such as a live stream). 1332 * Some elements allow for seeking in the READY state, in this 1333 * case they will store the seek event and execute it when they are put to 1334 * PAUSED. If the element supports seek in READY, it will always return TRUE when 1335 * it receives the event in the READY state. 1336 * Params: 1337 * format = a GstFormat to execute the seek in, such as GST_FORMAT_TIME 1338 * seekFlags = seek options; playback applications will usually want to use 1339 * GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT here 1340 * seekPos = position to seek to (relative to the start); if you are doing 1341 * a seek in GST_FORMAT_TIME this value is in nanoseconds - 1342 * multiply with GST_SECOND to convert seconds to nanoseconds or 1343 * with GST_MSECOND to convert milliseconds to nanoseconds. 1344 * Returns: TRUE if the seek operation succeeded (the seek might not always be executed instantly though) Since 0.10.7 1345 */ 1346 public int seekSimple(GstFormat format, GstSeekFlags seekFlags, long seekPos) 1347 { 1348 // gboolean gst_element_seek_simple (GstElement *element, GstFormat format, GstSeekFlags seek_flags, gint64 seek_pos); 1349 return gst_element_seek_simple(gstElement, format, seekFlags, seekPos); 1350 } 1351 1352 /** 1353 * Sends a seek event to an element. See gst_event_new_seek() for the details of 1354 * the parameters. The seek event is sent to the element using 1355 * gst_element_send_event(). 1356 * Params: 1357 * rate = The new playback rate 1358 * format = The format of the seek values 1359 * flags = The optional seek flags. 1360 * curType = The type and flags for the new current position 1361 * cur = The value of the new current position 1362 * stopType = The type and flags for the new stop position 1363 * stop = The value of the new stop position 1364 * Returns: TRUE if the event was handled. MT safe. Signal Details The "no-more-pads" signal void user_function (GstElement *gstelement, gpointer user_data) : Run Last This signals that the element will not generate more dynamic pads. 1365 */ 1366 public int seek(double rate, GstFormat format, GstSeekFlags flags, GstSeekType curType, long cur, GstSeekType stopType, long stop) 1367 { 1368 // gboolean gst_element_seek (GstElement *element, gdouble rate, GstFormat format, GstSeekFlags flags, GstSeekType cur_type, gint64 cur, GstSeekType stop_type, gint64 stop); 1369 return gst_element_seek(gstElement, rate, format, flags, curType, cur, stopType, stop); 1370 } 1371 }