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 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684
// 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, Extractable, MetaContainer, Timeline, TrackType};
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
use crate::{Edge, EditMode, Layer};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
/// A [`TimelineElement`][crate::TimelineElement] will have some temporal extent in its
/// corresponding [`timeline`][struct@crate::TimelineElement#timeline], controlled by its
/// [`start`][struct@crate::TimelineElement#start] and [`duration`][struct@crate::TimelineElement#duration]. This
/// determines when its content will be displayed, or its effect applied,
/// in the timeline. Several objects may overlap within a given
/// [`Timeline`][crate::Timeline], in which case their [`priority`][struct@crate::TimelineElement#priority] is used
/// to determine their ordering in the timeline. Priority is mostly handled
/// internally by [`Layer`][crate::Layer]-s and [`Clip`][crate::Clip]-s.
///
/// A timeline element can have a [`parent`][struct@crate::TimelineElement#parent],
/// such as a [`Clip`][crate::Clip], which is responsible for controlling its timing.
///
/// ## Editing
///
/// Elements can be moved around in their [`timeline`][struct@crate::TimelineElement#timeline] by
/// setting their [`start`][struct@crate::TimelineElement#start] and
/// [`duration`][struct@crate::TimelineElement#duration] using [`TimelineElementExt::set_start()`][crate::prelude::TimelineElementExt::set_start()]
/// and [`TimelineElementExt::set_duration()`][crate::prelude::TimelineElementExt::set_duration()]. Additionally, which parts of
/// the underlying content are played in the timeline can be adjusted by
/// setting the [`in-point`][struct@crate::TimelineElement#in-point] using
/// [`TimelineElementExt::set_inpoint()`][crate::prelude::TimelineElementExt::set_inpoint()]. The library also provides
/// [`TimelineElementExt::edit()`][crate::prelude::TimelineElementExt::edit()], with various [`EditMode`][crate::EditMode]-s, which can
/// adjust these properties in a convenient way, as well as introduce
/// similar changes in neighbouring or later elements in the timeline.
///
/// However, a timeline may refuse a change in these properties if they
/// would place the timeline in an unsupported configuration. See
/// [`Timeline`][crate::Timeline] for its overlap rules.
///
/// Additionally, an edit may be refused if it would place one of the
/// timing properties out of bounds (such as a negative time value for
/// [`start`][struct@crate::TimelineElement#start], or having insufficient internal
/// content to last for the desired [`duration`][struct@crate::TimelineElement#duration]).
///
/// ## Time Coordinates
///
/// There are three main sets of time coordinates to consider when using
/// timeline elements:
///
/// + Timeline coordinates: these are the time coordinates used in the
/// output of the timeline in its [`Track`][crate::Track]-s. Each track share the same
/// coordinates, so there is only one set of coordinates for the
/// timeline. These extend indefinitely from 0. The times used for
/// editing (including setting [`start`][struct@crate::TimelineElement#start] and
/// [`duration`][struct@crate::TimelineElement#duration]) use these coordinates, since these
/// define when an element is present and for how long the element lasts
/// for in the timeline.
/// + Internal source coordinates: these are the time coordinates used
/// internally at the element's output. This is only really defined for
/// [`TrackElement`][crate::TrackElement]-s, where it refers to time coordinates used at the
/// final source pad of the wrapped [`gst::Element`][crate::gst::Element]-s. However, these
/// coordinates may also be used in a [`Clip`][crate::Clip] in reference to its
/// children. In particular, these are the coordinates used for
/// [`in-point`][struct@crate::TimelineElement#in-point] and [`max-duration`][struct@crate::TimelineElement#max-duration].
/// + Internal sink coordinates: these are the time coordinates used
/// internally at the element's input. A [`Source`][crate::Source] has no input, so
/// these would be undefined. Otherwise, for most [`TrackElement`][crate::TrackElement]-s
/// these will be the same set of coordinates as the internal source
/// coordinates because the element does not change the timing
/// internally. Only [`BaseEffect`][crate::BaseEffect] can support elements where these
/// are different. See [`BaseEffect`][crate::BaseEffect] for more information.
///
/// You can determine the timeline time for a given internal source time
/// in a [`Track`][crate::Track] in a [`Clip`][crate::Clip] using
/// [`ClipExt::timeline_time_from_internal_time()`][crate::prelude::ClipExt::timeline_time_from_internal_time()], and vice versa using
/// [`ClipExt::internal_time_from_timeline_time()`][crate::prelude::ClipExt::internal_time_from_timeline_time()], for the purposes of
/// editing and setting timings properties.
///
/// ## Children Properties
///
/// If a timeline element owns another [`gst::Object`][crate::gst::Object] and wishes to expose
/// some of its properties, it can do so by registering the property as one
/// of the timeline element's children properties using
/// [`TimelineElementExt::add_child_property()`][crate::prelude::TimelineElementExt::add_child_property()]. The registered property of
/// the child can then be read and set using the
/// [`TimelineElementExt::child_property()`][crate::prelude::TimelineElementExt::child_property()] and
/// [`TimelineElementExt::set_child_property()`][crate::prelude::TimelineElementExt::set_child_property()] methods, respectively. Some
/// sub-classed objects will be created with pre-registered children
/// properties; for example, to expose part of an underlying [`gst::Element`][crate::gst::Element]
/// that is used internally. The registered properties can be listed with
/// [`TimelineElementExt::list_children_properties()`][crate::prelude::TimelineElementExt::list_children_properties()].
///
/// This is an Abstract Base Class, you cannot instantiate it.
///
/// ## Properties
///
///
/// #### `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
///
/// ## Signals
///
///
/// #### `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><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
///
/// [`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 = "GESTimelineElement")]
pub struct TimelineElement(Object<ffi::GESTimelineElement, ffi::GESTimelineElementClass>) @implements Extractable, MetaContainer;
match fn {
type_ => || ffi::ges_timeline_element_get_type(),
}
}
impl TimelineElement {
pub const NONE: Option<&'static TimelineElement> = None;
}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::TimelineElement>> Sealed for T {}
}
/// Trait containing all [`struct@TimelineElement`] methods.
///
/// # Implementors
///
/// [`Container`][struct@crate::Container], [`TimelineElement`][struct@crate::TimelineElement], [`TrackElement`][struct@crate::TrackElement]
pub trait TimelineElementExt: IsA<TimelineElement> + sealed::Sealed + 'static {
/// Register a property of a child of the element to allow it to be
/// written with [`set_child_property()`][Self::set_child_property()] and read with
/// [`child_property()`][Self::child_property()]. A change in the property
/// will also appear in the [`deep-notify`][struct@crate::TimelineElement#deep-notify] signal.
///
/// `pspec` should be unique from other children properties that have been
/// registered on `self`.
/// ## `pspec`
/// The specification for the property to add
/// ## `child`
/// The [`gst::Object`][crate::gst::Object] who the property belongs to
///
/// # Returns
///
/// [`true`] if the property was successfully registered.
#[doc(alias = "ges_timeline_element_add_child_property")]
fn add_child_property(
&self,
pspec: impl AsRef<glib::ParamSpec>,
child: &impl IsA<glib::Object>,
) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_element_add_child_property(
self.as_ref().to_glib_none().0,
pspec.as_ref().to_glib_none().0,
child.as_ref().to_glib_none().0
),
"Failed to add child property"
)
}
}
#[doc(alias = "ges_timeline_element_copy")]
#[must_use]
fn copy(&self, deep: bool) -> TimelineElement {
unsafe {
from_glib_none(ffi::ges_timeline_element_copy(
self.as_ref().to_glib_none().0,
deep.into_glib(),
))
}
}
/// See [`edit_full()`][Self::edit_full()], which also gives an error.
///
/// Note that the `layers` argument is currently ignored, so you should
/// just pass [`None`].
/// ## `layers`
/// A whitelist of layers
/// where the edit can be performed, [`None`] allows all layers in the
/// timeline.
/// ## `new_layer_priority`
/// The priority/index of the layer `self` should be
/// moved to. -1 means no move
/// ## `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) in the timeline coordinates
///
/// # Returns
///
/// [`true`] if the edit of `self` completed, [`false`] on failure.
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "ges_timeline_element_edit")]
fn edit(
&self,
layers: &[Layer],
new_layer_priority: i64,
mode: EditMode,
edge: Edge,
position: u64,
) -> bool {
unsafe {
from_glib(ffi::ges_timeline_element_edit(
self.as_ref().to_glib_none().0,
layers.to_glib_none().0,
new_layer_priority,
mode.into_glib(),
edge.into_glib(),
position,
))
}
}
/// Edits the element within its timeline by adjusting its
/// [`start`][struct@crate::TimelineElement#start], [`duration`][struct@crate::TimelineElement#duration] or
/// [`in-point`][struct@crate::TimelineElement#in-point], and potentially doing the same for
/// other elements in the timeline. See [`EditMode`][crate::EditMode] for details about each
/// edit mode. An edit may fail if it would place one of these properties
/// out of bounds, or if it would place the timeline in an unsupported
/// configuration.
///
/// Note that if you act on a [`TrackElement`][crate::TrackElement], this will edit its parent
/// [`Clip`][crate::Clip] instead. Moreover, for any [`TimelineElement`][crate::TimelineElement], if you select
/// [`Edge::None`][crate::Edge::None] for [`EditMode::Normal`][crate::EditMode::Normal] or [`EditMode::Ripple`][crate::EditMode::Ripple], this
/// will edit the toplevel instead, but still in such a way as to make the
/// [`start`][struct@crate::TimelineElement#start] of `self` reach the edit `position`.
///
/// Note that if the element's timeline has a
/// [`snapping-distance`][struct@crate::Timeline#snapping-distance] set, then the edit position may be
/// snapped to the edge of some element under the edited element.
///
/// `new_layer_priority` can be used to switch `self`, and other elements
/// moved by the edit, to a new layer. New layers may be be created if the
/// the corresponding layer priority/index does not yet exist for the
/// timeline.
/// ## `new_layer_priority`
/// The priority/index of the layer `self` should be
/// moved to. -1 means no move
/// ## `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) in the timeline coordinates
///
/// # Returns
///
/// [`true`] if the edit of `self` completed, [`false`] on failure.
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "ges_timeline_element_edit_full")]
fn edit_full(
&self,
new_layer_priority: i64,
mode: EditMode,
edge: Edge,
position: u64,
) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::ges_timeline_element_edit_full(
self.as_ref().to_glib_none().0,
new_layer_priority,
mode.into_glib(),
edge.into_glib(),
position,
&mut error,
);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
//#[doc(alias = "ges_timeline_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_timeline_element_get_child_properties() }
//}
/// Gets the property of a child of the element.
///
/// `property_name` can either be in the format "prop-name" or
/// "TypeName::prop-name", where "prop-name" is the name of the property
/// to get (as used in [`ObjectExt::get()`][crate::glib::prelude::ObjectExt::get()]), and "TypeName" is the type name of
/// the child (as returned by G_OBJECT_TYPE_NAME()). The latter format is
/// useful when two children of different types share the same property
/// name.
///
/// The first child found with the given "prop-name" property that was
/// registered with [`add_child_property()`][Self::add_child_property()] (and of the
/// type "TypeName", if it was given) will have the corresponding
/// property copied into `value`.
///
/// Note that `ges_timeline_element_get_child_properties()` may be more
/// convenient for C programming.
/// ## `property_name`
/// The name of the child property to get
///
/// # Returns
///
/// [`true`] if the property was found and copied to `value`.
///
/// ## `value`
/// The return location for the value
#[doc(alias = "ges_timeline_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_timeline_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 the property of a child of the element. Specifically, the property
/// corresponding to the `pspec` used in
/// [`add_child_property()`][Self::add_child_property()] is copied into `value`.
/// ## `pspec`
/// The specification of a registered child property to get
///
/// # Returns
///
///
/// ## `value`
/// The return location for the value
#[doc(alias = "ges_timeline_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_timeline_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_timeline_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_timeline_element_get_child_property_valist() }
//}
/// Gets the [`duration`][struct@crate::TimelineElement#duration] for the element.
///
/// # Returns
///
/// The duration of `self` (in nanoseconds).
#[doc(alias = "ges_timeline_element_get_duration")]
#[doc(alias = "get_duration")]
fn duration(&self) -> gst::ClockTime {
unsafe {
try_from_glib(ffi::ges_timeline_element_get_duration(
self.as_ref().to_glib_none().0,
))
.expect("mandatory glib value is None")
}
}
/// Gets the [`in-point`][struct@crate::TimelineElement#in-point] for the element.
///
/// # Returns
///
/// The in-point of `self` (in nanoseconds).
#[doc(alias = "ges_timeline_element_get_inpoint")]
#[doc(alias = "get_inpoint")]
fn inpoint(&self) -> gst::ClockTime {
unsafe {
try_from_glib(ffi::ges_timeline_element_get_inpoint(
self.as_ref().to_glib_none().0,
))
.expect("mandatory glib value is None")
}
}
/// Gets the priority of the layer the element is in. A [`Group`][crate::Group] may span
/// several layers, so this would return the highest priority (numerically,
/// the smallest) amongst them.
///
/// # Returns
///
/// The priority of the layer `self` is in, or
/// `GES_TIMELINE_ELEMENT_NO_LAYER_PRIORITY` if `self` does not exist in a
/// layer.
#[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
#[doc(alias = "ges_timeline_element_get_layer_priority")]
#[doc(alias = "get_layer_priority")]
fn layer_priority(&self) -> u32 {
unsafe { ffi::ges_timeline_element_get_layer_priority(self.as_ref().to_glib_none().0) }
}
/// Gets the [`max-duration`][struct@crate::TimelineElement#max-duration] for the element.
///
/// # Returns
///
/// The max-duration of `self` (in nanoseconds).
#[doc(alias = "ges_timeline_element_get_max_duration")]
#[doc(alias = "get_max_duration")]
#[doc(alias = "max-duration")]
fn max_duration(&self) -> Option<gst::ClockTime> {
unsafe {
from_glib(ffi::ges_timeline_element_get_max_duration(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets the [`name`][struct@crate::TimelineElement#name] for the element.
///
/// # Returns
///
/// The name of `self`.
#[doc(alias = "ges_timeline_element_get_name")]
#[doc(alias = "get_name")]
fn name(&self) -> Option<glib::GString> {
unsafe {
from_glib_full(ffi::ges_timeline_element_get_name(
self.as_ref().to_glib_none().0,
))
}
}
/// Get the "natural" framerate of `self`. This is to say, for example
/// for a [`VideoUriSource`][crate::VideoUriSource] the framerate of the source.
///
/// Note that a [`AudioSource`][crate::AudioSource] may also have a natural framerate if it derives
/// from the same [`SourceClip`][crate::SourceClip] asset as a [`VideoSource`][crate::VideoSource], and its value will
/// be that of the video source. For example, if the uri of a [`UriClip`][crate::UriClip] points
/// to a file that contains both a video and audio stream, then the corresponding
/// [`AudioUriSource`][crate::AudioUriSource] will share the natural framerate of the corresponding
/// [`VideoUriSource`][crate::VideoUriSource].
///
/// # Returns
///
/// Whether `self` has a natural framerate or not, `framerate_n`
/// and `framerate_d` will be set to, respectively, 0 and -1 if it is
/// not the case.
///
/// ## `framerate_n`
/// The framerate numerator
///
/// ## `framerate_d`
/// The framerate denominator
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "ges_timeline_element_get_natural_framerate")]
#[doc(alias = "get_natural_framerate")]
fn natural_framerate(&self) -> Option<(i32, i32)> {
unsafe {
let mut framerate_n = std::mem::MaybeUninit::uninit();
let mut framerate_d = std::mem::MaybeUninit::uninit();
let ret = from_glib(ffi::ges_timeline_element_get_natural_framerate(
self.as_ref().to_glib_none().0,
framerate_n.as_mut_ptr(),
framerate_d.as_mut_ptr(),
));
if ret {
Some((framerate_n.assume_init(), framerate_d.assume_init()))
} else {
None
}
}
}
/// Gets the [`parent`][struct@crate::TimelineElement#parent] for the element.
///
/// # Returns
///
/// The parent of `self`, or [`None`] if
/// `self` has no parent.
#[doc(alias = "ges_timeline_element_get_parent")]
#[doc(alias = "get_parent")]
#[must_use]
fn parent(&self) -> Option<TimelineElement> {
unsafe {
from_glib_full(ffi::ges_timeline_element_get_parent(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets the [`priority`][struct@crate::TimelineElement#priority] for the element.
///
/// # Returns
///
/// The priority of `self`.
#[doc(alias = "ges_timeline_element_get_priority")]
#[doc(alias = "get_priority")]
fn priority(&self) -> u32 {
unsafe { ffi::ges_timeline_element_get_priority(self.as_ref().to_glib_none().0) }
}
/// Gets the [`start`][struct@crate::TimelineElement#start] for the element.
///
/// # Returns
///
/// The start of `self` (in nanoseconds).
#[doc(alias = "ges_timeline_element_get_start")]
#[doc(alias = "get_start")]
fn start(&self) -> gst::ClockTime {
unsafe {
try_from_glib(ffi::ges_timeline_element_get_start(
self.as_ref().to_glib_none().0,
))
.expect("mandatory glib value is None")
}
}
/// Gets the [`timeline`][struct@crate::TimelineElement#timeline] for the element.
///
/// # Returns
///
/// The timeline of `self`, or [`None`]
/// if `self` has no timeline.
#[doc(alias = "ges_timeline_element_get_timeline")]
#[doc(alias = "get_timeline")]
fn timeline(&self) -> Option<Timeline> {
unsafe {
from_glib_full(ffi::ges_timeline_element_get_timeline(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets the toplevel [`parent`][struct@crate::TimelineElement#parent] of the element.
///
/// # Returns
///
/// The toplevel parent of `self`.
#[doc(alias = "ges_timeline_element_get_toplevel_parent")]
#[doc(alias = "get_toplevel_parent")]
#[must_use]
fn toplevel_parent(&self) -> TimelineElement {
unsafe {
from_glib_full(ffi::ges_timeline_element_get_toplevel_parent(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets the track types that the element can interact with, i.e. the type
/// of [`Track`][crate::Track] it can exist in, or will create [`TrackElement`][crate::TrackElement]-s for.
///
/// # Returns
///
/// The track types that `self` supports.
#[doc(alias = "ges_timeline_element_get_track_types")]
#[doc(alias = "get_track_types")]
fn track_types(&self) -> TrackType {
unsafe {
from_glib(ffi::ges_timeline_element_get_track_types(
self.as_ref().to_glib_none().0,
))
}
}
/// Get a list of children properties of the element, which is a list of
/// all the specifications passed to
/// [`add_child_property()`][Self::add_child_property()].
///
/// # Returns
///
/// An array of
/// [`glib::ParamSpec`][crate::glib::ParamSpec] corresponding to the child properties of `self`, or [`None`] if
/// something went wrong.
#[doc(alias = "ges_timeline_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_timeline_element_list_children_properties(
self.as_ref().to_glib_none().0,
n_properties.as_mut_ptr(),
),
n_properties.assume_init() as _,
);
ret
}
}
/// Looks up a child property of the element.
///
/// `prop_name` can either be in the format "prop-name" or
/// "TypeName::prop-name", where "prop-name" is the name of the property
/// to look up (as used in [`ObjectExt::get()`][crate::glib::prelude::ObjectExt::get()]), and "TypeName" is the type name
/// of the child (as returned by G_OBJECT_TYPE_NAME()). The latter format is
/// useful when two children of different types share the same property
/// name.
///
/// The first child found with the given "prop-name" property that was
/// registered with [`add_child_property()`][Self::add_child_property()] (and of the
/// type "TypeName", if it was given) will be passed to `child`, and the
/// registered specification of this property will be passed to `pspec`.
/// ## `prop_name`
/// The name of a child property
///
/// # Returns
///
/// [`true`] if a child corresponding to the property was found, in
/// which case `child` and `pspec` are set.
///
/// ## `child`
/// The return location for the
/// found child
///
/// ## `pspec`
/// The return location for the
/// specification of the child property
#[doc(alias = "ges_timeline_element_lookup_child")]
fn lookup_child(&self, prop_name: &str) -> Option<(glib::Object, glib::ParamSpec)> {
unsafe {
let mut child = std::ptr::null_mut();
let mut pspec = std::ptr::null_mut();
let ret = from_glib(ffi::ges_timeline_element_lookup_child(
self.as_ref().to_glib_none().0,
prop_name.to_glib_none().0,
&mut child,
&mut pspec,
));
if ret {
Some((from_glib_full(child), from_glib_full(pspec)))
} else {
None
}
}
}
/// Paste an element inside the same timeline and layer as `self`. `self`
/// **must** be the return of `ges_timeline_element_copy()` with `deep=TRUE`,
/// and it should not be changed before pasting.
/// `self` is not placed in the timeline, instead a new element is created,
/// alike to the originally copied element. Note that the originally
/// copied element must stay within the same timeline and layer, at both
/// the point of copying and pasting.
///
/// Pasting may fail if it would place the timeline in an unsupported
/// configuration.
///
/// After calling this function `element` should not be used. In particular,
/// `element` can **not** be pasted again. Instead, you can copy the
/// returned element and paste that copy (although, this is only possible
/// if the paste was successful).
///
/// See also [`TimelineExt::paste_element()`][crate::prelude::TimelineExt::paste_element()].
/// ## `paste_position`
/// The position in the timeline `element` should be pasted
/// to, i.e. the [`start`][struct@crate::TimelineElement#start] value for the pasted element.
///
/// # Returns
///
/// The newly created element, or
/// [`None`] if pasting fails.
#[doc(alias = "ges_timeline_element_paste")]
fn paste(&self, paste_position: gst::ClockTime) -> Result<TimelineElement, glib::BoolError> {
unsafe {
Option::<_>::from_glib_full(ffi::ges_timeline_element_paste(
self.as_ref().to_glib_none().0,
paste_position.into_glib(),
))
.ok_or_else(|| glib::bool_error!("Failed to paste timeline element"))
}
}
/// Remove a child property from the element. `pspec` should be a
/// specification that was passed to
/// [`add_child_property()`][Self::add_child_property()]. The corresponding property
/// will no longer be registered as a child property for the element.
/// ## `pspec`
/// The specification for the property to remove
///
/// # Returns
///
/// [`true`] if the property was successfully un-registered for `self`.
#[doc(alias = "ges_timeline_element_remove_child_property")]
fn remove_child_property(
&self,
pspec: impl AsRef<glib::ParamSpec>,
) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_element_remove_child_property(
self.as_ref().to_glib_none().0,
pspec.as_ref().to_glib_none().0
),
"Failed to remove child property"
)
}
}
/// Edits the start time of an element within its timeline in ripple mode.
/// See [`edit()`][Self::edit()] with [`EditMode::Ripple`][crate::EditMode::Ripple] and
/// [`Edge::None`][crate::Edge::None].
/// ## `start`
/// The new start time of `self` in ripple mode
///
/// # Returns
///
/// [`true`] if the ripple edit of `self` completed, [`false`] on
/// failure.
#[doc(alias = "ges_timeline_element_ripple")]
fn ripple(&self, start: gst::ClockTime) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_element_ripple(self.as_ref().to_glib_none().0, start.into_glib()),
"Failed to ripple"
)
}
}
/// Edits the end time of an element within its timeline in ripple mode.
/// See [`edit()`][Self::edit()] with [`EditMode::Ripple`][crate::EditMode::Ripple] and
/// [`Edge::End`][crate::Edge::End].
/// ## `end`
/// The new end time of `self` in ripple mode
///
/// # Returns
///
/// [`true`] if the ripple edit of `self` completed, [`false`] on
/// failure.
#[doc(alias = "ges_timeline_element_ripple_end")]
fn ripple_end(&self, end: gst::ClockTime) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_element_ripple_end(
self.as_ref().to_glib_none().0,
end.into_glib()
),
"Failed to ripple"
)
}
}
/// Edits the end time of an element within its timeline in roll mode.
/// See [`edit()`][Self::edit()] with [`EditMode::Roll`][crate::EditMode::Roll] and
/// [`Edge::End`][crate::Edge::End].
/// ## `end`
/// The new end time of `self` in roll mode
///
/// # Returns
///
/// [`true`] if the roll edit of `self` completed, [`false`] on failure.
#[doc(alias = "ges_timeline_element_roll_end")]
fn roll_end(&self, end: gst::ClockTime) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_element_roll_end(self.as_ref().to_glib_none().0, end.into_glib()),
"Failed to roll"
)
}
}
/// Edits the start time of an element within its timeline in roll mode.
/// See [`edit()`][Self::edit()] with [`EditMode::Roll`][crate::EditMode::Roll] and
/// [`Edge::Start`][crate::Edge::Start].
/// ## `start`
/// The new start time of `self` in roll mode
///
/// # Returns
///
/// [`true`] if the roll edit of `self` completed, [`false`] on failure.
#[doc(alias = "ges_timeline_element_roll_start")]
fn roll_start(&self, start: gst::ClockTime) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_element_roll_start(
self.as_ref().to_glib_none().0,
start.into_glib()
),
"Failed to roll"
)
}
}
//#[doc(alias = "ges_timeline_element_set_child_properties")]
//fn set_child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
// unsafe { TODO: call ffi:ges_timeline_element_set_child_properties() }
//}
/// See [`set_child_property_full()`][Self::set_child_property_full()], which also gives an
/// error.
///
/// Note that `ges_timeline_element_set_child_properties()` may be more
/// convenient for C programming.
/// ## `property_name`
/// The name of the child property to set
/// ## `value`
/// The value to set the property to
///
/// # Returns
///
/// [`true`] if the property was found and set.
#[doc(alias = "ges_timeline_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_timeline_element_set_child_property(
self.as_ref().to_glib_none().0,
property_name.to_glib_none().0,
value.to_glib_none().0
),
"Failed to set child property"
)
}
}
/// Sets the property of a child of the element. Specifically, the property
/// corresponding to the `pspec` used in
/// [`add_child_property()`][Self::add_child_property()] is set to `value`.
/// ## `pspec`
/// The specification of a registered child property to set
/// ## `value`
/// The value to set the property to
#[doc(alias = "ges_timeline_element_set_child_property_by_pspec")]
fn set_child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>, value: &glib::Value) {
unsafe {
ffi::ges_timeline_element_set_child_property_by_pspec(
self.as_ref().to_glib_none().0,
pspec.as_ref().to_glib_none().0,
value.to_glib_none().0,
);
}
}
/// Sets the property of a child of the element.
///
/// `property_name` can either be in the format "prop-name" or
/// "TypeName::prop-name", where "prop-name" is the name of the property
/// to set (as used in [`ObjectExt::set()`][crate::glib::prelude::ObjectExt::set()]), and "TypeName" is the type name of
/// the child (as returned by G_OBJECT_TYPE_NAME()). The latter format is
/// useful when two children of different types share the same property
/// name.
///
/// The first child found with the given "prop-name" property that was
/// registered with [`add_child_property()`][Self::add_child_property()] (and of the
/// type "TypeName", if it was given) will have the corresponding
/// property set to `value`. Other children that may have also matched the
/// property name (and type name) are left unchanged!
/// ## `property_name`
/// The name of the child property to set
/// ## `value`
/// The value to set the property to
///
/// # Returns
///
/// [`true`] if the property was found and set.
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "ges_timeline_element_set_child_property_full")]
fn set_child_property_full(
&self,
property_name: &str,
value: &glib::Value,
) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::ges_timeline_element_set_child_property_full(
self.as_ref().to_glib_none().0,
property_name.to_glib_none().0,
value.to_glib_none().0,
&mut error,
);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
//#[doc(alias = "ges_timeline_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_timeline_element_set_child_property_valist() }
//}
/// Sets [`duration`][struct@crate::TimelineElement#duration] for the element.
///
/// Whilst the element is part of a [`Timeline`][crate::Timeline], this is the same as
/// editing the element with [`edit()`][Self::edit()] under
/// [`EditMode::Trim`][crate::EditMode::Trim] with [`Edge::End`][crate::Edge::End]. In particular, the
/// [`duration`][struct@crate::TimelineElement#duration] of the element may be snapped to a
/// different timeline time difference from the one given. In addition,
/// setting may fail if it would place the timeline in an unsupported
/// configuration, or the element does not have enough internal content to
/// last the desired duration.
/// ## `duration`
/// The desired duration in its timeline
///
/// # Returns
///
/// [`true`] if `duration` could be set for `self`.
#[doc(alias = "ges_timeline_element_set_duration")]
#[doc(alias = "duration")]
fn set_duration(&self, duration: impl Into<Option<gst::ClockTime>>) -> bool {
unsafe {
from_glib(ffi::ges_timeline_element_set_duration(
self.as_ref().to_glib_none().0,
duration.into().into_glib(),
))
}
}
/// Sets [`in-point`][struct@crate::TimelineElement#in-point] for the element. If the new in-point
/// is above the current [`max-duration`][struct@crate::TimelineElement#max-duration] of the element,
/// this method will fail.
/// ## `inpoint`
/// The in-point, in internal time coordinates
///
/// # Returns
///
/// [`true`] if `inpoint` could be set for `self`.
#[doc(alias = "ges_timeline_element_set_inpoint")]
fn set_inpoint(&self, inpoint: gst::ClockTime) -> bool {
unsafe {
from_glib(ffi::ges_timeline_element_set_inpoint(
self.as_ref().to_glib_none().0,
inpoint.into_glib(),
))
}
}
/// Sets [`max-duration`][struct@crate::TimelineElement#max-duration] for the element. If the new
/// maximum duration is below the current [`in-point`][struct@crate::TimelineElement#in-point] of
/// the element, this method will fail.
/// ## `maxduration`
/// The maximum duration, in internal time coordinates
///
/// # Returns
///
/// [`true`] if `maxduration` could be set for `self`.
#[doc(alias = "ges_timeline_element_set_max_duration")]
#[doc(alias = "max-duration")]
fn set_max_duration(&self, maxduration: impl Into<Option<gst::ClockTime>>) -> bool {
unsafe {
from_glib(ffi::ges_timeline_element_set_max_duration(
self.as_ref().to_glib_none().0,
maxduration.into().into_glib(),
))
}
}
/// Sets the [`name`][struct@crate::TimelineElement#name] for the element. If [`None`] is given
/// for `name`, then the library will instead generate a new name based on
/// the type name of the element, such as the name "uriclip3" for a
/// [`UriClip`][crate::UriClip], and will set that name instead.
///
/// If `self` already has a [`timeline`][struct@crate::TimelineElement#timeline], you should not
/// call this function with `name` set to [`None`].
///
/// You should ensure that, within each [`Timeline`][crate::Timeline], every element has a
/// unique name. If you call this function with `name` as [`None`], then
/// the library should ensure that the set generated name is unique from
/// previously **generated** names. However, if you choose a `name` that
/// interferes with the naming conventions of the library, the library will
/// attempt to ensure that the generated names will not conflict with the
/// chosen name, which may lead to a different name being set instead, but
/// the uniqueness between generated and user-chosen names is not
/// guaranteed.
/// ## `name`
/// The name `self` should take
///
/// # Returns
///
/// [`true`] if `name` or a generated name for `self` could be set.
#[doc(alias = "ges_timeline_element_set_name")]
#[doc(alias = "name")]
fn set_name(&self, name: Option<&str>) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_element_set_name(
self.as_ref().to_glib_none().0,
name.to_glib_none().0
),
"Failed to set name"
)
}
}
/// Sets the [`parent`][struct@crate::TimelineElement#parent] for the element.
///
/// This is used internally and you should normally not call this. A
/// [`Container`][crate::Container] will set the [`parent`][struct@crate::TimelineElement#parent] of its children
/// in [`GESContainerExt::add()`][crate::prelude::GESContainerExt::add()] and [`GESContainerExt::remove()`][crate::prelude::GESContainerExt::remove()].
///
/// Note, if `parent` is not [`None`], `self` must not already have a parent
/// set. Therefore, if you wish to switch parents, you will need to call
/// this function twice: first to set the parent to [`None`], and then to the
/// new parent.
///
/// If `parent` is not [`None`], you must ensure it already has a
/// (non-floating) reference to `self` before calling this.
///
/// # Returns
///
/// [`true`] if `parent` could be set for `self`.
#[doc(alias = "ges_timeline_element_set_parent")]
#[doc(alias = "parent")]
fn set_parent(&self, parent: &impl IsA<TimelineElement>) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_element_set_parent(
self.as_ref().to_glib_none().0,
parent.as_ref().to_glib_none().0
),
"`TimelineElement` already had a parent or its parent was the same as specified"
)
}
}
/// Sets the priority of the element within the containing layer.
///
/// # Deprecated since 1.10
///
/// All priority management is done by GES itself now.
/// To set [`Effect`][crate::Effect] priorities `ges_clip_set_top_effect_index` should
/// be used.
/// ## `priority`
/// The priority
///
/// # Returns
///
/// [`true`] if `priority` could be set for `self`.
#[deprecated = "Since 1.10"]
#[allow(deprecated)]
#[doc(alias = "ges_timeline_element_set_priority")]
#[doc(alias = "priority")]
fn set_priority(&self, priority: u32) -> bool {
unsafe {
from_glib(ffi::ges_timeline_element_set_priority(
self.as_ref().to_glib_none().0,
priority,
))
}
}
/// Sets [`start`][struct@crate::TimelineElement#start] for the element. If the element has a
/// parent, this will also move its siblings with the same shift.
///
/// Whilst the element is part of a [`Timeline`][crate::Timeline], this is the same as
/// editing the element with [`edit()`][Self::edit()] under
/// [`EditMode::Normal`][crate::EditMode::Normal] with [`Edge::None`][crate::Edge::None]. In particular, the
/// [`start`][struct@crate::TimelineElement#start] of the element may be snapped to a different
/// timeline time from the one given. In addition, setting may fail if it
/// would place the timeline in an unsupported configuration.
/// ## `start`
/// The desired start position of the element in its timeline
///
/// # Returns
///
/// [`true`] if `start` could be set for `self`.
#[doc(alias = "ges_timeline_element_set_start")]
#[doc(alias = "start")]
fn set_start(&self, start: gst::ClockTime) -> bool {
unsafe {
from_glib(ffi::ges_timeline_element_set_start(
self.as_ref().to_glib_none().0,
start.into_glib(),
))
}
}
/// Sets the [`timeline`][struct@crate::TimelineElement#timeline] of the element.
///
/// This is used internally and you should normally not call this. A
/// [`Clip`][crate::Clip] will have its [`timeline`][struct@crate::TimelineElement#timeline] set through its
/// [`Layer`][crate::Layer]. A [`Track`][crate::Track] will similarly take care of setting the
/// [`timeline`][struct@crate::TimelineElement#timeline] of its [`TrackElement`][crate::TrackElement]-s. A [`Group`][crate::Group]
/// will adopt the same [`timeline`][struct@crate::TimelineElement#timeline] as its children.
///
/// If `timeline` is [`None`], this will stop its current
/// [`timeline`][struct@crate::TimelineElement#timeline] from tracking it, otherwise `timeline` will
/// start tracking `self`. Note, in the latter case, `self` must not already
/// have a timeline set. Therefore, if you wish to switch timelines, you
/// will need to call this function twice: first to set the timeline to
/// [`None`], and then to the new timeline.
///
/// # Returns
///
/// [`true`] if `timeline` could be set for `self`.
#[doc(alias = "ges_timeline_element_set_timeline")]
#[doc(alias = "timeline")]
fn set_timeline(&self, timeline: &impl IsA<Timeline>) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_element_set_timeline(
self.as_ref().to_glib_none().0,
timeline.as_ref().to_glib_none().0
),
"`Failed to set timeline"
)
}
}
/// Edits the start time of an element within its timeline in trim mode.
/// See [`edit()`][Self::edit()] with [`EditMode::Trim`][crate::EditMode::Trim] and
/// [`Edge::Start`][crate::Edge::Start].
/// ## `start`
/// The new start time of `self` in trim mode
///
/// # Returns
///
/// [`true`] if the trim edit of `self` completed, [`false`] on failure.
#[doc(alias = "ges_timeline_element_trim")]
fn trim(&self, start: gst::ClockTime) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_element_trim(self.as_ref().to_glib_none().0, start.into_glib()),
"Failed to trim"
)
}
}
/// 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.
#[doc(alias = "in-point")]
fn in_point(&self) -> u64 {
ObjectExt::property(self.as_ref(), "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.
#[doc(alias = "in-point")]
fn set_in_point(&self, in_point: u64) {
ObjectExt::set_property(self.as_ref(), "in-point", in_point)
}
/// Whether the element should be serialized.
fn is_serialize(&self) -> bool {
ObjectExt::property(self.as_ref(), "serialize")
}
/// Whether the element should be serialized.
fn set_serialize(&self, serialize: bool) {
ObjectExt::set_property(self.as_ref(), "serialize", serialize)
}
/// Emitted when the element has a new child property registered. See
/// [`add_child_property()`][Self::add_child_property()].
///
/// Note that some GES elements will be automatically created with
/// pre-registered children properties. You can use
/// [`list_children_properties()`][Self::list_children_properties()] to list these.
/// ## `prop_object`
/// The child whose property has been registered
/// ## `prop`
/// The specification for the property that has been registered
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "child-property-added")]
fn connect_child_property_added<F: Fn(&Self, &glib::Object, &glib::ParamSpec) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn child_property_added_trampoline<
P: IsA<TimelineElement>,
F: Fn(&P, &glib::Object, &glib::ParamSpec) + 'static,
>(
this: *mut ffi::GESTimelineElement,
prop_object: *mut glib::gobject_ffi::GObject,
prop: *mut glib::gobject_ffi::GParamSpec,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
TimelineElement::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(prop_object),
&from_glib_borrow(prop),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"child-property-added\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
child_property_added_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
/// Emitted when the element has a child property unregistered. See
/// [`remove_child_property()`][Self::remove_child_property()].
/// ## `prop_object`
/// The child whose property has been unregistered
/// ## `prop`
/// The specification for the property that has been unregistered
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "child-property-removed")]
fn connect_child_property_removed<F: Fn(&Self, &glib::Object, &glib::ParamSpec) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn child_property_removed_trampoline<
P: IsA<TimelineElement>,
F: Fn(&P, &glib::Object, &glib::ParamSpec) + 'static,
>(
this: *mut ffi::GESTimelineElement,
prop_object: *mut glib::gobject_ffi::GObject,
prop: *mut glib::gobject_ffi::GParamSpec,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
TimelineElement::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(prop_object),
&from_glib_borrow(prop),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"child-property-removed\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
child_property_removed_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
/// Emitted when a child of the element has one of its registered
/// properties set. See [`add_child_property()`][Self::add_child_property()].
/// Note that unlike [`notify`][struct@crate::glib::Object#notify], a child property name can not be
/// used as a signal detail.
/// ## `prop_object`
/// The child whose property has been set
/// ## `prop`
/// The specification for the property that been set
#[doc(alias = "deep-notify")]
fn connect_deep_notify<F: Fn(&Self, &glib::Object, &glib::ParamSpec) + 'static>(
&self,
detail: Option<&str>,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn deep_notify_trampoline<
P: IsA<TimelineElement>,
F: Fn(&P, &glib::Object, &glib::ParamSpec) + 'static,
>(
this: *mut ffi::GESTimelineElement,
prop_object: *mut glib::gobject_ffi::GObject,
prop: *mut glib::gobject_ffi::GParamSpec,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
TimelineElement::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(prop_object),
&from_glib_borrow(prop),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
let detailed_signal_name = detail.map(|name| format!("deep-notify::{name}\0"));
let signal_name: &[u8] = detailed_signal_name
.as_ref()
.map_or(&b"deep-notify\0"[..], |n| n.as_bytes());
connect_raw(
self.as_ptr() as *mut _,
signal_name.as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
deep_notify_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "duration")]
fn connect_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_duration_trampoline<
P: IsA<TimelineElement>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GESTimelineElement,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::duration\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_duration_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "in-point")]
fn connect_in_point_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_in_point_trampoline<
P: IsA<TimelineElement>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GESTimelineElement,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::in-point\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_in_point_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "max-duration")]
fn connect_max_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_max_duration_trampoline<
P: IsA<TimelineElement>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GESTimelineElement,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::max-duration\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_max_duration_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "name")]
fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_name_trampoline<
P: IsA<TimelineElement>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GESTimelineElement,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::name\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_name_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "parent")]
fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_parent_trampoline<
P: IsA<TimelineElement>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GESTimelineElement,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::parent\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_parent_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[deprecated = "Since 1.10"]
#[doc(alias = "priority")]
fn connect_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_priority_trampoline<
P: IsA<TimelineElement>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GESTimelineElement,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::priority\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_priority_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "serialize")]
fn connect_serialize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_serialize_trampoline<
P: IsA<TimelineElement>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GESTimelineElement,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::serialize\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_serialize_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "start")]
fn connect_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_start_trampoline<
P: IsA<TimelineElement>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GESTimelineElement,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::start\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_start_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "timeline")]
fn connect_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_timeline_trampoline<
P: IsA<TimelineElement>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GESTimelineElement,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::timeline\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_timeline_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl<O: IsA<TimelineElement>> TimelineElementExt for O {}