1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
#![allow(deprecated)]
use crate::{
ffi, Edge, EditMode, Extractable, Layer, MetaContainer, TimelineElement, Track, TrackType,
};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
/// A [`TrackElement`][crate::TrackElement] is a [`TimelineElement`][crate::TimelineElement] that specifically belongs
/// to a single [`Track`][crate::Track] of its [`timeline`][struct@crate::TimelineElement#timeline]. Its
/// [`start`][struct@crate::TimelineElement#start] and [`duration`][struct@crate::TimelineElement#duration] specify its
/// temporal extent in the track. Specifically, a track element wraps some
/// nleobject, such as an `nlesource` or `nleoperation`, which can be
/// retrieved with [`TrackElementExt::nleobject()`][crate::prelude::TrackElementExt::nleobject()], and its
/// [`start`][struct@crate::TimelineElement#start], [`duration`][struct@crate::TimelineElement#duration],
/// [`in-point`][struct@crate::TimelineElement#in-point], [`priority`][struct@crate::TimelineElement#priority] and
/// [`active`][struct@crate::TrackElement#active] properties expose the corresponding nleobject
/// properties. When a track element is added to a track, its nleobject is
/// added to the corresponding `nlecomposition` that the track wraps.
///
/// Most users will not have to work directly with track elements since a
/// [`Clip`][crate::Clip] will automatically create track elements for its timeline's
/// tracks and take responsibility for updating them. The only track
/// elements that are not automatically created by clips, but a user is
/// likely to want to create, are [`Effect`][crate::Effect]-s.
///
/// ## Control Bindings for Children Properties
///
/// You can set up control bindings for a track element child property
/// using [`TrackElementExt::set_control_source()`][crate::prelude::TrackElementExt::set_control_source()]. A
/// `GstTimedValueControlSource` should specify the timed values using the
/// internal source coordinates (see [`TimelineElement`][crate::TimelineElement]). By default,
/// these will be updated to lie between the [`in-point`][struct@crate::TimelineElement#in-point]
/// and out-point of the element. This can be switched off by setting
/// [`auto-clamp-control-sources`][struct@crate::TrackElement#auto-clamp-control-sources] to [`false`].
///
/// This is an Abstract Base Class, you cannot instantiate it.
///
/// ## Properties
///
///
/// #### `active`
/// Whether the effect of the element should be applied in its
/// [`track`][struct@crate::TrackElement#track]. If set to [`false`], it will not be used in
/// the output of the track.
///
/// Readable | Writeable
///
///
/// #### `auto-clamp-control-sources`
/// Whether the control sources on the element (see
/// [`TrackElementExt::set_control_source()`][crate::prelude::TrackElementExt::set_control_source()]) will be automatically
/// updated whenever the [`in-point`][struct@crate::TimelineElement#in-point] or out-point of the
/// element change in value.
///
/// See [`TrackElementExt::clamp_control_source()`][crate::prelude::TrackElementExt::clamp_control_source()] for how this is done
/// per control source.
///
/// Default value: [`true`]
///
/// Readable | Writeable
///
///
/// #### `has-internal-source`
/// This property is used to determine whether the 'internal time'
/// properties of the element have any meaning. In particular, unless
/// this is set to [`true`], the [`in-point`][struct@crate::TimelineElement#in-point] and
/// [`max-duration`][struct@crate::TimelineElement#max-duration] can not be set to any value other
/// than the default 0 and `GST_CLOCK_TIME_NONE`, respectively.
///
/// If an element has some *internal* *timed* source [`gst::Element`][crate::gst::Element] that it
/// reads stream data from as part of its function in a [`Track`][crate::Track], then
/// you'll likely want to set this to [`true`] to allow the
/// [`in-point`][struct@crate::TimelineElement#in-point] and [`max-duration`][struct@crate::TimelineElement#max-duration] to
/// be set.
///
/// The default value is determined by the `GESTrackElementClass`
/// `default_has_internal_source` class property. For most
/// `GESSourceClass`-es, this will be [`true`], with the exception of those
/// that have a potentially *static* source, such as `GESImageSourceClass`
/// and `GESTitleSourceClass`. Otherwise, this will usually be [`false`].
///
/// For most [`Operation`][crate::Operation]-s you will likely want to leave this set to
/// [`false`]. The exception may be for an operation that reads some stream
/// data from some private internal source as part of manipulating the
/// input data from the usual linked upstream [`TrackElement`][crate::TrackElement].
///
/// For example, you may want to set this to [`true`] for a
/// [`TrackType::VIDEO`][crate::TrackType::VIDEO] operation that wraps a `textoverlay` that reads
/// from a subtitle file and places its text on top of the received video
/// data. The [`in-point`][struct@crate::TimelineElement#in-point] of the element would be used
/// to shift the initial seek time on the `textoverlay` away from 0, and
/// the [`max-duration`][struct@crate::TimelineElement#max-duration] could be set to reflect the
/// time at which the subtitle file runs out of data.
///
/// Note that GES can not support track elements that have both internal
/// content and manipulate the timing of their data streams (time
/// effects).
///
/// Readable | Writeable
///
///
/// #### `track`
/// The track that this element belongs to, or [`None`] if it does not
/// belong to a track.
///
/// Readable
///
///
/// #### `track-type`
/// The track type of the element, which determines the type of track the
/// element can be added to (see [`track-type`][struct@crate::Track#track-type]). This should
/// correspond to the type of data that the element can produce or
/// process.
///
/// Readable | Writeable | Construct
/// <details><summary><h4>TimelineElement</h4></summary>
///
///
/// #### `duration`
/// The duration that the element is in effect for in the timeline (a
/// time difference in nanoseconds using the time coordinates of the
/// timeline). For example, for a source element, this would determine
/// for how long it should output its internal content for. For an
/// operation element, this would determine for how long its effect
/// should be applied to any source content.
///
/// Readable | Writeable
///
///
/// #### `in-point`
/// The initial offset to use internally when outputting content (in
/// nanoseconds, but in the time coordinates of the internal content).
///
/// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
/// file, the "internal content" is the media file data, and the
/// in-point would correspond to some timestamp in the media file.
/// When playing the timeline, and when the element is first reached at
/// timeline-time [`start`][struct@crate::TimelineElement#start], it will begin outputting the
/// data from the timestamp in-point **onwards**, until it reaches the
/// end of its [`duration`][struct@crate::TimelineElement#duration] in the timeline.
///
/// For elements that have no internal content, this should be kept
/// as 0.
///
/// Readable | Writeable
///
///
/// #### `max-duration`
/// The full duration of internal content that is available (a time
/// difference in nanoseconds using the time coordinates of the internal
/// content).
///
/// This will act as a cap on the [`in-point`][struct@crate::TimelineElement#in-point] of the
/// element (which is in the same time coordinates), and will sometimes
/// be used to limit the [`duration`][struct@crate::TimelineElement#duration] of the element in
/// the timeline.
///
/// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
/// file, this would be the length of the media file.
///
/// For elements that have no internal content, or whose content is
/// indefinite, this should be kept as `GST_CLOCK_TIME_NONE`.
///
/// Readable | Writeable | Construct
///
///
/// #### `name`
/// The name of the element. This should be unique within its timeline.
///
/// Readable | Writeable | Construct
///
///
/// #### `parent`
/// The parent container of the element.
///
/// Readable | Writeable
///
///
/// #### `priority`
/// The priority of the element.
///
/// Readable | Writeable
///
///
/// #### `serialize`
/// Whether the element should be serialized.
///
/// Readable | Writeable
///
///
/// #### `start`
/// The starting position of the element in the timeline (in nanoseconds
/// and in the time coordinates of the timeline). For example, for a
/// source element, this would determine the time at which it should
/// start outputting its internal content. For an operation element, this
/// would determine the time at which it should start applying its effect
/// to any source content.
///
/// Readable | Writeable
///
///
/// #### `timeline`
/// The timeline that the element lies within.
///
/// Readable | Writeable
/// </details>
///
/// ## Signals
///
///
/// #### `control-binding-added`
/// This is emitted when a control binding is added to a child property
/// of the track element.
///
///
///
///
/// #### `control-binding-removed`
/// This is emitted when a control binding is removed from a child
/// property of the track element.
///
///
/// <details><summary><h4>TimelineElement</h4></summary>
///
///
/// #### `child-property-added`
/// Emitted when the element has a new child property registered. See
/// [`TimelineElementExt::add_child_property()`][crate::prelude::TimelineElementExt::add_child_property()].
///
/// Note that some GES elements will be automatically created with
/// pre-registered children properties. You can use
/// [`TimelineElementExt::list_children_properties()`][crate::prelude::TimelineElementExt::list_children_properties()] to list these.
///
///
///
///
/// #### `child-property-removed`
/// Emitted when the element has a child property unregistered. See
/// [`TimelineElementExt::remove_child_property()`][crate::prelude::TimelineElementExt::remove_child_property()].
///
///
///
///
/// #### `deep-notify`
/// Emitted when a child of the element has one of its registered
/// properties set. See [`TimelineElementExt::add_child_property()`][crate::prelude::TimelineElementExt::add_child_property()].
/// Note that unlike [`notify`][struct@crate::glib::Object#notify], a child property name can not be
/// used as a signal detail.
///
/// Detailed
/// </details>
/// <details><summary><h4>MetaContainer</h4></summary>
///
///
/// #### `notify-meta`
/// This is emitted for a meta container whenever the metadata under one
/// of its fields changes, is set for the first time, or is removed. In
/// the latter case, `value` will be [`None`].
///
/// Detailed
/// </details>
///
/// # Implements
///
/// [`TrackElementExt`][trait@crate::prelude::TrackElementExt], [`TimelineElementExt`][trait@crate::prelude::TimelineElementExt], [`trait@glib::ObjectExt`], [`ExtractableExt`][trait@crate::prelude::ExtractableExt], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt], [`TimelineElementExtManual`][trait@crate::prelude::TimelineElementExtManual]
#[doc(alias = "GESTrackElement")]
pub struct TrackElement(Object<ffi::GESTrackElement, ffi::GESTrackElementClass>) @extends TimelineElement, @implements Extractable, MetaContainer;
match fn {
type_ => || ffi::ges_track_element_get_type(),
}
}
impl TrackElement {
pub const NONE: Option<&'static TrackElement> = None;
}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::TrackElement>> Sealed for T {}
}
/// Trait containing all [`struct@TrackElement`] methods.
///
/// # Implementors
///
/// [`Operation`][struct@crate::Operation], [`Source`][struct@crate::Source], [`TrackElement`][struct@crate::TrackElement]
pub trait TrackElementExt: IsA<TrackElement> + sealed::Sealed + 'static {
/// Adds all the properties of a [`gst::Element`][crate::gst::Element] that match the criteria as
/// children properties of the track element. If the name of `element`'s
/// [`gst::ElementFactory`][crate::gst::ElementFactory] is not in `blacklist`, and the factory's
/// `GST_ELEMENT_METADATA_KLASS` contains at least one member of
/// `wanted_categories` (e.g. `GST_ELEMENT_FACTORY_KLASS_DECODER`), then
/// all the properties of `element` that are also in `whitelist` are added as
/// child properties of `self` using
/// [`TimelineElementExt::add_child_property()`][crate::prelude::TimelineElementExt::add_child_property()].
///
/// This is intended to be used by subclasses when constructing.
/// ## `element`
/// The child object to retrieve properties from
/// ## `wanted_categories`
///
/// An array of element factory "klass" categories to whitelist, or [`None`]
/// to accept all categories
/// ## `blacklist`
/// A
/// blacklist of element factory names, or [`None`] to not blacklist any
/// element factory
/// ## `whitelist`
/// A
/// whitelist of element property names, or [`None`] to whitelist all
/// writeable properties
#[doc(alias = "ges_track_element_add_children_props")]
fn add_children_props(
&self,
element: &impl IsA<gst::Element>,
wanted_categories: &[&str],
blacklist: &[&str],
whitelist: &[&str],
) {
unsafe {
ffi::ges_track_element_add_children_props(
self.as_ref().to_glib_none().0,
element.as_ref().to_glib_none().0,
wanted_categories.to_glib_none().0,
blacklist.to_glib_none().0,
whitelist.to_glib_none().0,
);
}
}
/// Clamp the `GstTimedValueControlSource` for the specified child property
/// to lie between the [`in-point`][struct@crate::TimelineElement#in-point] and out-point of the
/// element. The out-point is the `GES_TIMELINE_ELEMENT_END` of the element
/// translated from the timeline coordinates to the internal source
/// coordinates of the element.
///
/// If the property does not have a `GstTimedValueControlSource` set by
/// [`set_control_source()`][Self::set_control_source()], nothing happens. Otherwise, if
/// a timed value for the control source lies before the in-point of the
/// element, or after its out-point, then it will be removed. At the
/// in-point and out-point times, a new interpolated value will be placed.
/// ## `property_name`
/// The name of the child property to clamp the control
/// source of
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "ges_track_element_clamp_control_source")]
fn clamp_control_source(&self, property_name: &str) {
unsafe {
ffi::ges_track_element_clamp_control_source(
self.as_ref().to_glib_none().0,
property_name.to_glib_none().0,
);
}
}
/// Edits the element within its track.
///
/// # Deprecated since 1.18
///
/// use `ges_timeline_element_edit` instead.
/// ## `layers`
/// A whitelist of layers
/// where the edit can be performed, [`None`] allows all layers in the
/// timeline
/// ## `mode`
/// The edit mode
/// ## `edge`
/// The edge of `self` where the edit should occur
/// ## `position`
/// The edit position: a new location for the edge of `self`
/// (in nanoseconds)
///
/// # Returns
///
/// [`true`] if the edit of `self` completed, [`false`] on failure.
#[cfg_attr(feature = "v1_18", deprecated = "Since 1.18")]
#[allow(deprecated)]
#[doc(alias = "ges_track_element_edit")]
fn edit(
&self,
layers: &[Layer],
mode: EditMode,
edge: Edge,
position: u64,
) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_track_element_edit(
self.as_ref().to_glib_none().0,
layers.to_glib_none().0,
mode.into_glib(),
edge.into_glib(),
position
),
"Failed to edit"
)
}
}
//#[doc(alias = "ges_track_element_get_all_control_bindings")]
//#[doc(alias = "get_all_control_bindings")]
//fn all_control_bindings(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 6, id: 88 } {
// unsafe { TODO: call ffi:ges_track_element_get_all_control_bindings() }
//}
/// Gets [`auto-clamp-control-sources`][struct@crate::TrackElement#auto-clamp-control-sources].
///
/// # Returns
///
/// Whether the control sources for the child properties of
/// `self` are automatically clamped.
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "ges_track_element_get_auto_clamp_control_sources")]
#[doc(alias = "get_auto_clamp_control_sources")]
#[doc(alias = "auto-clamp-control-sources")]
fn is_auto_clamp_control_sources(&self) -> bool {
unsafe {
from_glib(ffi::ges_track_element_get_auto_clamp_control_sources(
self.as_ref().to_glib_none().0,
))
}
}
//#[doc(alias = "ges_track_element_get_child_properties")]
//#[doc(alias = "get_child_properties")]
//fn child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
// unsafe { TODO: call ffi:ges_track_element_get_child_properties() }
//}
/// In general, a copy is made of the property contents and
/// the caller is responsible for freeing the memory by calling
/// [`glib::Value::unset()`][crate::glib::Value::unset()].
///
/// Gets a property of a GstElement contained in `self`.
///
/// Note that `ges_track_element_get_child_property` is really
/// intended for language bindings, `ges_track_element_get_child_properties`
/// is much more convenient for C programming.
///
/// # Deprecated
///
/// Use `ges_timeline_element_get_child_property`
/// ## `property_name`
/// The name of the property
///
/// # Returns
///
/// [`true`] if the property was found, [`false`] otherwise.
///
/// ## `value`
/// return location for the property value, it will
/// be initialized if it is initialized with 0
#[doc(alias = "ges_track_element_get_child_property")]
#[doc(alias = "get_child_property")]
fn child_property(&self, property_name: &str) -> Option<glib::Value> {
unsafe {
let mut value = glib::Value::uninitialized();
let ret = from_glib(ffi::ges_track_element_get_child_property(
self.as_ref().to_glib_none().0,
property_name.to_glib_none().0,
value.to_glib_none_mut().0,
));
if ret {
Some(value)
} else {
None
}
}
}
/// Gets a property of a child of `self`.
///
/// # Deprecated
///
/// Use `ges_timeline_element_get_child_property_by_pspec`
/// ## `pspec`
/// The [`glib::ParamSpec`][crate::glib::ParamSpec] that specifies the property you want to get
///
/// # Returns
///
///
/// ## `value`
/// return location for the value
#[doc(alias = "ges_track_element_get_child_property_by_pspec")]
#[doc(alias = "get_child_property_by_pspec")]
fn child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>) -> glib::Value {
unsafe {
let mut value = glib::Value::uninitialized();
ffi::ges_track_element_get_child_property_by_pspec(
self.as_ref().to_glib_none().0,
pspec.as_ref().to_glib_none().0,
value.to_glib_none_mut().0,
);
value
}
}
//#[doc(alias = "ges_track_element_get_child_property_valist")]
//#[doc(alias = "get_child_property_valist")]
//fn child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
// unsafe { TODO: call ffi:ges_track_element_get_child_property_valist() }
//}
/// Gets the control binding that was created for the specified child
/// property of the track element using
/// [`set_control_source()`][Self::set_control_source()]. The given `property_name` must
/// be the same name of the child property that was passed to
/// [`set_control_source()`][Self::set_control_source()].
/// ## `property_name`
/// The name of the child property to return the control
/// binding of
///
/// # Returns
///
/// The control binding that was
/// created for the specified child property of `self`, or [`None`] if
/// `property_name` does not correspond to any control binding.
#[doc(alias = "ges_track_element_get_control_binding")]
#[doc(alias = "get_control_binding")]
fn control_binding(&self, property_name: &str) -> Option<gst::ControlBinding> {
unsafe {
from_glib_none(ffi::ges_track_element_get_control_binding(
self.as_ref().to_glib_none().0,
property_name.to_glib_none().0,
))
}
}
/// Get the [`gst::Element`][crate::gst::Element] that the track element's underlying nleobject
/// controls.
///
/// # Returns
///
/// The [`gst::Element`][crate::gst::Element] being controlled by the
/// nleobject that `self` wraps.
#[doc(alias = "ges_track_element_get_element")]
#[doc(alias = "get_element")]
fn element(&self) -> Option<gst::Element> {
unsafe {
from_glib_none(ffi::ges_track_element_get_element(
self.as_ref().to_glib_none().0,
))
}
}
/// Get the GNonLin object this object is controlling.
///
/// # Deprecated
///
/// use `ges_track_element_get_nleobject` instead.
///
/// # Returns
///
/// The GNonLin object this object is controlling.
#[doc(alias = "ges_track_element_get_gnlobject")]
#[doc(alias = "get_gnlobject")]
fn gnlobject(&self) -> gst::Element {
unsafe {
from_glib_none(ffi::ges_track_element_get_gnlobject(
self.as_ref().to_glib_none().0,
))
}
}
/// Get the nleobject that this element wraps.
///
/// # Returns
///
/// The nleobject that `self` wraps.
#[doc(alias = "ges_track_element_get_nleobject")]
#[doc(alias = "get_nleobject")]
fn nleobject(&self) -> gst::Element {
unsafe {
from_glib_none(ffi::ges_track_element_get_nleobject(
self.as_ref().to_glib_none().0,
))
}
}
/// Get the [`track`][struct@crate::TrackElement#track] for the element.
///
/// # Returns
///
/// The track that `self` belongs to,
/// or [`None`] if it does not belong to a track.
#[doc(alias = "ges_track_element_get_track")]
#[doc(alias = "get_track")]
fn track(&self) -> Option<Track> {
unsafe {
from_glib_none(ffi::ges_track_element_get_track(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets the [`track-type`][struct@crate::TrackElement#track-type] for the element.
///
/// # Returns
///
/// The track-type of `self`.
#[doc(alias = "ges_track_element_get_track_type")]
#[doc(alias = "get_track_type")]
#[doc(alias = "track-type")]
fn track_type(&self) -> TrackType {
unsafe {
from_glib(ffi::ges_track_element_get_track_type(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets [`has-internal-source`][struct@crate::TrackElement#has-internal-source] for the element.
///
/// # Returns
///
/// [`true`] if `self` can have its 'internal time' properties set.
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "ges_track_element_has_internal_source")]
fn has_internal_source(&self) -> bool {
unsafe {
from_glib(ffi::ges_track_element_has_internal_source(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets [`active`][struct@crate::TrackElement#active] for the element.
///
/// # Returns
///
/// [`true`] if `self` is active in its track.
#[doc(alias = "ges_track_element_is_active")]
fn is_active(&self) -> bool {
unsafe {
from_glib(ffi::ges_track_element_is_active(
self.as_ref().to_glib_none().0,
))
}
}
/// Get whether the given track element is a core track element. That is,
/// it was created by the `create_track_elements` `GESClipClass` method for
/// some [`Clip`][crate::Clip].
///
/// Note that such a track element can only be added to a clip that shares
/// the same [`Asset`][crate::Asset] as the clip that created it. For example, you are
/// allowed to move core children between clips that resulted from
/// [`GESContainerExt::ungroup()`][crate::prelude::GESContainerExt::ungroup()], but you could not move the core child from a
/// [`UriClip`][crate::UriClip] to a [`TitleClip`][crate::TitleClip] or another [`UriClip`][crate::UriClip] with a different
/// [`uri`][struct@crate::UriClip#uri].
///
/// Moreover, if a core track element is added to a clip, it will always be
/// added as a core child. Therefore, if this returns [`true`], then `element`
/// will be a core child of its parent clip.
///
/// # Returns
///
/// [`true`] if `element` is a core track element.
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "ges_track_element_is_core")]
fn is_core(&self) -> bool {
unsafe {
from_glib(ffi::ges_track_element_is_core(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets an array of [`glib::ParamSpec`][crate::glib::ParamSpec]* for all configurable properties of the
/// children of `self`.
///
/// # Deprecated
///
/// Use `ges_timeline_element_list_children_properties`
///
/// # Returns
///
/// An array of [`glib::ParamSpec`][crate::glib::ParamSpec]* which should be freed after use or
/// [`None`] if something went wrong.
#[doc(alias = "ges_track_element_list_children_properties")]
fn list_children_properties(&self) -> Vec<glib::ParamSpec> {
unsafe {
let mut n_properties = std::mem::MaybeUninit::uninit();
let ret = FromGlibContainer::from_glib_full_num(
ffi::ges_track_element_list_children_properties(
self.as_ref().to_glib_none().0,
n_properties.as_mut_ptr(),
),
n_properties.assume_init() as _,
);
ret
}
}
/// Looks up which `element` and `pspec` would be effected by the given `name`. If various
/// contained elements have this property name you will get the first one, unless you
/// specify the class name in `name`.
///
/// # Deprecated
///
/// Use `ges_timeline_element_lookup_child`
/// ## `prop_name`
/// Name of the property to look up. You can specify the name of the
/// class as such: "ClassName::property-name", to guarantee that you get the
/// proper GParamSpec in case various GstElement-s contain the same property
/// name. If you don't do so, you will get the first element found, having
/// this property and the and the corresponding GParamSpec.
///
/// # Returns
///
/// TRUE if `element` and `pspec` could be found. FALSE otherwise. In that
/// case the values for `pspec` and `element` are not modified. Unref `element` after
/// usage.
///
/// ## `element`
/// pointer to a [`gst::Element`][crate::gst::Element] that
/// takes the real object to set property on
///
/// ## `pspec`
/// pointer to take the specification
/// describing the property
#[doc(alias = "ges_track_element_lookup_child")]
fn lookup_child(&self, prop_name: &str) -> Option<(gst::Element, glib::ParamSpec)> {
unsafe {
let mut element = std::ptr::null_mut();
let mut pspec = std::ptr::null_mut();
let ret = from_glib(ffi::ges_track_element_lookup_child(
self.as_ref().to_glib_none().0,
prop_name.to_glib_none().0,
&mut element,
&mut pspec,
));
if ret {
Some((from_glib_full(element), from_glib_full(pspec)))
} else {
None
}
}
}
/// Removes the [`gst::ControlBinding`][crate::gst::ControlBinding] that was created for the specified child
/// property of the track element using
/// [`set_control_source()`][Self::set_control_source()]. The given `property_name` must
/// be the same name of the child property that was passed to
/// [`set_control_source()`][Self::set_control_source()].
/// ## `property_name`
/// The name of the child property to remove the control
/// binding from
///
/// # Returns
///
/// [`true`] if the control binding was removed from the specified
/// child property of `self`, or [`false`] if an error occurred.
#[doc(alias = "ges_track_element_remove_control_binding")]
fn remove_control_binding(&self, property_name: &str) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_track_element_remove_control_binding(
self.as_ref().to_glib_none().0,
property_name.to_glib_none().0
),
"Failed to remove control binding"
)
}
}
/// Sets [`active`][struct@crate::TrackElement#active] for the element.
/// ## `active`
/// Whether `self` should be active in its track
///
/// # Returns
///
/// [`true`] if the property was *toggled*.
#[doc(alias = "ges_track_element_set_active")]
#[doc(alias = "active")]
fn set_active(&self, active: bool) -> bool {
unsafe {
from_glib(ffi::ges_track_element_set_active(
self.as_ref().to_glib_none().0,
active.into_glib(),
))
}
}
/// Sets [`auto-clamp-control-sources`][struct@crate::TrackElement#auto-clamp-control-sources]. If set to [`true`], this
/// will immediately clamp all the control sources.
/// ## `auto_clamp`
/// Whether to automatically clamp the control sources for the
/// child properties of `self`
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "ges_track_element_set_auto_clamp_control_sources")]
#[doc(alias = "auto-clamp-control-sources")]
fn set_auto_clamp_control_sources(&self, auto_clamp: bool) {
unsafe {
ffi::ges_track_element_set_auto_clamp_control_sources(
self.as_ref().to_glib_none().0,
auto_clamp.into_glib(),
);
}
}
//#[doc(alias = "ges_track_element_set_child_properties")]
//fn set_child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
// unsafe { TODO: call ffi:ges_track_element_set_child_properties() }
//}
/// Sets a property of a GstElement contained in `self`.
///
/// Note that `ges_track_element_set_child_property` is really
/// intended for language bindings, `ges_track_element_set_child_properties`
/// is much more convenient for C programming.
///
/// # Deprecated
///
/// use `ges_timeline_element_set_child_property` instead
/// ## `property_name`
/// The name of the property
/// ## `value`
/// The value
///
/// # Returns
///
/// [`true`] if the property was set, [`false`] otherwise.
#[doc(alias = "ges_track_element_set_child_property")]
fn set_child_property(
&self,
property_name: &str,
value: &glib::Value,
) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_track_element_set_child_property(
self.as_ref().to_glib_none().0,
property_name.to_glib_none().0,
mut_override(value.to_glib_none().0)
),
"Failed to set child property"
)
}
}
/// Sets a property of a child of `self`.
///
/// # Deprecated
///
/// Use `ges_timeline_element_set_child_property_by_spec`
/// ## `pspec`
/// The [`glib::ParamSpec`][crate::glib::ParamSpec] that specifies the property you want to set
/// ## `value`
/// The value
#[doc(alias = "ges_track_element_set_child_property_by_pspec")]
fn set_child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>, value: &glib::Value) {
unsafe {
ffi::ges_track_element_set_child_property_by_pspec(
self.as_ref().to_glib_none().0,
pspec.as_ref().to_glib_none().0,
mut_override(value.to_glib_none().0),
);
}
}
//#[doc(alias = "ges_track_element_set_child_property_valist")]
//fn set_child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
// unsafe { TODO: call ffi:ges_track_element_set_child_property_valist() }
//}
/// Creates a [`gst::ControlBinding`][crate::gst::ControlBinding] for the specified child property of the
/// track element using the given control source. The given `property_name`
/// should refer to an existing child property of the track element, as
/// used in [`TimelineElementExt::lookup_child()`][crate::prelude::TimelineElementExt::lookup_child()].
///
/// If `binding_type` is "direct", then the control binding is created with
/// `gst_direct_control_binding_new()` using the given control source. If
/// `binding_type` is "direct-absolute", it is created with
/// `gst_direct_control_binding_new_absolute()` instead.
/// ## `source`
/// The control source to bind the child property to
/// ## `property_name`
/// The name of the child property to control
/// ## `binding_type`
/// The type of binding to create ("direct" or
/// "direct-absolute")
///
/// # Returns
///
/// [`true`] if the specified child property could be bound to
/// `source`, or [`false`] if an error occurred.
#[doc(alias = "ges_track_element_set_control_source")]
fn set_control_source(
&self,
source: &impl IsA<gst::ControlSource>,
property_name: &str,
binding_type: &str,
) -> bool {
unsafe {
from_glib(ffi::ges_track_element_set_control_source(
self.as_ref().to_glib_none().0,
source.as_ref().to_glib_none().0,
property_name.to_glib_none().0,
binding_type.to_glib_none().0,
))
}
}
/// Sets [`has-internal-source`][struct@crate::TrackElement#has-internal-source] for the element. If this is
/// set to [`false`], this method will also set the
/// [`in-point`][struct@crate::TimelineElement#in-point] of the element to 0 and its
/// [`max-duration`][struct@crate::TimelineElement#max-duration] to `GST_CLOCK_TIME_NONE`.
/// ## `has_internal_source`
/// Whether the `self` should be allowed to have its
/// 'internal time' properties set.
///
/// # Returns
///
/// [`false`] if `has_internal_source` is forbidden for `self` and
/// [`true`] in any other case.
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "ges_track_element_set_has_internal_source")]
#[doc(alias = "has-internal-source")]
fn set_has_internal_source(&self, has_internal_source: bool) -> bool {
unsafe {
from_glib(ffi::ges_track_element_set_has_internal_source(
self.as_ref().to_glib_none().0,
has_internal_source.into_glib(),
))
}
}
/// Sets the [`track-type`][struct@crate::TrackElement#track-type] for the element.
/// ## `type_`
/// The new track-type for `self`
#[doc(alias = "ges_track_element_set_track_type")]
#[doc(alias = "track-type")]
fn set_track_type(&self, type_: TrackType) {
unsafe {
ffi::ges_track_element_set_track_type(
self.as_ref().to_glib_none().0,
type_.into_glib(),
);
}
}
/// This is emitted when a control binding is added to a child property
/// of the track element.
/// ## `control_binding`
/// The control binding that has been added
#[doc(alias = "control-binding-added")]
fn connect_control_binding_added<F: Fn(&Self, &gst::ControlBinding) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn control_binding_added_trampoline<
P: IsA<TrackElement>,
F: Fn(&P, &gst::ControlBinding) + 'static,
>(
this: *mut ffi::GESTrackElement,
control_binding: *mut gst::ffi::GstControlBinding,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
TrackElement::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(control_binding),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"control-binding-added\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
control_binding_added_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
/// This is emitted when a control binding is removed from a child
/// property of the track element.
/// ## `control_binding`
/// The control binding that has been removed
#[doc(alias = "control-binding-removed")]
fn connect_control_binding_removed<F: Fn(&Self, &gst::ControlBinding) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn control_binding_removed_trampoline<
P: IsA<TrackElement>,
F: Fn(&P, &gst::ControlBinding) + 'static,
>(
this: *mut ffi::GESTrackElement,
control_binding: *mut gst::ffi::GstControlBinding,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
TrackElement::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(control_binding),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"control-binding-removed\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
control_binding_removed_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "active")]
fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_active_trampoline<P: IsA<TrackElement>, F: Fn(&P) + 'static>(
this: *mut ffi::GESTrackElement,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::active\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_active_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "auto-clamp-control-sources")]
fn connect_auto_clamp_control_sources_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_auto_clamp_control_sources_trampoline<
P: IsA<TrackElement>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GESTrackElement,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::auto-clamp-control-sources\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_auto_clamp_control_sources_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "has-internal-source")]
fn connect_has_internal_source_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_has_internal_source_trampoline<
P: IsA<TrackElement>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GESTrackElement,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::has-internal-source\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_has_internal_source_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "track")]
fn connect_track_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_track_trampoline<P: IsA<TrackElement>, F: Fn(&P) + 'static>(
this: *mut ffi::GESTrackElement,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::track\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_track_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "track-type")]
fn connect_track_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_track_type_trampoline<
P: IsA<TrackElement>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GESTrackElement,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::track-type\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_track_type_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl<O: IsA<TrackElement>> TrackElementExt for O {}