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
// 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, Asset, Extractable, Group, Layer, MetaContainer, TimelineElement, Track, TrackElement,
};
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
use crate::{Clip, FrameNumber};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
/// [`Timeline`][crate::Timeline] is the central object for any multimedia timeline.
///
/// A timeline is composed of a set of [`Track`][crate::Track]-s and a set of
/// [`Layer`][crate::Layer]-s, which are added to the timeline using
/// [`TimelineExt::add_track()`][crate::prelude::TimelineExt::add_track()] and [`TimelineExt::append_layer()`][crate::prelude::TimelineExt::append_layer()], respectively.
///
/// The contained tracks define the supported types of the timeline
/// and provide the media output. Essentially, each track provides an
/// additional source [`gst::Pad`][crate::gst::Pad].
///
/// Most usage of a timeline will likely only need a single [`AudioTrack`][crate::AudioTrack]
/// and/or a single [`VideoTrack`][crate::VideoTrack]. You can create such a timeline with
/// [`new_audio_video()`][Self::new_audio_video()]. After this, you are unlikely to need to
/// work with the tracks directly.
///
/// A timeline's layers contain [`Clip`][crate::Clip]-s, which in turn control the
/// creation of [`TrackElement`][crate::TrackElement]-s, which are added to the timeline's
/// tracks. See [`select-tracks-for-object`][struct@crate::Timeline#select-tracks-for-object] if you wish to have
/// more control over which track a clip's elements are added to.
///
/// The layers are ordered, with higher priority layers having their
/// content prioritised in the tracks. This ordering can be changed using
/// [`TimelineExt::move_layer()`][crate::prelude::TimelineExt::move_layer()].
///
/// ## Editing
///
/// See [`TimelineElement`][crate::TimelineElement] for the various ways the elements of a timeline
/// can be edited.
///
/// If you change the timing or ordering of a timeline's
/// [`TimelineElement`][crate::TimelineElement]-s, then these changes will not actually be taken
/// into account in the output of the timeline's tracks until the
/// [`TimelineExt::commit()`][crate::prelude::TimelineExt::commit()] method is called. This allows you to move its
/// elements around, say, in response to an end user's mouse dragging, with
/// little expense before finalising their effect on the produced data.
///
/// ## Overlaps and Auto-Transitions
///
/// There are certain restrictions placed on how [`Source`][crate::Source]-s may overlap
/// in a [`Track`][crate::Track] that belongs to a timeline. These will be enforced by
/// GES, so the user will not need to keep track of them, but they should
/// be aware that certain edits will be refused as a result if the overlap
/// rules would be broken.
///
/// Consider two [`Source`][crate::Source]-s, `A` and `B`, with start times `startA` and
/// `startB`, and end times `endA` and `endB`, respectively. The start
/// time refers to their [`start`][struct@crate::TimelineElement#start], and the end time is
/// their [`start`][struct@crate::TimelineElement#start] + [`duration`][struct@crate::TimelineElement#duration]. These
/// two sources *overlap* if:
///
/// + they share the same [`track`][struct@crate::TrackElement#track] (non [`None`]), which belongs
/// to the timeline;
/// + they share the same `GES_TIMELINE_ELEMENT_LAYER_PRIORITY`; and
/// + `startA < endB` and `startB < endA `.
///
/// Note that when `startA = endB` or `startB = endA` then the two sources
/// will *touch* at their edges, but are not considered overlapping.
///
/// If, in addition, `startA < startB < endA`, then we can say that the
/// end of `A` overlaps the start of `B`.
///
/// If, instead, `startA <= startB` and `endA >= endB`, then we can say
/// that `A` fully overlaps `B`.
///
/// The overlap rules for a timeline are that:
///
/// 1. One source cannot fully overlap another source.
/// 2. A source can only overlap the end of up to one other source at its
/// start.
/// 3. A source can only overlap the start of up to one other source at its
/// end.
///
/// The last two rules combined essentially mean that at any given timeline
/// position, only up to two [`Source`][crate::Source]-s may overlap at that position. So
/// triple or more overlaps are not allowed.
///
/// If you switch on [`auto-transition`][struct@crate::Timeline#auto-transition], then at any moment when
/// the end of one source (the first source) overlaps the start of another
/// (the second source), a [`TransitionClip`][crate::TransitionClip] will be automatically created
/// for the pair in the same layer and it will cover their overlap. If the
/// two elements are edited in a way such that the end of the first source
/// no longer overlaps the start of the second, the transition will be
/// automatically removed from the timeline. However, if the two sources
/// still overlap at the same edges after the edit, then the same
/// transition object will be kept, but with its timing and layer adjusted
/// accordingly.
///
/// NOTE: if you know what you are doing and want to be in full control of the
/// timeline layout, you can disable the edit APIs with
/// `ges_timeline_disable_edit_apis`.
///
/// ## Saving
///
/// To save/load a timeline, you can use the [`TimelineExt::load_from_uri()`][crate::prelude::TimelineExt::load_from_uri()]
/// and [`TimelineExt::save_to_uri()`][crate::prelude::TimelineExt::save_to_uri()] methods that use the default format.
///
/// ## Playing
///
/// A timeline is a [`gst::Bin`][crate::gst::Bin] with a source [`gst::Pad`][crate::gst::Pad] for each of its
/// tracks, which you can fetch with [`TimelineExt::pad_for_track()`][crate::prelude::TimelineExt::pad_for_track()]. You
/// will likely want to link these to some compatible sink [`gst::Element`][crate::gst::Element]-s to
/// be able to play or capture the content of the timeline.
///
/// You can use a [`Pipeline`][crate::Pipeline] to easily preview/play the timeline's
/// content, or render it to a file.
///
/// ## Properties
///
///
/// #### `auto-transition`
/// Whether to automatically create a transition whenever two
/// [`Source`][crate::Source]-s overlap in a track of the timeline. See
/// [`auto-transition`][struct@crate::Layer#auto-transition] if you want this to only happen in some
/// layers.
///
/// Readable | Writeable
///
///
/// #### `duration`
/// The current duration (in nanoseconds) of the timeline. A timeline
/// 'starts' at time 0, so this is the maximum end time of all of its
/// [`TimelineElement`][crate::TimelineElement]-s.
///
/// Readable
///
///
/// #### `snapping-distance`
/// The distance (in nanoseconds) at which a [`TimelineElement`][crate::TimelineElement] being
/// moved within the timeline should snap one of its [`Source`][crate::Source]-s with
/// another [`Source`][crate::Source]-s edge. See [`EditMode`][crate::EditMode] for which edges can
/// snap during an edit. 0 means no snapping.
///
/// Readable | Writeable
/// <details><summary><h4>Bin</h4></summary>
///
///
/// #### `async-handling`
/// If set to [`true`], the bin will handle asynchronous state changes.
/// This should be used only if the bin subclass is modifying the state
/// of its children on its own.
///
/// Readable | Writeable
///
///
/// #### `message-forward`
/// Forward all children messages, even those that would normally be filtered by
/// the bin. This can be interesting when one wants to be notified of the EOS
/// state of individual elements, for example.
///
/// The messages are converted to an ELEMENT message with the bin as the
/// source. The structure of the message is named `GstBinForwarded` and contains
/// a field named `message` that contains the original forwarded `GstMessage`.
///
/// Readable | Writeable
/// </details>
/// <details><summary><h4>Object</h4></summary>
///
///
/// #### `name`
/// Readable | Writeable | Construct
///
///
/// #### `parent`
/// The parent of the object. Please note, that when changing the 'parent'
/// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
/// signals due to locking issues. In some cases one can use
/// [`element-added`][struct@crate::gst::Bin#element-added] or [`element-removed`][struct@crate::gst::Bin#element-removed] signals on the parent to
/// achieve a similar effect.
///
/// Readable | Writeable
/// </details>
///
/// ## Signals
///
///
/// #### `commited`
/// This signal will be emitted once the changes initiated by
/// [`TimelineExt::commit()`][crate::prelude::TimelineExt::commit()] have been executed in the backend. Use
/// [`TimelineExt::commit_sync()`][crate::prelude::TimelineExt::commit_sync()] if you do not want to have to connect
/// to this signal.
///
///
///
///
/// #### `group-added`
/// Will be emitted after the group is added to to the timeline. This can
/// happen when grouping with `ges_container_group`, or by adding
/// containers to a newly created group.
///
/// Note that this should not be emitted whilst a timeline is being
/// loaded from its [`Project`][crate::Project] asset. You should connect to the
/// project's [`loaded`][struct@crate::Project#loaded] signal if you want to know which groups
/// were created for the timeline.
///
///
///
///
/// #### `group-removed`
/// Will be emitted after the group is removed from the timeline through
/// `ges_container_ungroup`. Note that `group` will no longer contain its
/// former children, these are held in `children`.
///
/// Note that if a group is emptied, then it will no longer belong to the
/// timeline, but this signal will **not** be emitted in such a case.
///
///
///
///
/// #### `layer-added`
/// Will be emitted after the layer is added to the timeline.
///
/// Note that this should not be emitted whilst a timeline is being
/// loaded from its [`Project`][crate::Project] asset. You should connect to the
/// project's [`loaded`][struct@crate::Project#loaded] signal if you want to know which
/// layers were created for the timeline.
///
///
///
///
/// #### `layer-removed`
/// Will be emitted after the layer is removed from the timeline.
///
///
///
///
/// #### `select-element-track`
/// Simplified version of [`select-tracks-for-object`][struct@crate::Timeline#select-tracks-for-object] which only
/// allows `track_element` to be added to a single [`Track`][crate::Track].
///
///
///
///
/// #### `select-tracks-for-object`
/// This will be emitted whenever the timeline needs to determine which
/// tracks a clip's children should be added to. The track element will
/// be added to each of the tracks given in the return. If a track
/// element is selected to go into multiple tracks, it will be copied
/// into the additional tracks, under the same clip. Note that the copy
/// will *not* keep its properties or state in sync with the original.
///
/// Connect to this signal once if you wish to control which element
/// should be added to which track. Doing so will overwrite the default
/// behaviour, which adds `track_element` to all tracks whose
/// [`track-type`][struct@crate::Track#track-type] includes the `track_element`'s
/// [`track-type`][struct@crate::TrackElement#track-type].
///
/// Note that under the default track selection, if a clip would produce
/// multiple core children of the same [`TrackType`][crate::TrackType], it will choose
/// one of the core children arbitrarily to place in the corresponding
/// tracks, with a warning for the other core children that are not
/// placed in the track. For example, this would happen for a [`UriClip`][crate::UriClip]
/// that points to a file that contains multiple audio streams. If you
/// wish to choose the stream, you could connect to this signal, and use,
/// say, [`UriSourceAssetExt::stream_info()`][crate::prelude::UriSourceAssetExt::stream_info()] to choose which core
/// source to add.
///
/// When a clip is first added to a timeline, its core elements will
/// be created for the current tracks in the timeline if they have not
/// already been created. Then this will be emitted for each of these
/// core children to select which tracks, if any, they should be added
/// to. It will then be called for any non-core children in the clip.
///
/// In addition, if a new track element is ever added to a clip in a
/// timeline (and it is not already part of a track) this will be emitted
/// to select which tracks the element should be added to.
///
/// Finally, as a special case, if a track is added to the timeline
/// *after* it already contains clips, then it will request the creation
/// of the clips' core elements of the corresponding type, if they have
/// not already been created, and this signal will be emitted for each of
/// these newly created elements. In addition, this will also be released
/// for all other track elements in the timeline's clips that have not
/// yet been assigned a track. However, in this final case, the timeline
/// will only check whether the newly added track appears in the track
/// list. If it does appear, the track element will be added to the newly
/// added track. All other tracks in the returned track list are ignored.
///
/// In this latter case, track elements that are already part of a track
/// will not be asked if they want to be copied into the new track. If
/// you wish to do this, you can use [`ClipExt::add_child_to_track()`][crate::prelude::ClipExt::add_child_to_track()].
///
/// Note that the returned `GPtrArray` should own a new reference to each
/// of its contained [`Track`][crate::Track]. The timeline will set the `GDestroyNotify`
/// free function on the `GPtrArray` to dereference the elements.
///
///
///
///
/// #### `snapping-ended`
/// Will be emitted whenever a snapping event ends. After a snap event
/// has started (see [`snapping-started`][struct@crate::Timeline#snapping-started]), it can later end
/// because either another timeline edit has occurred (which may or may
/// not have created a new snapping event), or because the timeline has
/// been committed.
///
///
///
///
/// #### `snapping-started`
/// Will be emitted whenever an element's movement invokes a snapping
/// event during an edit (usually of one of its ancestors) because its
/// start or end point lies within the [`snapping-distance`][struct@crate::Timeline#snapping-distance] of
/// another element's start or end point.
///
/// See [`EditMode`][crate::EditMode] to see what can snap during an edit.
///
/// Note that only up to one snapping-started signal will be emitted per
/// element edit within a timeline.
///
///
///
///
/// #### `track-added`
/// Will be emitted after the track is added to the timeline.
///
/// Note that this should not be emitted whilst a timeline is being
/// loaded from its [`Project`][crate::Project] asset. You should connect to the
/// project's [`loaded`][struct@crate::Project#loaded] signal if you want to know which
/// tracks were created for the timeline.
///
///
///
///
/// #### `track-removed`
/// Will be emitted after the track is removed from the timeline.
///
///
/// <details><summary><h4>Bin</h4></summary>
///
///
/// #### `deep-element-added`
/// Will be emitted after the element was added to `sub_bin`.
///
///
///
///
/// #### `deep-element-removed`
/// Will be emitted after the element was removed from `sub_bin`.
///
///
///
///
/// #### `do-latency`
/// Will be emitted when the bin needs to perform latency calculations. This
/// signal is only emitted for toplevel bins or when [`async-handling`][struct@crate::gst::Bin#async-handling] is
/// enabled.
///
/// Only one signal handler is invoked. If no signals are connected, the
/// default handler is invoked, which will query and distribute the lowest
/// possible latency to all sinks.
///
/// Connect to this signal if the default latency calculations are not
/// sufficient, like when you need different latencies for different sinks in
/// the same pipeline.
///
///
///
///
/// #### `element-added`
/// Will be emitted after the element was added to the bin.
///
///
///
///
/// #### `element-removed`
/// Will be emitted after the element was removed from the bin.
///
///
/// </details>
/// <details><summary><h4>Element</h4></summary>
///
///
/// #### `no-more-pads`
/// This signals that the element will not generate more dynamic pads.
/// Note that this signal will usually be emitted from the context of
/// the streaming thread.
///
///
///
///
/// #### `pad-added`
/// a new [`gst::Pad`][crate::gst::Pad] has been added to the element. Note that this signal will
/// usually be emitted from the context of the streaming thread. Also keep in
/// mind that if you add new elements to the pipeline in the signal handler
/// you will need to set them to the desired target state with
/// [`ElementExtManual::set_state()`][crate::gst::prelude::ElementExtManual::set_state()] or [`ElementExtManual::sync_state_with_parent()`][crate::gst::prelude::ElementExtManual::sync_state_with_parent()].
///
///
///
///
/// #### `pad-removed`
/// a [`gst::Pad`][crate::gst::Pad] has been removed from the element
///
///
/// </details>
/// <details><summary><h4>Object</h4></summary>
///
///
/// #### `deep-notify`
/// The deep notify signal is used to be notified of property changes. It is
/// typically attached to the toplevel bin to receive notifications from all
/// the elements contained in that bin.
///
/// Detailed
/// </details>
/// <details><summary><h4>ChildProxy</h4></summary>
///
///
/// #### `child-added`
/// Will be emitted after the `object` was added to the `child_proxy`.
///
///
///
///
/// #### `child-removed`
/// Will be emitted after the `object` was removed from the `child_proxy`.
///
///
/// </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
///
/// [`TimelineExt`][trait@crate::prelude::TimelineExt], [`trait@gst::prelude::BinExt`], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::GstObjectExt`], [`trait@glib::ObjectExt`], [`trait@gst::prelude::ChildProxyExt`], [`ExtractableExt`][trait@crate::prelude::ExtractableExt], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt]
#[doc(alias = "GESTimeline")]
pub struct Timeline(Object<ffi::GESTimeline, ffi::GESTimelineClass>) @extends gst::Bin, gst::Element, gst::Object, @implements gst::ChildProxy, Extractable, MetaContainer;
match fn {
type_ => || ffi::ges_timeline_get_type(),
}
}
impl Timeline {
pub const NONE: Option<&'static Timeline> = None;
/// Creates a new empty timeline.
///
/// # Returns
///
/// The new timeline.
#[doc(alias = "ges_timeline_new")]
pub fn new() -> Timeline {
assert_initialized_main_thread!();
unsafe { from_glib_none(ffi::ges_timeline_new()) }
}
/// Creates a new timeline containing a single [`AudioTrack`][crate::AudioTrack] and a
/// single [`VideoTrack`][crate::VideoTrack].
///
/// # Returns
///
/// The new timeline.
#[doc(alias = "ges_timeline_new_audio_video")]
pub fn new_audio_video() -> Timeline {
assert_initialized_main_thread!();
unsafe { from_glib_none(ffi::ges_timeline_new_audio_video()) }
}
/// Creates a timeline from the given URI.
/// ## `uri`
/// The URI to load from
///
/// # Returns
///
/// A new timeline if the uri was loaded
/// successfully, or [`None`] if the uri could not be loaded.
#[doc(alias = "ges_timeline_new_from_uri")]
#[doc(alias = "new_from_uri")]
pub fn from_uri(uri: &str) -> Result<Timeline, glib::Error> {
assert_initialized_main_thread!();
unsafe {
let mut error = std::ptr::null_mut();
let ret = ffi::ges_timeline_new_from_uri(uri.to_glib_none().0, &mut error);
if error.is_null() {
Ok(from_glib_none(ret))
} else {
Err(from_glib_full(error))
}
}
}
}
impl Default for Timeline {
fn default() -> Self {
Self::new()
}
}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::Timeline>> Sealed for T {}
}
/// Trait containing all [`struct@Timeline`] methods.
///
/// # Implementors
///
/// [`Timeline`][struct@crate::Timeline]
pub trait TimelineExt: IsA<Timeline> + sealed::Sealed + 'static {
/// Add a layer to the timeline.
///
/// If the layer contains [`Clip`][crate::Clip]-s, then this may trigger the creation of
/// their core track element children for the timeline's tracks, and the
/// placement of the clip's children in the tracks of the timeline using
/// [`select-tracks-for-object`][struct@crate::Timeline#select-tracks-for-object]. Some errors may occur if this
/// would break one of the configuration rules of the timeline in one of
/// its tracks. In such cases, some track elements would fail to be added
/// to their tracks, but this method would still return [`true`]. As such, it
/// is advised that you only add clips to layers that already part of a
/// timeline. In such situations, [`LayerExt::add_clip()`][crate::prelude::LayerExt::add_clip()] is able to fail if
/// adding the clip would cause such an error.
///
/// # Deprecated since 1.18
///
/// This method requires you to ensure the layer's
/// [`priority`][struct@crate::Layer#priority] will be unique to the timeline. Use
/// [`append_layer()`][Self::append_layer()] and [`move_layer()`][Self::move_layer()] instead.
/// ## `layer`
/// The layer to add
///
/// # Returns
///
/// [`true`] if `layer` was properly added.
#[cfg_attr(feature = "v1_18", deprecated = "Since 1.18")]
#[allow(deprecated)]
#[doc(alias = "ges_timeline_add_layer")]
fn add_layer(&self, layer: &impl IsA<Layer>) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_add_layer(
self.as_ref().to_glib_none().0,
layer.as_ref().to_glib_none().0
),
"Failed to add layer"
)
}
}
/// Add a track to the timeline.
///
/// If the timeline already contains clips, then this may trigger the
/// creation of their core track element children for the track, and the
/// placement of the clip's children in the track of the timeline using
/// [`select-tracks-for-object`][struct@crate::Timeline#select-tracks-for-object]. Some errors may occur if this
/// would break one of the configuration rules for the timeline in the
/// track. In such cases, some track elements would fail to be added to the
/// track, but this method would still return [`true`]. As such, it is advised
/// that you avoid adding tracks to timelines that already contain clips.
/// ## `track`
/// The track to add
///
/// # Returns
///
/// [`true`] if `track` was properly added.
#[doc(alias = "ges_timeline_add_track")]
fn add_track(&self, track: &impl IsA<Track>) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_add_track(
self.as_ref().to_glib_none().0,
track.as_ref().to_glib_none().0
),
"Failed to add track"
)
}
}
/// Append a newly created layer to the timeline. The layer will
/// be added at the lowest [`priority`][struct@crate::Layer#priority] (numerically, the highest).
///
/// # Returns
///
/// The newly created layer.
#[doc(alias = "ges_timeline_append_layer")]
fn append_layer(&self) -> Layer {
unsafe {
from_glib_none(ffi::ges_timeline_append_layer(
self.as_ref().to_glib_none().0,
))
}
}
/// Commit all the pending changes of the clips contained in the
/// timeline.
///
/// When changes happen in a timeline, they are not immediately executed
/// internally, in a way that effects the output data of the timeline. You
/// should call this method when you are done with a set of changes and you
/// want them to be executed.
///
/// Any pending changes will be executed in the backend. The
/// [`commited`][struct@crate::Timeline#commited] signal will be emitted once this has completed.
/// You should not try to change the state of the timeline, seek it or add
/// tracks to it before receiving this signal. You can use
/// [`commit_sync()`][Self::commit_sync()] if you do not want to perform other tasks in
/// the mean time.
///
/// Note that all the pending changes will automatically be executed when
/// the timeline goes from [`gst::State::Ready`][crate::gst::State::Ready] to [`gst::State::Paused`][crate::gst::State::Paused], which is
/// usually triggered by a corresponding state changes in a containing
/// [`Pipeline`][crate::Pipeline].
///
/// # Returns
///
/// [`true`] if pending changes were committed, or [`false`] if nothing
/// needed to be committed.
#[doc(alias = "ges_timeline_commit")]
fn commit(&self) -> bool {
unsafe { from_glib(ffi::ges_timeline_commit(self.as_ref().to_glib_none().0)) }
}
/// Commit all the pending changes of the clips contained in the
/// timeline and wait for the changes to complete.
///
/// See [`commit()`][Self::commit()].
///
/// # Returns
///
/// [`true`] if pending changes were committed, or [`false`] if nothing
/// needed to be committed.
#[doc(alias = "ges_timeline_commit_sync")]
fn commit_sync(&self) -> bool {
unsafe {
from_glib(ffi::ges_timeline_commit_sync(
self.as_ref().to_glib_none().0,
))
}
}
/// WARNING: When using that mode, GES won't guarantee the coherence of the
/// timeline. You need to ensure that the rules described in the [Overlaps and
/// auto transitions](`overlaps`-and-autotransitions) section are respected any time
/// the timeline is [commited](ges_timeline_commit) (otherwise playback will most
/// probably fail in different ways).
///
/// When disabling editing APIs, GES won't be able to enforce the rules that
/// makes the timeline overall state to be valid but some feature won't be
/// usable:
/// * [`snapping-distance`][struct@crate::Timeline#snapping-distance]
/// * [`auto-transition`][struct@crate::Timeline#auto-transition]
/// ## `disable_edit_apis`
/// [`true`] to disable all the edit APIs so the user is in full
/// control of ensuring timeline state validity [`false`] otherwise.
#[cfg(feature = "v1_22")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
#[doc(alias = "ges_timeline_disable_edit_apis")]
fn disable_edit_apis(&self, disable_edit_apis: bool) {
unsafe {
ffi::ges_timeline_disable_edit_apis(
self.as_ref().to_glib_none().0,
disable_edit_apis.into_glib(),
);
}
}
/// Freezes the timeline from being committed. This is usually needed while the
/// timeline is being rendered to ensure that not change to the timeline are
/// taken into account during that moment. Once the rendering is done, you
/// should call `ges_timeline_thaw_commit` so that committing becomes possible
/// again and any call to ``commit()`` that happened during the rendering is
/// actually taken into account.
#[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[doc(alias = "ges_timeline_freeze_commit")]
fn freeze_commit(&self) {
unsafe {
ffi::ges_timeline_freeze_commit(self.as_ref().to_glib_none().0);
}
}
/// Gets [`auto-transition`][struct@crate::Timeline#auto-transition] for the timeline.
///
/// # Returns
///
/// The auto-transition of `self_`.
#[doc(alias = "ges_timeline_get_auto_transition")]
#[doc(alias = "get_auto_transition")]
#[doc(alias = "auto-transition")]
fn is_auto_transition(&self) -> bool {
unsafe {
from_glib(ffi::ges_timeline_get_auto_transition(
self.as_ref().to_glib_none().0,
))
}
}
/// Get the current [`duration`][struct@crate::Timeline#duration] of the timeline
///
/// # Returns
///
/// The current duration of `self`.
#[doc(alias = "ges_timeline_get_duration")]
#[doc(alias = "get_duration")]
fn duration(&self) -> gst::ClockTime {
unsafe {
try_from_glib(ffi::ges_timeline_get_duration(
self.as_ref().to_glib_none().0,
))
.expect("mandatory glib value is None")
}
}
///
/// # Returns
///
/// [`true`] if edit APIs are disabled, [`false`] otherwise.
#[cfg(feature = "v1_22")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
#[doc(alias = "ges_timeline_get_edit_apis_disabled")]
#[doc(alias = "get_edit_apis_disabled")]
fn is_edit_apis_disabled(&self) -> bool {
unsafe {
from_glib(ffi::ges_timeline_get_edit_apis_disabled(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets the element contained in the timeline with the given name.
/// ## `name`
/// The name of the element to find
///
/// # Returns
///
/// The timeline element in `self`
/// with the given `name`, or [`None`] if it was not found.
#[doc(alias = "ges_timeline_get_element")]
#[doc(alias = "get_element")]
fn element(&self, name: &str) -> Option<TimelineElement> {
unsafe {
from_glib_full(ffi::ges_timeline_get_element(
self.as_ref().to_glib_none().0,
name.to_glib_none().0,
))
}
}
/// This method allows you to convert a timeline `GstClockTime` into its
/// corresponding `GESFrameNumber` in the timeline's output.
/// ## `timestamp`
/// The timestamp to get the corresponding frame number of
///
/// # Returns
///
/// The frame number `timestamp` corresponds to.
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "ges_timeline_get_frame_at")]
#[doc(alias = "get_frame_at")]
fn frame_at(&self, timestamp: gst::ClockTime) -> FrameNumber {
unsafe {
ffi::ges_timeline_get_frame_at(self.as_ref().to_glib_none().0, timestamp.into_glib())
}
}
/// This method allows you to convert a timeline output frame number into a
/// timeline `GstClockTime`. For example, this time could be used to seek to a
/// particular frame in the timeline's output, or as the edit position for
/// an element within the timeline.
/// ## `frame_number`
/// The frame number to get the corresponding timestamp of in the
/// timeline coordinates
///
/// # Returns
///
/// The timestamp corresponding to `frame_number` in the output of `self`.
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "ges_timeline_get_frame_time")]
#[doc(alias = "get_frame_time")]
fn frame_time(&self, frame_number: FrameNumber) -> Option<gst::ClockTime> {
unsafe {
from_glib(ffi::ges_timeline_get_frame_time(
self.as_ref().to_glib_none().0,
frame_number,
))
}
}
/// Get the list of [`Group`][crate::Group]-s present in the timeline.
///
/// # Returns
///
/// The list of
/// groups that contain clips present in `self`'s layers.
/// Must not be changed.
#[doc(alias = "ges_timeline_get_groups")]
#[doc(alias = "get_groups")]
fn groups(&self) -> Vec<Group> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::ges_timeline_get_groups(
self.as_ref().to_glib_none().0,
))
}
}
/// Retrieve the layer whose index in the timeline matches the given
/// priority.
/// ## `priority`
/// The priority/index of the layer to find
///
/// # Returns
///
/// The layer with the given
/// `priority`, or [`None`] if none was found.
///
/// Since 1.6
#[doc(alias = "ges_timeline_get_layer")]
#[doc(alias = "get_layer")]
fn layer(&self, priority: u32) -> Option<Layer> {
unsafe {
from_glib_full(ffi::ges_timeline_get_layer(
self.as_ref().to_glib_none().0,
priority,
))
}
}
/// Get the list of [`Layer`][crate::Layer]-s present in the timeline.
///
/// # Returns
///
/// The list of
/// layers present in `self` sorted by priority.
#[doc(alias = "ges_timeline_get_layers")]
#[doc(alias = "get_layers")]
fn layers(&self) -> Vec<Layer> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_layers(
self.as_ref().to_glib_none().0,
))
}
}
/// Search for the [`gst::Pad`][crate::gst::Pad] corresponding to the given timeline's track.
/// You can link to this pad to receive the output data of the given track.
/// ## `track`
/// A track
///
/// # Returns
///
/// The pad corresponding to `track`,
/// or [`None`] if there is an error.
#[doc(alias = "ges_timeline_get_pad_for_track")]
#[doc(alias = "get_pad_for_track")]
fn pad_for_track(&self, track: &impl IsA<Track>) -> Option<gst::Pad> {
unsafe {
from_glib_none(ffi::ges_timeline_get_pad_for_track(
self.as_ref().to_glib_none().0,
track.as_ref().to_glib_none().0,
))
}
}
/// Gets the [`snapping-distance`][struct@crate::Timeline#snapping-distance] for the timeline.
///
/// # Returns
///
/// The snapping distance (in nanoseconds) of `self`.
#[doc(alias = "ges_timeline_get_snapping_distance")]
#[doc(alias = "get_snapping_distance")]
#[doc(alias = "snapping-distance")]
fn snapping_distance(&self) -> Option<gst::ClockTime> {
unsafe {
from_glib(ffi::ges_timeline_get_snapping_distance(
self.as_ref().to_glib_none().0,
))
}
}
/// Search for the [`Track`][crate::Track] corresponding to the given timeline's pad.
/// ## `pad`
/// A pad
///
/// # Returns
///
/// The track corresponding to `pad`,
/// or [`None`] if there is an error.
#[doc(alias = "ges_timeline_get_track_for_pad")]
#[doc(alias = "get_track_for_pad")]
fn track_for_pad(&self, pad: &impl IsA<gst::Pad>) -> Option<Track> {
unsafe {
from_glib_none(ffi::ges_timeline_get_track_for_pad(
self.as_ref().to_glib_none().0,
pad.as_ref().to_glib_none().0,
))
}
}
/// Get the list of [`Track`][crate::Track]-s used by the timeline.
///
/// # Returns
///
/// The list of tracks
/// used by `self`.
#[doc(alias = "ges_timeline_get_tracks")]
#[doc(alias = "get_tracks")]
fn tracks(&self) -> Vec<Track> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_tracks(
self.as_ref().to_glib_none().0,
))
}
}
/// Check whether the timeline is empty or not.
///
/// # Returns
///
/// [`true`] if `self` is empty.
#[doc(alias = "ges_timeline_is_empty")]
fn is_empty(&self) -> bool {
unsafe { from_glib(ffi::ges_timeline_is_empty(self.as_ref().to_glib_none().0)) }
}
/// Loads the contents of URI into the timeline.
/// ## `uri`
/// The URI to load from
///
/// # Returns
///
/// [`true`] if the timeline was loaded successfully from `uri`.
#[doc(alias = "ges_timeline_load_from_uri")]
fn load_from_uri(&self, uri: &str) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::ges_timeline_load_from_uri(
self.as_ref().to_glib_none().0,
uri.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))
}
}
}
/// Moves a layer within the timeline to the index given by
/// `new_layer_priority`.
/// An index of 0 corresponds to the layer with the highest priority in a
/// timeline. If `new_layer_priority` is greater than the number of layers
/// present in the timeline, it will become the lowest priority layer.
/// ## `layer`
/// A layer within `self`, whose priority should be changed
/// ## `new_layer_priority`
/// The new index for `layer`
#[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
#[doc(alias = "ges_timeline_move_layer")]
fn move_layer(
&self,
layer: &impl IsA<Layer>,
new_layer_priority: u32,
) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_move_layer(
self.as_ref().to_glib_none().0,
layer.as_ref().to_glib_none().0,
new_layer_priority
),
"Failed to move layer"
)
}
}
/// Paste an element inside the timeline. `element` **must** be the return of
/// `ges_timeline_element_copy()` with `deep=TRUE`,
/// and it should not be changed before pasting. `element` itself 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
/// also lie within `self`, 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 [`TimelineElementExt::paste()`][crate::prelude::TimelineElementExt::paste()].
/// ## `element`
/// The element to 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.
/// ## `layer_priority`
/// The layer into which the element should be pasted.
/// -1 means paste to the same layer from which `element` has been copied from
///
/// # Returns
///
/// The newly created element, or
/// [`None`] if pasting fails.
#[doc(alias = "ges_timeline_paste_element")]
fn paste_element(
&self,
element: &impl IsA<TimelineElement>,
position: gst::ClockTime,
layer_priority: i32,
) -> Option<TimelineElement> {
unsafe {
from_glib_full(ffi::ges_timeline_paste_element(
self.as_ref().to_glib_none().0,
element.as_ref().to_glib_none().0,
position.into_glib(),
layer_priority,
))
}
}
/// Removes a layer from the timeline.
/// ## `layer`
/// The layer to remove
///
/// # Returns
///
/// [`true`] if `layer` was properly removed.
#[doc(alias = "ges_timeline_remove_layer")]
fn remove_layer(&self, layer: &impl IsA<Layer>) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_remove_layer(
self.as_ref().to_glib_none().0,
layer.as_ref().to_glib_none().0
),
"Failed to remove layer"
)
}
}
/// Remove a track from the timeline.
/// ## `track`
/// The track to remove
///
/// # Returns
///
/// [`true`] if `track` was properly removed.
#[doc(alias = "ges_timeline_remove_track")]
fn remove_track(&self, track: &impl IsA<Track>) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::ges_timeline_remove_track(
self.as_ref().to_glib_none().0,
track.as_ref().to_glib_none().0
),
"Failed to remove track"
)
}
}
/// Saves the timeline to the given location. If `formatter_asset` is [`None`],
/// the method will attempt to save in the same format the timeline was
/// loaded from, before defaulting to the formatter with highest rank.
/// ## `uri`
/// The location to save to
/// ## `formatter_asset`
/// The formatter asset to use, or [`None`]
/// ## `overwrite`
/// [`true`] to overwrite file if it exists
///
/// # Returns
///
/// [`true`] if `self` was successfully saved to `uri`.
#[doc(alias = "ges_timeline_save_to_uri")]
fn save_to_uri(
&self,
uri: &str,
formatter_asset: Option<&impl IsA<Asset>>,
overwrite: bool,
) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::ges_timeline_save_to_uri(
self.as_ref().to_glib_none().0,
uri.to_glib_none().0,
formatter_asset.map(|p| p.as_ref()).to_glib_none().0,
overwrite.into_glib(),
&mut error,
);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
/// Sets [`auto-transition`][struct@crate::Timeline#auto-transition] for the timeline. This will also set
/// the corresponding [`auto-transition`][struct@crate::Layer#auto-transition] for all of the timeline's
/// layers to the same value. See [`LayerExt::set_auto_transition()`][crate::prelude::LayerExt::set_auto_transition()] if you
/// wish to set the layer's [`auto-transition`][struct@crate::Layer#auto-transition] individually.
/// ## `auto_transition`
/// Whether transitions should be automatically added
/// to `self`'s layers
#[doc(alias = "ges_timeline_set_auto_transition")]
#[doc(alias = "auto-transition")]
fn set_auto_transition(&self, auto_transition: bool) {
unsafe {
ffi::ges_timeline_set_auto_transition(
self.as_ref().to_glib_none().0,
auto_transition.into_glib(),
);
}
}
/// Sets [`snapping-distance`][struct@crate::Timeline#snapping-distance] for the timeline. This new value
/// will only effect future snappings and will not be used to snap the
/// current element positions within the timeline.
/// ## `snapping_distance`
/// The snapping distance to use (in nanoseconds)
#[doc(alias = "ges_timeline_set_snapping_distance")]
#[doc(alias = "snapping-distance")]
fn set_snapping_distance(&self, snapping_distance: gst::ClockTime) {
unsafe {
ffi::ges_timeline_set_snapping_distance(
self.as_ref().to_glib_none().0,
snapping_distance.into_glib(),
);
}
}
/// Thaw the timeline so that comiting becomes possible
/// again and any call to ``commit()`` that happened during the rendering is
/// actually taken into account.
#[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[doc(alias = "ges_timeline_thaw_commit")]
fn thaw_commit(&self) {
unsafe {
ffi::ges_timeline_thaw_commit(self.as_ref().to_glib_none().0);
}
}
/// This signal will be emitted once the changes initiated by
/// [`commit()`][Self::commit()] have been executed in the backend. Use
/// [`commit_sync()`][Self::commit_sync()] if you do not want to have to connect
/// to this signal.
#[doc(alias = "commited")]
fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn commited_trampoline<P: IsA<Timeline>, F: Fn(&P) + 'static>(
this: *mut ffi::GESTimeline,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(Timeline::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"commited\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
commited_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
/// Will be emitted after the group is added to to the timeline. This can
/// happen when grouping with `ges_container_group`, or by adding
/// containers to a newly created group.
///
/// Note that this should not be emitted whilst a timeline is being
/// loaded from its [`Project`][crate::Project] asset. You should connect to the
/// project's [`loaded`][struct@crate::Project#loaded] signal if you want to know which groups
/// were created for the timeline.
/// ## `group`
/// The group that was added to `timeline`
#[doc(alias = "group-added")]
fn connect_group_added<F: Fn(&Self, &Group) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn group_added_trampoline<
P: IsA<Timeline>,
F: Fn(&P, &Group) + 'static,
>(
this: *mut ffi::GESTimeline,
group: *mut ffi::GESGroup,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
Timeline::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(group),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"group-added\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
group_added_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
//#[doc(alias = "group-removed")]
//fn connect_group_removed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Empty ctype children: *.PtrArray TypeId { ns_id: 1, id: 54 }
//}
/// Will be emitted after the layer is added to the timeline.
///
/// Note that this should not be emitted whilst a timeline is being
/// loaded from its [`Project`][crate::Project] asset. You should connect to the
/// project's [`loaded`][struct@crate::Project#loaded] signal if you want to know which
/// layers were created for the timeline.
/// ## `layer`
/// The layer that was added to `timeline`
#[doc(alias = "layer-added")]
fn connect_layer_added<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn layer_added_trampoline<
P: IsA<Timeline>,
F: Fn(&P, &Layer) + 'static,
>(
this: *mut ffi::GESTimeline,
layer: *mut ffi::GESLayer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
Timeline::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(layer),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"layer-added\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
layer_added_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
/// Will be emitted after the layer is removed from the timeline.
/// ## `layer`
/// The layer that was removed from `timeline`
#[doc(alias = "layer-removed")]
fn connect_layer_removed<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn layer_removed_trampoline<
P: IsA<Timeline>,
F: Fn(&P, &Layer) + 'static,
>(
this: *mut ffi::GESTimeline,
layer: *mut ffi::GESLayer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
Timeline::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(layer),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"layer-removed\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
layer_removed_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
/// Simplified version of [`select-tracks-for-object`][struct@crate::Timeline#select-tracks-for-object] which only
/// allows `track_element` to be added to a single [`Track`][crate::Track].
/// ## `clip`
/// The clip that `track_element` is being added to
/// ## `track_element`
/// The element being added
///
/// # Returns
///
/// A track to put `track_element` into, or [`None`] if
/// it should be discarded.
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "select-element-track")]
fn connect_select_element_track<
F: Fn(&Self, &Clip, &TrackElement) -> Option<Track> + 'static,
>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn select_element_track_trampoline<
P: IsA<Timeline>,
F: Fn(&P, &Clip, &TrackElement) -> Option<Track> + 'static,
>(
this: *mut ffi::GESTimeline,
clip: *mut ffi::GESClip,
track_element: *mut ffi::GESTrackElement,
f: glib::ffi::gpointer,
) -> *mut ffi::GESTrack {
let f: &F = &*(f as *const F);
f(
Timeline::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(clip),
&from_glib_borrow(track_element),
)
.to_glib_full()
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"select-element-track\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
select_element_track_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
//#[doc(alias = "select-tracks-for-object")]
//fn connect_select_tracks_for_object<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Empty ctype return value *.PtrArray TypeId { ns_id: 1, id: 17 }
//}
/// Will be emitted whenever a snapping event ends. After a snap event
/// has started (see [`snapping-started`][struct@crate::Timeline#snapping-started]), it can later end
/// because either another timeline edit has occurred (which may or may
/// not have created a new snapping event), or because the timeline has
/// been committed.
/// ## `obj1`
/// The first element that was snapping
/// ## `obj2`
/// The second element that was snapping
/// ## `position`
/// The position where the two objects were to be snapped to
#[doc(alias = "snapping-ended")]
fn connect_snapping_ended<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn snapping_ended_trampoline<
P: IsA<Timeline>,
F: Fn(&P, &TrackElement, &TrackElement, u64) + 'static,
>(
this: *mut ffi::GESTimeline,
obj1: *mut ffi::GESTrackElement,
obj2: *mut ffi::GESTrackElement,
position: u64,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
Timeline::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(obj1),
&from_glib_borrow(obj2),
position,
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"snapping-ended\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
snapping_ended_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
/// Will be emitted whenever an element's movement invokes a snapping
/// event during an edit (usually of one of its ancestors) because its
/// start or end point lies within the [`snapping-distance`][struct@crate::Timeline#snapping-distance] of
/// another element's start or end point.
///
/// See [`EditMode`][crate::EditMode] to see what can snap during an edit.
///
/// Note that only up to one snapping-started signal will be emitted per
/// element edit within a timeline.
/// ## `obj1`
/// The first element that is snapping
/// ## `obj2`
/// The second element that is snapping
/// ## `position`
/// The position where the two objects will snap to
#[doc(alias = "snapping-started")]
fn connect_snapping_started<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn snapping_started_trampoline<
P: IsA<Timeline>,
F: Fn(&P, &TrackElement, &TrackElement, u64) + 'static,
>(
this: *mut ffi::GESTimeline,
obj1: *mut ffi::GESTrackElement,
obj2: *mut ffi::GESTrackElement,
position: u64,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
Timeline::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(obj1),
&from_glib_borrow(obj2),
position,
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"snapping-started\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
snapping_started_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
/// Will be emitted after the track is added to the timeline.
///
/// Note that this should not be emitted whilst a timeline is being
/// loaded from its [`Project`][crate::Project] asset. You should connect to the
/// project's [`loaded`][struct@crate::Project#loaded] signal if you want to know which
/// tracks were created for the timeline.
/// ## `track`
/// The track that was added to `timeline`
#[doc(alias = "track-added")]
fn connect_track_added<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn track_added_trampoline<
P: IsA<Timeline>,
F: Fn(&P, &Track) + 'static,
>(
this: *mut ffi::GESTimeline,
track: *mut ffi::GESTrack,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
Timeline::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(track),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"track-added\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
track_added_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
/// Will be emitted after the track is removed from the timeline.
/// ## `track`
/// The track that was removed from `timeline`
#[doc(alias = "track-removed")]
fn connect_track_removed<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn track_removed_trampoline<
P: IsA<Timeline>,
F: Fn(&P, &Track) + 'static,
>(
this: *mut ffi::GESTimeline,
track: *mut ffi::GESTrack,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
Timeline::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(track),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"track-removed\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
track_removed_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "auto-transition")]
fn connect_auto_transition_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_auto_transition_trampoline<
P: IsA<Timeline>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GESTimeline,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(Timeline::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-transition\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_auto_transition_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<Timeline>, F: Fn(&P) + 'static>(
this: *mut ffi::GESTimeline,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(Timeline::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 = "snapping-distance")]
fn connect_snapping_distance_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_snapping_distance_trampoline<
P: IsA<Timeline>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GESTimeline,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(Timeline::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::snapping-distance\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_snapping_distance_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl<O: IsA<Timeline>> TimelineExt for O {}